Unverified Commit bb7df044 authored by P-R-O-C-H-Y's avatar P-R-O-C-H-Y Committed by GitHub

Fix - SD mount issue (#6162)

* sdSelectCard longer timeout for sdWait

* GO_IDLE_STATE command ignores sdWait fail
parent ce68d721
......@@ -121,7 +121,7 @@ bool sdSelectCard(uint8_t pdrv)
{
ardu_sdcard_t * card = s_cards[pdrv];
digitalWrite(card->ssPin, LOW);
bool s = sdWait(pdrv, 300);
bool s = sdWait(pdrv, 500);
if (!s) {
log_e("Select Failed");
digitalWrite(card->ssPin, HIGH);
......@@ -506,10 +506,17 @@ DSTATUS ff_sd_initialize(uint8_t pdrv)
card->spi->transfer(0XFF);
}
if (sdTransaction(pdrv, GO_IDLE_STATE, 0, NULL) != 1) {
// Fix mount issue - sdWait fail ignored before command GO_IDLE_STATE
digitalWrite(card->ssPin, LOW);
if(!sdWait(pdrv, 500)){
log_w("sdWait fail ignored, card initialize continues");
}
if (sdCommand(pdrv, GO_IDLE_STATE, 0, NULL) != 1){
sdDeselectCard(pdrv);
log_w("GO_IDLE_STATE failed");
goto unknown_card;
}
sdDeselectCard(pdrv);
token = sdTransaction(pdrv, CRC_ON_OFF, 1, NULL);
if (token == 0x5) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment