sdmmc: check card status in SPI mode after sdmmc_erase_sectors

Same as for write operation, some errors are reported only via CMD13.
Without the R1b response support in sdspi driver, this check would
fail. Now that R1b support is implemented, erase command response is
zero (success) on all cards under test.
Also remove the now-unnecessary card reset after erase in the test
case.
This commit is contained in:
Ivan Grokhotkov
2022-04-10 21:46:08 +02:00
parent 3ad98984e9
commit 36e3043306
2 changed files with 14 additions and 4 deletions

View File

@@ -600,6 +600,20 @@ esp_err_t sdmmc_erase_sectors(sdmmc_card_t* card, size_t start_sector,
ESP_LOGE(TAG, "%s: sdmmc_send_cmd returned 0x%x", __func__, err);
return err;
}
if (host_is_spi(card)) {
uint32_t status;
err = sdmmc_send_cmd_send_status(card, &status);
if (err != ESP_OK) {
return err;
}
if (status != 0) {
ESP_LOGE(TAG, "%s: card status indicates an error after erase operation: r2=0x%04x",
__func__, status);
return ESP_ERR_INVALID_RESPONSE;
}
}
return ESP_OK;
}