You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/04/14 18:22:08 UTC
[incubator-nuttx] 01/05: arch/arm/src/sam34/sam_hsmci.c: delay required after sending command
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit bc7f4b2375438951e7cdd26fe28e049068f9bfb3
Author: Richard Tucker <rt...@mookins.com>
AuthorDate: Tue Mar 22 16:55:50 2022 +1100
arch/arm/src/sam34/sam_hsmci.c: delay required after sending command
---
arch/arm/src/sam34/sam_hsmci.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/arch/arm/src/sam34/sam_hsmci.c b/arch/arm/src/sam34/sam_hsmci.c
index 8cc0f95ea1..86f27a83ac 100644
--- a/arch/arm/src/sam34/sam_hsmci.c
+++ b/arch/arm/src/sam34/sam_hsmci.c
@@ -41,6 +41,7 @@
#include <nuttx/mmcsd.h>
#include <nuttx/irq.h>
+#include <nuttx/signal.h>
#include <arch/board/board.h>
#include "chip.h"
@@ -1800,6 +1801,19 @@ static int sam_sendcmd(FAR struct sdio_dev_s *dev,
cmd, arg, regval);
putreg32(regval, SAM_HSMCI_CMDR);
sam_cmdsample1(SAMPLENDX_AFTER_CMDR);
+
+ /* Card initialisation is unsuccessful without the following delay.
+ *
+ * It appears the timing from writing SAM_HSMCI_CMDR to calling
+ * sam_waitresponse is too short.
+ *
+ * For now the simplest solution is to add this delay.
+ * Further investigation is required to find the root cause and
+ * correct solution.
+ */
+
+ nxsig_usleep(10);
+
return OK;
}