1
\$\begingroup\$

I am trying example about SDIO with board Open407V-D. I get problem with reset SD card (CMD0). When checking status for sending CMD0, bit 11 (CMDACT) of status register is always set 1. Therefore, time out occurs. How to fix this problems???

 /* CMD0: GO_IDLE_STATE -------------------------------------------------------*/
 /* No CMD response required */
 SDIO_CmdInitStructure.SDIO_Argument = 0x0;
 SDIO_CmdInitStructure.SDIO_CmdIndex = SDIO_GO_IDLE_STATE;
 SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_No;
 SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No;
 SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable;
 SDIO_SendCommand(&SDIO_CmdInitStructure);

 errorstatus = CmdError();

 if (errorstatus != SD_OK)
 {
    /* CMD Response TimeOut (wait for CMDSENT flag) */
    return(errorstatus);
 }


 //-------------------checke timeout--------------------//
 static SD_Error CmdError(void)
 {
   SD_Error errorstatus = SD_OK;
   uint32_t timeout;

   timeout = SDIO_CMD0TIMEOUT; /* 10000 */

   while ((timeout > 0) && (SDIO_GetFlagStatus(SDIO_FLAG_CMDSENT) == RESET))
 {
   timeout--;
 }

 if (timeout == 0)
 {
    errorstatus = SD_CMD_RSP_TIMEOUT;
    return(errorstatus);
 }

 /* Clear all the static flags */
 SDIO_ClearFlag(SDIO_STATIC_FLAGS);

 return(errorstatus);
 }
\$\endgroup\$
2
\$\begingroup\$

I had the same problem, I found a possibility in the STM forum, it did not work for me but maybe it will for you. The answer was: "but I added in a few millisecond delays around the SD Init phase, and that seemed to fix the problem".

Later I fixed my problem, the HSEON flag in the RCC register was not set and because of that the PLL clock could not start. Without the PLL the SDIO does not have a clock and therefore cannot run. I have posted all my steps in the STM32 forum.

\$\endgroup\$
  • \$\begingroup\$ Hey, I fixed my problem, the thing was, that HSEON flag in RCC register was not set and because of that PLL clock could not start. Without PLL the SDIO does not have a clock and there for can not run. :) Hope it helps :) There is a discussion in STM32 forume, where I posted all my steps :) Here is the link goo.gl/xfNZfu \$\endgroup\$ – MattJ Aug 13 '15 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.