SD card cannot be read on this board
log
SD Card Mount Failed
SD card initialization failed.
#include "FS.h"
#include "SD_MMC.h"
// Initialize SD card with custom pins
bool initSDCard() {
// Initialize the SD card
if (!SD_MMC.begin("/", true)) {
Serial.println("SD Card Mount Failed");
return false;
}
Serial.println("SD Card initialized successfully.");
return true;
}
void setup() {
Serial.begin(115200);
if (initSDCard()) {
Serial.println("SD card initialization successful.");
} else {
Serial.println("SD card initialization failed.");
}
}
void loop() {
// Your main code
}
Try the built-in 'SD_test' example of the Arduino IDE instead.
1 Like
srnet
3
Post a link to or image of your SD card holder.
Post a schematic of the connections your using.
Where is your pin definition?
I don't know which one is correct, here is my other code
#include "FS.h"
#include "SD_MMC.h"
int clk = 39;
int cmd = 40;
int d0 = 47;
int d1 = 21;
int d2 = 42;
int d3 = 41;
void setup() {
if(! SD_MMC.setPins(clk, cmd, d0, d1, d2, d3)) {
Serial.println("Pin change failed!");
return;
}
if (!SD_MMC.begin()) {
Serial.println("Card Mount Failed");
return;
}
uint8_t cardType = SD_MMC.cardType();
if (cardType == CARD_NONE) {
Serial.println("No SD_MMC card attached");
return;
}
Serial.print("SD_MMC Card Type: ");
if (cardType == CARD_MMC) {
Serial.println("MMC");
} else if (cardType == CARD_SD) {
Serial.println("SDSC");
} else if (cardType == CARD_SDHC) {
Serial.println("SDHC");
} else {
Serial.println("UNKNOWN");
}
uint64_t cardSize = SD_MMC.cardSize() / (1024 * 1024);
Serial.printf("SD_MMC Card Size: %lluMB\n", cardSize);
}
void loop() {
// put your main code here, to run repeatedly:
}
srnet
8
The actual code you posted shows your using the SD card in MMX mode.
That board appears to only have clk, cmd and d0 connected to the SD card, those are marked on the top of the board with a ~.
So why\how are you trying to use d1,d2,d3 ?
I just follow the library, but I don't know which pins are connected to this type of esp
srnet
10
Have you checked the pin map diagram for your board ?
I got a freenove esp32-s3 wroom cam board..
pretty sure it has the same pinout as yours..
their sd example looks different too..
#include "SD_MMC.h"
#define SD_MMC_CMD 38 //Please do not modify it.
#define SD_MMC_CLK 39 //Please do not modify it.
#define SD_MMC_D0 40 //Please do not modify it.
void setup(){
Serial.begin(115200);
SD_MMC.setPins(SD_MMC_CLK, SD_MMC_CMD, SD_MMC_D0);
if (!SD_MMC.begin("/sdcard", true, true, SDMMC_FREQ_DEFAULT, 5)) {
Serial.println("Card Mount Failed");
return;
}
uint8_t cardType = SD_MMC.cardType();
if(cardType == CARD_NONE){
Serial.println("No SD_MMC card attached");
return;
}
Serial.print("SD_MMC Card Type: ");
if(cardType == CARD_MMC){
Serial.println("MMC");
} else if(cardType == CARD_SD){
Serial.println("SDSC");
} else if(cardType == CARD_SDHC){
Serial.println("SDHC");
} else {
Serial.println("UNKNOWN");
}
uint64_t cardSize = SD_MMC.cardSize() / (1024 * 1024);
Serial.printf("SD_MMC Card Size: %lluMB\n", cardSize);
}
above is their setup, maybe it helps..
good luck.. ~q
I've tried this but none of them work. It always says mount failed
srnet
13
I had one of the ESP32S3 Camera Dev boards on the bench.
The code you posted works on my board.
1 Like
I can confirm @bimosora's issue. I bought the Freenove ESP32 WRover kit but I can't get their tutorial code for the SD card to work.
1 Like
system
Closed
15
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.