aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
Diffstat (limited to 'os')
-rw-r--r--os/hal/include/sdc.h2
-rw-r--r--os/hal/platforms/STM32/sdc_lld.c6
-rw-r--r--os/hal/src/sdc.c2
3 files changed, 10 insertions, 0 deletions
diff --git a/os/hal/include/sdc.h b/os/hal/include/sdc.h
index d578e65b4..860bbbbda 100644
--- a/os/hal/include/sdc.h
+++ b/os/hal/include/sdc.h
@@ -35,6 +35,8 @@
/* Driver constants. */
/*===========================================================================*/
+#define SDC_CMD_GO_IDLE_STATE 0
+
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
diff --git a/os/hal/platforms/STM32/sdc_lld.c b/os/hal/platforms/STM32/sdc_lld.c
index 25c7b6897..8517a040d 100644
--- a/os/hal/platforms/STM32/sdc_lld.c
+++ b/os/hal/platforms/STM32/sdc_lld.c
@@ -194,6 +194,12 @@ void sdc_lld_set_bus_mode(SDCDriver *sdcp, sdcbusmode_t mode) {
*/
void sdc_lld_send_cmd_none(SDCDriver *sdcp, uint8_t cmd, uint32_t arg) {
+ (void)sdcp;
+ SDIO->ARG = arg;
+ SDIO->CMD = (uint32_t)cmd | SDIO_CMD_CPSMEN;
+ while ((SDIO->STA & SDIO_STA_CMDSENT) == 0)
+ ;
+ SDIO->ICR = 0xFFFFFFFF;
}
/**
diff --git a/os/hal/src/sdc.c b/os/hal/src/sdc.c
index 701071b8b..b64dcf9c5 100644
--- a/os/hal/src/sdc.c
+++ b/os/hal/src/sdc.c
@@ -137,6 +137,8 @@ bool_t sdcConnect(SDCDriver *sdcp) {
sdc_lld_start_clk(sdcp);
+ sdc_lld_send_cmd_none(sdcp, SDC_CMD_GO_IDLE_STATE, 0);
+
sdcp->state = SDC_ACTIVE;
return FALSE;
}