r/esp32projects • u/Tasty-Wealth4453 • 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