Description
Board
ESP32-WROOM-32
Device Description
ESP32-WROOM-32
Hardware Configuration
i have try with esp32 and sd card VSPI & HSPI CS PIN 5 or 15
Version
v2.0.11
IDE Name
Arduino IDE
Operating System
Windows 10
Flash frequency
40Mhz
PSRAM enabled
yes
Upload speed
115200
Description
im working with esp32 and sd.h library. and i have a few dirrent sd cards.
some models are working with half clock period earlier. this models are not working with current esp32 sd.h library.
### Current Working Normal SD Card Timing Output
### Not Working SD Card half clock period earlier
The response timing for ACMD41 , which is used to detect the completion status of initialization, value 0x00 is for completion.
From the timing capture by logic analyzer, it is seen that response data comes half clock period Working SD Card, so it is highly suggested that sampling response data
Not Working with half clock period earlier . otherwise, it is possible to get a wrong
data of 0x01 instead of 0x00 .
This response output is on the DO pin in this case.
### Current Working Normal SD Card Response Timing
### Not Working Normal SD Card Response Timing
These example are all the response timing for CMD8 , which is used to send SD card interface condition , value 0x08 is the correct response value .
From the timing capture by logic analyzer, it is seen that response data comes half clock period
earlier for Notworking SD Card, so it is highly suggested that sampling response data
for Notworking SD Card with half clock period earlier . otherwise, it is possible to get a wrong
data of 0x10 instead of 0x08 .
This response output is on the CMD pin in this case
How I can fix with Not Working SD card SPI read write half clock period earlier ? can anyone to help with this ? @me-no-dev
Sketch
#include "FS.h"
#include "SD.h"
#include "SPI.h"
void setup() {
Serial.begin(115200);
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);
// Write to file
File file = SD.open("/hello.txt", FILE_WRITE);
if(!file){
Serial.println("Failed to open file for writing");
return;
}
file.println("Hello from ESP32");
file.close();
Serial.println("File written");
// Read file
file = SD.open("/hello.txt");
if(!file){
Serial.println("Failed to open file for reading");
return;
}
Serial.println("Reading file:");
while(file.available()){
Serial.write(file.read());
}
file.close();
}
void loop() {
// Nothing to do here
}
Debug Message
Card Mount Failed
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.