mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-16 04:22:22 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user