Skip to content

Commit d4d1d87

Browse files
author
Deepika
committed
Should not wait for card to be ready when sending stop command
1 parent 6b10f28 commit d4d1d87

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

SDBlockDevice.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -689,20 +689,23 @@ int SDBlockDevice::_cmd(SDBlockDevice::cmdSupported cmd, uint32_t arg, bool isAc
689689
// Select card and wait for card to be ready before sending next command
690690
// Note: next command will fail if card is not ready
691691
_select();
692-
if (false == _wait_ready(SD_COMMAND_TIMEOUT)) {
693-
debug_if(SD_DBG, "Card not ready yet \n");
692+
693+
// No need to wait for card to be ready when sending the stop command
694+
if (CMD12_STOP_TRANSMISSION != cmd) {
695+
if (false == _wait_ready(SD_COMMAND_TIMEOUT)) {
696+
debug_if(SD_DBG, "Card not ready yet \n");
697+
}
694698
}
695699

696700
// Re-try command
697701
for(int i = 0; i < 3; i++) {
698702
// Send CMD55 for APP command first
699703
if (isAcmd) {
700704
response = _cmd_spi(CMD55_APP_CMD, 0x0);
701-
}
702-
703-
// Wait for card to be ready after CMD55
704-
if (false == _wait_ready(SD_COMMAND_TIMEOUT)) {
705-
debug_if(SD_DBG, "Card not ready yet \n");
705+
// Wait for card to be ready after CMD55
706+
if (false == _wait_ready(SD_COMMAND_TIMEOUT)) {
707+
debug_if(SD_DBG, "Card not ready yet \n");
708+
}
706709
}
707710

708711
// Send command over SPI interface

0 commit comments

Comments
 (0)