From fb95daab06e426c1629f20405258b152baeef468 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 27 Feb 2024 12:21:09 +0100 Subject: [PATCH] fix(sdmmc): extend the maximum number of retries of ACMD41 According to the application note in SD Card Physical Specification: > The host shall set ACMD41 timeout more than 1 second to abort repeat of issuing ACMD41 when the card does not indicate ready. The timeout count starts from the first ACMD41 which is set voltage window in the argument. Previously, the timeout was exactly one second, and this caused certain larger-capacity cards to "time out", because they couldn't finish initialization process in time. --- components/sdmmc/sdmmc_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/sdmmc/sdmmc_common.h b/components/sdmmc/sdmmc_common.h index cd271e8a7c..d5da45d4fd 100644 --- a/components/sdmmc/sdmmc_common.h +++ b/components/sdmmc/sdmmc_common.h @@ -48,7 +48,7 @@ /* Maximum retry/error count for SEND_OP_COND (CMD1). * These are somewhat arbitrary, values originate from OpenBSD driver. */ -#define SDMMC_SEND_OP_COND_MAX_RETRIES 100 +#define SDMMC_SEND_OP_COND_MAX_RETRIES 300 #define SDMMC_SEND_OP_COND_MAX_ERRORS 3 /* supported arguments for erase command 38 */