From 6383fd550ac23458ef44d11ef6c7eef067aea6c5 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 e07ebd9109..34d584e6b4 100644 --- a/components/sdmmc/sdmmc_common.h +++ b/components/sdmmc/sdmmc_common.h @@ -41,7 +41,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 /* Functions to send individual commands */