Retry command sending on SD card

Sometimes card is busy programming multiple blocks and responds with 0xFF
i.e. response. Re-trying 3 times to send the command.
pull/7774/head
Deepika 2017-06-27 14:01:40 -05:00
parent a7f23635a4
commit d82f084f11
1 changed files with 13 additions and 6 deletions

View File

@ -603,7 +603,8 @@ int SDBlockDevice::_cmd(SDBlockDevice::cmdSupported cmd, uint32_t arg, bool isAc
debug_if(SD_DBG, "Card not ready yet \n");
}
// Re-try command
for(int i = 0; i < 3; i++) {
// Send CMD55 for APP command first
if (isAcmd) {
_cmd_spi(CMD55_APP_CMD, 0x0);
@ -611,7 +612,13 @@ int SDBlockDevice::_cmd(SDBlockDevice::cmdSupported cmd, uint32_t arg, bool isAc
// Send command over SPI interface
response = _cmd_spi(cmd, arg);
debug_if(_dbg, "CMD:%d \t arg:0x%x \t Response:0x%x \n", cmd, arg, response);
if (R1_NO_RESPONSE == response) {
debug_if(SD_DBG, "No response CMD:%d \n", cmd);
continue;
}
break;
}
// Pass the response to the command call if required
if (NULL != resp) {
*resp = response;