Skip to content

Commit 49262a3

Browse files
author
Deepika
authored
Merge pull request ARMmbed#58 from deepikabhavnani/sd_cmd12
Should not wait for card to be ready when sending stop command
2 parents 9439243 + d4d1d87 commit 49262a3

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
@@ -697,20 +697,23 @@ int SDBlockDevice::_cmd(SDBlockDevice::cmdSupported cmd, uint32_t arg, bool isAc
697697
// Select card and wait for card to be ready before sending next command
698698
// Note: next command will fail if card is not ready
699699
_select();
700-
if (false == _wait_ready(SD_COMMAND_TIMEOUT)) {
701-
debug_if(SD_DBG, "Card not ready yet \n");
700+
701+
// No need to wait for card to be ready when sending the stop command
702+
if (CMD12_STOP_TRANSMISSION != cmd) {
703+
if (false == _wait_ready(SD_COMMAND_TIMEOUT)) {
704+
debug_if(SD_DBG, "Card not ready yet \n");
705+
}
702706
}
703707

704708
// Re-try command
705709
for(int i = 0; i < 3; i++) {
706710
// Send CMD55 for APP command first
707711
if (isAcmd) {
708712
response = _cmd_spi(CMD55_APP_CMD, 0x0);
709-
}
710-
711-
// Wait for card to be ready after CMD55
712-
if (false == _wait_ready(SD_COMMAND_TIMEOUT)) {
713-
debug_if(SD_DBG, "Card not ready yet \n");
713+
// Wait for card to be ready after CMD55
714+
if (false == _wait_ready(SD_COMMAND_TIMEOUT)) {
715+
debug_if(SD_DBG, "Card not ready yet \n");
716+
}
714717
}
715718

716719
// Send command over SPI interface

0 commit comments

Comments
 (0)