T-Display-S3 (touch version) trouble to connect SD card reader (SPI)
-
Hi,
I try to connect a SD reader via SPI to the T-Display-S3 touch version - sadly without success.
From reading other comments/websites it seems I can freely define the pins for a secondary (HSPI) SPI bus.
This is what I tried:#include "FS.h" #include "SD.h" #include "SPI.h" SPIClass spiSD(HSPI); #define SDSPEED 27000000 // SPI port #2: SD Card Adapter #define SD_CLK 21 //yellow #define SD_MISO 18 //brown #define SD_MOSI 17 //orange #define SD_CS 16 //green
in setup I have:
Serial.begin(9600); spiSD.begin(SD_CLK, SD_MISO, SD_MOSI, SD_CS); //SCK,MISO,MOSI,cs if (!SD.begin(SD_CS, spiSD, SDSPEED)) { Serial.println("Card Mount Failed!"); return; } else { Serial.println("Card Mount Successful!"); }
but all I get is "Card Mount failed" - I have multiple reader modules, but I get the same result with all of them, so i assume the issue is with my setup/pins/code...
any help would be highly appreciated - thanks in advance
-
I found the solution on my own with some help of Google.
In the end I only had to add one more line of code to make it work (switching the CS Pin to output...):pinMode(SD_CS,OUTPUT);
so the complete code-part looks like this:
void setup() { Serial.begin(9600); spiSD.begin(SD_CLK, SD_MISO, SD_MOSI, SD_CS); //SCK,MISO,MOSI,cs pinMode(SD_CS,OUTPUT); if (!SD.begin(SD_CS, spiSD, SDSPEED)) { Serial.println("Card Mount Failed!"); return; } else { Serial.println("Card Mount Successful!"); } }
-
Hi Stefan, I was curious if you using the SPI port had any interference with the touch functionality.
I noticed that in the pinout the SPI pins 10-13 are also connected to some of the touch pins ?
I'm still waiting on my device to arrive but I hope there is no issue there.
Thank you.
-
@eflorea The "Touch pins" are an ESP32 Espressif use of the pins as analog sensing for a home brew touch interface.
The Touch Screen on the LilyGO T-Display S3 Touch is I2C thus:
https://github.com/Xinyuan-LilyGO/T-Display-S3/blob/main/image/T-DISPLAY-S3-TOUCH.png
So the touch vesion uses up 4 GPIO that the standard model could use GPIO !!!
You should have no trouble.
-Terry -
Thanks for the heads up Terry, I just had my T-Display-S3 Touch delivered on Friday, I will be jumping on it very soon, I need to resolve an issue with the none touch unit....I posted that topic tonight.
Thank you again.
-
any thing new for now?
I tested the code above not luck. -
@llsummer What problem are you having?
What exact board do you have? -
@teastain2 said in T-Display-S3 (touch version) trouble to connect SD card reader (SPI):
What exact board do you have?
Thanks.
I have T-Display S3 basic + SD card.
I heard that the Touch version more difficulty to work with SD? -
@llsummer You should have no trouble with either.
Try this official sketch:
https://github.com/Xinyuan-LilyGO/T-Display-S3/tree/main/examples/sd -
@teastain2 Thanks.
not work.The example/SD just define 3 pins, and I didn't find any where mentioned SD_CS, can be a problem?
I used SD card reader with 6 pins.
-
You have to do more self-research. SD on ESP32 is not easy, but it can be done.
There are many many SD memories that cannot be used.No, I will not elaborate.
-
This post is deleted!