This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 0797b03c08 mmcsd: add nxsig_usleep delay after MMC_CMD1 command
0797b03c08 is described below

commit 0797b03c08cf51fbd75498005626be4e105057c0
Author: Michal Lenc <[email protected]>
AuthorDate: Mon Mar 13 11:10:09 2023 +0100

    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 <[email protected]>
---
 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 ce0f132f62..5465ab781e 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
     {

Reply via email to