cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F439 SDMMC Command Timeout

YHass.14
Senior

Hello all,

I access SDMMC directly through the APIs: HAL_MMC_WriteBlocks() and HAL_MMC_ReadBlocks().

Sometimes the access to SDMMC does not does not succeed with Timeout error.

Can you please advise me?

Thanks in advance.

Yacob.

3 REPLIES 3
TDK
Guru

One possibility out of many is that noise on the signal lines is causing the message to be discarded. Slow your clock down and try again.

If you feel a post has answered your question, please click "Accept as Solution".
YHass.14
Senior

I added more disable interrupts, especially in SDMMC_CmdWriteSingleBlock and SDMMC_CmdReadSingleBlock and it seems it solved the problem.

I changed the above functions as the following:

  __set_PRIMASK(1); // disable interrupts (I added)
  
  SDIO_SendCommand(SDIOx, &sdmmc_cmdinit);
  
  /* Check for error conditions */
  errorstate = SDMMC_GetCmdResp1(SDIOx, SDMMC_CMD_READ_SINGLE_BLOCK, SDIO_CMDTIMEOUT);
 
 __set_PRIMASK(0); // enable interrupts (I added)

Thanks anyway.

Yacob.

YHass.14
Senior

Hello all,

Unfortunately the disable interrupts does not help always.

Sometimes the SDMMC stuck and I receive timeout error.

I use FreeRTOS and access to SDMMC from number of tasks.

The access to SDMMC is protected by semaphore.

Can any one advise?

Yacob.