Skip to content

Commit f12c725

Browse files
authored
Merge pull request #1436 from NickeZ/nickez/sd-more-robust
sd: wait more after reset
2 parents d3c8f5f + 7f662f3 commit f12c725

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

external/asf4-drivers/sd_mmc/sd_mmc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ static bool sd_mmc_mci_card_init(void)
807807

808808
/* CMD52 Reset SDIO */
809809
sdio_cmd52(SDIO_CMD52_WRITE_FLAG, SDIO_CIA, SDIO_CCCR_IOA, 0, &data);
810-
delay_ms(1);
810+
delay_ms(10);
811811

812812
/* CMD0 - Reset all cards to idle state.*/
813813
if (!driver_send_cmd(sd_mmc_hal, SDMMC_MCI_CMD0_GO_IDLE_STATE, 0)) {

src/sd.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,21 @@ bool sd_card_inserted(void)
326326
}
327327
}
328328
}
329+
#if !defined(NDEBUG)
330+
switch (err) {
331+
case SD_MMC_OK:
332+
break;
333+
case SD_MMC_ERR_UNUSABLE:
334+
util_log("sd_mmc_check returned \"SD_MMC_ERR_UNUSABLE\"");
335+
break;
336+
case SD_MMC_INIT_ONGOING:
337+
util_log("sd_mmc_check returned \"SD_MMC_INIT_ONGOING\" after 10 retries");
338+
break;
339+
default:
340+
util_log("sd_mmc_check returned %d", err);
341+
break;
342+
}
343+
#endif
329344
return err == SD_MMC_OK;
330345
#endif
331346
}

0 commit comments

Comments
 (0)