How to use SD card slot on ili9341

Hello, I want to use the display, the touchinterface and the sd slot of a ili9341 Touchdisplay. I use TFT_SPI and a ESP32 S3 Devkitc1. The display and the touchinterface work fine, however i just can't connect to the SD slot. No matter what i try, i get the following error:

 Rebooting...
�%N)�␜^�HD��J9�9�9M�[  1149][E][sd_diskio.cpp:802] sdcard_mount(): f_mount failed: (3) The physical drive cannot work
[  1649][E][sd_diskio.cpp:126] sdSelectCard(): Select Failedinitialization failed!
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x4205ba4b  PS      : 0x00060630  A0      : 0x820077dc  A1      : 0x3fcebb60  
A2      : 0x00000000  A3      : 0x00000000  A4      : 0x00000014  A5      : 0x40900000
A6      : 0x00000000  A7      : 0x00000000  A8      : 0x82003a1c  A9      : 0x3fcebb80  
A10     : 0x00000000  A11     : 0x00000000  A12     : 0x00000001  A13     : 0x00000039
A14     : 0x00000c00  A15     : 0x00000001  SAR     : 0x0000001d  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000008  LBEG    : 0x40054bf0  LEND    : 0x40054c0f  LCOUNT  : 0x00000000

In tft_espi user_setup.h i have defined:


#define TFT_MISO 12
#define TFT_MOSI 11
#define TFT_SCLK 13
#define TFT_CS  10  // Chip select control pin
#define TFT_DC   42  // Data Command control pin
#define TOUCH_CS 2
#define TFT_RST  1  // Reset pin (could connect to RST pin)

11, 12, 13 are also the pins where i wired SD_sck, SD_MOSI and SD_MISO.
Here is the relevant code for the sd, nothing to crazy:

#include <lvgl.h>
#include <TFT_eSPI.h>
#include <Arduino.h>
#include <SD.h>



#define SD_CS 7

File myFile;

void setup{

 if (!SD.begin(SD_CS)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization sd done.");

  // open the file for write at end like the "Native SD library"
  myFile = SD.open("test.txt", FILE_WRITE);
  myFile = SD.open("test2.txt", FILE_WRITE);
 
}

Did i do something wrong with the wiring? I also tried using VMISO etc. but it didn't change anything. Or is there some other mistake i made? Pls help me out on this, I'm going crazy.
Thanks in advance

Hello, I want to use the display, the touchinterface and the sd slot of a ili9341 Touchdisplay. I use TFT_SPI and a ESP32 S3 Devkitc1. The display and the touchinterface work fine, however i just can't connect to the SD slot. No matter what i try, i get the following error:

 Rebooting...
�%N)�␜^�HD��J9�9�9M�[  1149][E][sd_diskio.cpp:802] sdcard_mount(): f_mount failed: (3) The physical drive cannot work
[  1649][E][sd_diskio.cpp:126] sdSelectCard(): Select Failedinitialization failed!
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x4205ba4b  PS      : 0x00060630  A0      : 0x820077dc  A1      : 0x3fcebb60  
A2      : 0x00000000  A3      : 0x00000000  A4      : 0x00000014  A5      : 0x40900000
A6      : 0x00000000  A7      : 0x00000000  A8      : 0x82003a1c  A9      : 0x3fcebb80  
A10     : 0x00000000  A11     : 0x00000000  A12     : 0x00000001  A13     : 0x00000039
A14     : 0x00000c00  A15     : 0x00000001  SAR     : 0x0000001d  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000008  LBEG    : 0x40054bf0  LEND    : 0x40054c0f  LCOUNT  : 0x00000000

In tft_espi user_setup.h i have defined:

#define TFT_MISO 12
#define TFT_MOSI 11
#define TFT_SCLK 13
#define TFT_CS  10  // Chip select control pin
#define TFT_DC   42  // Data Command control pin
#define TOUCH_CS 2
#define TFT_RST  1  // Reset pin (could connect to RST pin)

11, 12, 13 are also the pins where i wired SD_sck, SD_MOSI and SD_MISO.
Here is the relevant code for the sd, nothing to crazy:

#include <lvgl.h>
#include <TFT_eSPI.h>
#include <Arduino.h>
#include <SD.h>



#define SD_CS 7

File myFile;

void setup{

 if (!SD.begin(SD_CS)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization sd done.");

  // open the file for write at end like the "Native SD library"
  myFile = SD.open("test.txt", FILE_WRITE);
  myFile = SD.open("test2.txt", FILE_WRITE);
 
}

Did i do something wrong with the wiring? I also tried using VMISO etc. but it didn't change anything. Or is there some other mistake i made? Pls help me out on this, I#m working on it for days now and I'm going crazy.
Thanks in advance

Please do not duplicate threads on the forum.
Opening a more than one thread about the same problem is a violation of the forum rules.

Threads merged.

What version of of the SD library are you using?

Its seems there have been some problems with older versions of the library and some Sandisk 32Gb and 16Gb cards:

^SD Mount Fail · Issue #6143 · espressif/arduino-esp32 · GitHub

^SD cards not mounting · Issue #7707 · espressif/arduino-esp32 · GitHub

I'm using 2.0.0.0. I allready tried two different sd cards. I'also tried to use a second sd card reader, however from the exact same type.

Have you checked to see if your display is actually tri-stating the TFT_MISO line when TFT_CS is not asserted? Not all displays do unfortunately, and if that's the case with yours, you'll not be able to communicate with the SD card.

A quick check is to remove the connection to the TFT_MISO line and see if the SD card suddenly starts working. If it does, you have two choices: leave the TFT_MISO line unconnected (you'll still be able to write to the display, but not read from it), or add hardware to properly tri-state the TFT_MISO line.

thanks for the suggestion, but i allready tried it and it still doesn't work

What voltage are you applying to the Vcc pin of the display/SD unit. If it's 3.3V, I think you need to close jumper J1. J1 would be open for 5V input.

Yes I'm applying 3.3V what effect would opening the jumper have?

The jumper when shorted connects the input of the 3.3V regulator to the output, thus bypassing the regulator. You would use it that way when powering with 3.3V because you already have 3.3V, and running it through the regulator might reduce the voltage too much for the SD card to work.

But if you power with 5V, you should open the jumper so the regulator will function properly and put out the 3.3V the card needs.

I'm not making this up.

https://www.youtube.com/watch?v=ZmMTr8LEa1A

Ok, thanks for the tipp and helping me out. Will try!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.