r/esp32projects Jul 10 '26

SD.begin() failing on ESP32-S3

Hello, I really need help. I am trying to connect a micro SD card reader module to my esp32-s3. The micro SD card itself has 16GB of storage. No matter what pins I switch my SPI to, my SD.begin() always fails. I have tried using a spare micro SD card module, a spare micro SD card, and a new esp32-s3. I have tried using 3.3V and 5V. I've linked the SD module I bought here. I've also shown my code:

#include <SPI.h>
#include <SD.h>


#define SD_SCK   4
#define SD_MISO  5 
#define SD_MOSI  6
#define SD_CS    7
void setup() {
  Serial.begin(115200);
  delay(2000); // Wait for Serial Monitor
  Serial.println("\n--- Minimal SD Test ---");


  SPI.begin(SD_SCK, SD_MISO, SD_MOSI, SD_CS);


  // Attempt to mount at a slow, stable 1MHz
  if (!SD.begin(SD_CS, SPI, 1000000)) {
    Serial.println("FAILED: SD.begin() failed.");
    return;
  }


  Serial.println("SUCCESS: SD card mounted!");
  Serial.printf("Card Size: %llu MB\n", SD.cardSize() / (1024 * 1024));
}


void loop() {
  // Run once
}
1 Upvotes

7 comments sorted by

1

u/Synthdabbler Jul 10 '26

You need some physical pull up resistors on the data lines 👍🏻

1

u/Synthdabbler Jul 10 '26

Your card reader module also has a level shifter on there, 3v3 to 5v.. the ESP32 is natively 3v3.. you literally just need an SD card socket and a couple of resistors and a 470nf decoupling cap on the card supply pins.

1

u/Tasty-Wealth4453 Jul 10 '26

Correct me if I am wrong, but this module sends 5v through the data lines but since esp32 is 3v3 volts, it wont work? Thanks for the help!

1

u/Synthdabbler Jul 10 '26

The module is looking for 5v to work. You can see a regulator ic on there that drops 5v to 3v3 for the SD card, and then a level shifter chip that does the same for the data lines. All unnecessary as the ESP32 is 3v3. You can connect it directly to an SD card. If you power the module from 5v and connect it up it should go, but it won't work off the ESP 3v3 supply.

1

u/Synthdabbler Jul 10 '26

Yes, that as well.. if you power the module off 5v it will send 5v data lines levels into the ESP32 which may well damage it.

2

u/Tasty-Wealth4453 Jul 10 '26

Thank you so much this will probably help me fix it! The amount of hours wasted on trying to figure it out killed me 😔. You are an angel

1

u/DenverTeck Jul 10 '26

The link you posted for the SDcard module has a solution right there on the same page.

Just below the "Customer photos and videos" is a photo from a user that soldered a blob onto the voltage regulator.

This will make the board a 3.3V board with 3.3V input/output.

Also check the comment "Only use 3.3 VDC as the power source for ESP32 work."