From b08ddfb25bcebb63de67c5763e92c68bf5927b58 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 5 Apr 2024 17:46:27 +0200 Subject: [PATCH] fix(sdmmc): don't fail in clock update commands when no card detected Clock update commands don't actually require the card to be present, so it's not necessary to fail at this stage. --- components/esp_driver_sdmmc/src/sdmmc_host.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/esp_driver_sdmmc/src/sdmmc_host.c b/components/esp_driver_sdmmc/src/sdmmc_host.c index 2a2e4c9cc0..2362e03028 100644 --- a/components/esp_driver_sdmmc/src/sdmmc_host.c +++ b/components/esp_driver_sdmmc/src/sdmmc_host.c @@ -348,7 +348,8 @@ esp_err_t sdmmc_host_start_command(int slot, sdmmc_hw_cmd_t cmd, uint32_t arg) if (!(slot == 0 || slot == 1)) { return ESP_ERR_INVALID_ARG; } - if (!sdmmc_ll_is_card_detected(s_host_ctx.hal.dev, slot)) { + // if this isn't a clock update command, check the card detect status + if (!sdmmc_ll_is_card_detected(s_host_ctx.hal.dev, slot) && !cmd.update_clk_reg) { return ESP_ERR_NOT_FOUND; } if (cmd.data_expected && cmd.rw && sdmmc_ll_is_card_write_protected(s_host_ctx.hal.dev, slot)) {