Navigation

    LILYGO

    • Register
    • Login
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    T-Display-S3 (touch version) trouble to connect SD card reader (SPI)

    Common problems
    4
    12
    1539
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      Stefan last edited by

      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 🙂

      1 Reply Last reply Reply Quote 0
      • S
        Stefan last edited by

        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!");
          }
        }
        
        1 Reply Last reply Reply Quote 0
        • E
          eflorea last edited by

          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.

          teastain2 1 Reply Last reply Reply Quote 0
          • teastain2
            teastain2 @eflorea last edited by

            @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:
            Screenshot 2023-08-24 at 3.22.27 PM.png
            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

            E 1 Reply Last reply Reply Quote 0
            • E
              eflorea @teastain2 last edited by

              @teastain2

              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.

              1 Reply Last reply Reply Quote 0
              • L
                llsummer last edited by llsummer

                any thing new for now?
                I tested the code above not luck.

                teastain2 1 Reply Last reply Reply Quote 0
                • teastain2
                  teastain2 @llsummer last edited by

                  @llsummer What problem are you having?
                  What exact board do you have?

                  L 1 Reply Last reply Reply Quote 1
                  • L
                    llsummer @teastain2 last edited by

                    @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?

                    teastain2 1 Reply Last reply Reply Quote 0
                    • teastain2
                      teastain2 @llsummer last edited by

                      @llsummer You should have no trouble with either.
                      Try this official sketch:
                      https://github.com/Xinyuan-LilyGO/T-Display-S3/tree/main/examples/sd

                      L 1 Reply Last reply Reply Quote 1
                      • L
                        llsummer @teastain2 last edited by llsummer

                        @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.

                        teastain2 1 Reply Last reply Reply Quote 0
                        • teastain2
                          teastain2 @llsummer last edited by

                          @llsummer Screenshot 2024-06-08 at 10.59.03 PM.png

                          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.

                          L 1 Reply Last reply Reply Quote 0
                          • L
                            llsummer @teastain2 last edited by

                            This post is deleted!
                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Powered by NodeBB | Contributors