STM32H750 SDMMC & IDMA issue
I have code running on an STM32H750 which uses the HAL drivers to stream audio from a microSD (SDMMC + IDMA) to a DAC (SAI + DMA). I’m doing mostly mostly 16-sector reads, at a rate of about 300 reads per second (28 16-sector reads every 93 ms). The card handles this easily with a 50MHz bus speed. I’m using sine-wave audio data and monitoring the output with a spectrum analyzer so that any issues show up easily.
All reads are using AXI memory, and I have an MPU region enabled properly for this memory and am doing cache management, as I have done successfully with other STM32 processors. Everything works great with one exception.
My issue is that about once every hour or two (or more), the HAL_SD_ReadBlocks_DMA() function times out. By “times out�?, I mean that the read multi-block command is sent and a correct response is received, but the subsequent interrupt never occurs, and the code waiting for the read completion (by checking a flag cleared in the SD interrupt), times out.
The HAL function calls SDMMC_CmdReadMultiBlock() which in turn calls SDMMC_SendCommand() followed by SDMMC_GetCmdResp1(); I’ve instrumented the code to preserve the value of the SDMMC Status register on the occasions when the command times out, and there’s nothing unusual to be seen.
Most interesting, I’ve discovered if I insert even a small delay between the SDMMC_SendCommand() and the SDMMC_GetCmdResp1() functions, I can get the command to time out in exactly the same manner almost immediately. The call to SDMMC_GetCmdResp1() normally immediately follows the call to SDMMC_SendCommand(), so if a delay between them causes this condition, then I would imagine that if another interrupt were to happen right at this point, this could be an issue. I tried disabling the SAI DMA interrupts around these calls, but it didn’t seem to help.
I’ve read through the errata, and don’t see anything that applies here. It seems odd that a small delay between sending a command and checking the response would cause a problem.
Wondering if anyone here has insights.
