8000 Fix - SD mount issue (#6162) · GaelicGrime/arduino-esp32@bb7df04 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bb7df04

Browse files
authored
Fix - SD mount issue (espressif#6162)
* sdSelectCard longer timeout for sdWait * GO_IDLE_STATE command ignores sdWait fail
1 parent ce68d72 commit bb7df04

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

libraries/SD/src/sd_diskio.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ bool sdSelectCard(uint8_t pdrv)
121121
{
122122
ardu_sdcard_t * card = s_cards[pdrv];
123123
digitalWrite(card->ssPin, LOW);
124-
bool s = sdWait(pdrv, 300);
124+
bool s = sdWait(pdrv, 500);
125125
if (!s) {
126126
log_e("Select Failed");
127127
digitalWrite(card->ssPin, HIGH);
@@ -506,10 +506,17 @@ DSTATUS ff_sd_initialize(uint8_t pdrv)
506506
card->spi->transfer(0XFF);
507507
}
508508

509-
if (sdTransaction(pdrv, GO_IDLE_STATE, 0, NULL) != 1) {
509+
// Fix mount issue - sdWait fail ignored before command GO_IDLE_STATE
510+
digitalWrite(card->ssPin, LOW);
511+
if(!sdWait(pdrv, 500)){
512+
log_w("sdWait fail ignored, card initialize continues");
513+
}
514+
if (sdCommand(pdrv, GO_IDLE_STATE, 0, NULL) != 1){
515+
sdDeselectCard(pdrv);
510516
log_w("GO_IDLE_STATE failed");
511517
goto unknown_card;
512518
}
519+
sdDeselectCard(pdrv);
513520

514521
token = sdTransaction(pdrv, CRC_ON_OFF, 1, NULL);
515522
if (token == 0x5) {

0 commit comments

Comments
 (0)
0