From 0797b03c08cf51fbd75498005626be4e105057c0 Mon Sep 17 00:00:00 2001 From: Michal Lenc Date: Mon, 13 Mar 2023 11:10:09 +0100 Subject: [PATCH] mmcsd: add nxsig_usleep delay after MMC_CMD1 command MMC_CMD1 command is used to check whether card is MMC type (checked if CONFIG_MMCSD_MMCSUPPORT is enabled). This commit inserts nxsig_usleep wait if this check fails. This is to ensure the communication recovers from invalid response as this may take some time on some platforms ( samv7 for example). Following command for SDHC check may fail if sleep is not used. Signed-off-by: Michal Lenc --- drivers/mmcsd/mmcsd_sdio.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/mmcsd/mmcsd_sdio.c b/drivers/mmcsd/mmcsd_sdio.c index ce0f132f628..5465ab781ee 100644 --- a/drivers/mmcsd/mmcsd_sdio.c +++ b/drivers/mmcsd/mmcsd_sdio.c @@ -3377,6 +3377,12 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv) if (ret != OK) { ferr("ERROR: CMD1 RECVR3: %d\n", ret); + + /* CMD1 did not succeed, card is not MMC. This sleep let + * the communication to recover before another send. + */ + + nxsig_usleep(MMCSD_IDLE_DELAY); } else {