ESP32 SD Mount Failed
Posted: Mon Jan 02, 2023 11:31 am
Hey there! Recently, I ran into a problem with sd mounting. It always says "SD mount failed", even when SD is not inserted. SD module is wired to standard VSPI pins.
here's a sketch:
And here's a serial response:
Maybe someone can help? Thank you!
here's a sketch:
Code: Select all
#include <Arduino.h>
//#include <WiFi.h>
//#include <AsyncTCP.h>
//#include <ESPAsyncWebServer.h>
//#include "FS.h"
#include "SD.h"
#include "TFT_eSPI.h"
#include "SPI.h"
void initTFT(){
TFT_eSPI tft=TFT_eSPI();
tft.init();
tft.fillScreen(TFT_BLACK);
tft.drawString("Hello World! I'm OstapStad", 2, 2);
}
void initSDCard(){
if(!SD.begin()){
Serial.println("Card Mount Failed");
return;
}
uint8_t cardType = SD.cardType();
if(cardType == CARD_NONE){
Serial.println("No SD card attached");
return;
}
Serial.print("SD 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.cardSize() / (1024 * 1024);
Serial.printf("SD Card Size: %lluMB\n", cardSize);
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.print("MOSI: ");
Serial.println(MOSI);
Serial.print("MISO: ");
Serial.println(MISO);
Serial.print("SCK: ");
Serial.println(SCK);
Serial.print("SS: ");
Serial.println(SS);
Serial.begin(115200);
initTFT();
initSDCard();
}
void loop() {
}
Code: Select all
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13836
load:0x40080400,len:3608
entry 0x400805f0
MOSI: 23
MISO: 19
SCK: 18
SS: 5
Card Mount Failed