mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04: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:
parent
3ad98984e9
commit
36e3043306
@ -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;
|
||||
}
|
||||
|
||||
|
@ -869,10 +869,6 @@ static void test_sdspi_erase_blocks(size_t start_block, size_t block_count)
|
||||
float time_er = 1e3f * (t_stop_wr.tv_sec - t_start_er.tv_sec) + 1e-3f * (t_stop_wr.tv_usec - t_start_er.tv_usec);
|
||||
printf("Erase duration: %.2fms\n", time_er);
|
||||
|
||||
// nominal delay before re-init card
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
// has to re-init card, after erase operation.
|
||||
TEST_ESP_OK(sdmmc_card_init(&config, card));
|
||||
printf("Verifying erase state...\n");
|
||||
uint8_t erase_mem_byte = 0xFF;
|
||||
// ensure all the blocks are erased and are up to after erase state.
|
||||
|
Loading…
Reference in New Issue
Block a user