]> granicus.if.org Git - esp-idf/commitdiff
sdmmc: do expect CMD_DONE interrupt after response timeout
authorIvan Grokhotkov <ivan@espressif.com>
Thu, 17 Aug 2017 16:28:56 +0000 (00:28 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Wed, 11 Apr 2018 03:06:50 +0000 (11:06 +0800)
Existing code assumed that response timeout is not followed by CMD_DONE,
which was not true, in fact. Host datasheet states that CMD_DONE is sent
after an RTO.

components/driver/sdmmc_transaction.c

index c62d7891401ef227fb601423bca87c28203c032d..1e95eada0cf95675aa351fcedd62ebfe5ce44d04 100644 (file)
@@ -357,15 +357,7 @@ static esp_err_t process_events(sdmmc_event_t evt, sdmmc_command_t* cmd, sdmmc_r
             case SDMMC_SENDING_CMD:
                 if (mask_check_and_clear(&evt.sdmmc_status, SDMMC_CMD_ERR_MASK)) {
                     process_command_response(orig_evt.sdmmc_status, cmd);
-                    if (cmd->error != ESP_ERR_TIMEOUT) {
-                        // Unless this is a timeout error, we need to wait for the
-                        // CMD_DONE interrupt
-                        break;
-                    }
-                }
-                if (!mask_check_and_clear(&evt.sdmmc_status, SDMMC_INTMASK_CMD_DONE) &&
-                        cmd->error != ESP_ERR_TIMEOUT) {
-                    break;
+                    break;      // Need to wait for the CMD_DONE interrupt
                 }
                 process_command_response(orig_evt.sdmmc_status, cmd);
                 if (cmd->error != ESP_OK || cmd->data == NULL) {