AnsweredAssumed Answered

SDMMC STM32f7 - SDMMC_GetCmdResp1() gets stuck

Question asked by Konstantin Sachkov on Apr 14, 2018
Latest reply on Apr 26, 2018 by Konstantin Sachkov

Hey everyone,

My app based on STM32CubeF7 Firmware Package V1.11.0 / 23-February-2018 gets stuck in SDMMC_GetCmdResp1() during directory scan randomly - it can stuck just after switching on or after 2 minutes of working. I can do nothing with sd until I switch off and switch on SD power.

I found a "solution" by adding delay:

uint32_t SDMMC_CmdSendStatus(SDMMC_TypeDef *SDMMCx, uint32_t Argument)
SDMMC_CmdInitTypeDef sdmmc_cmdinit;
uint32_t errorstate = SDMMC_ERROR_NONE;

sdmmc_cmdinit.Argument = (uint32_t)Argument;
sdmmc_cmdinit.CmdIndex = SDMMC_CMD_SEND_STATUS;
sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;

SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);

/* Check for error conditions */

return errorstate;

it works good, without any issues, but very slow.

The second solution is disabling all other FreeRTOS Tasks that use about 50% CPU.


How to make it work in real world?


UPDATE: I found that in some cases before timeout I get SDMMC_ERROR_CMD_CRC_FAIL