From c4c7e7c82b0d592587b40bd81ba3629147ac5f25 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Sun, 10 Apr 2022 21:22:16 +0200 Subject: [PATCH] sdmmc: support sdmmc_send_cmd_send_status in SPI mode SPI mode uses different response format (2-byte R2) compared to SD mode. --- components/sdmmc/sdmmc_cmd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/sdmmc/sdmmc_cmd.c b/components/sdmmc/sdmmc_cmd.c index 706badb1ae..9b3c7280b8 100644 --- a/components/sdmmc/sdmmc_cmd.c +++ b/components/sdmmc/sdmmc_cmd.c @@ -347,7 +347,11 @@ esp_err_t sdmmc_send_cmd_send_status(sdmmc_card_t* card, uint32_t* out_status) return err; } if (out_status) { - *out_status = MMC_R1(cmd.response); + if (host_is_spi(card)) { + *out_status = SD_SPI_R2(cmd.response); + } else { + *out_status = MMC_R1(cmd.response); + } } return ESP_OK; }