stm32h7xx_hal_driver
stm32h7xx_hal_driver copied to clipboard
SDMMC stuck with HAL_SD_ERROR_DATA_TIMEOUT
Describe the set-up
SD card socket connected without external pull-ups (only internal ones) to a NUCLEO-H723ZG board. This made the data lines instable. Adding an external logic analyzer for example brought the lines to a working level. Switching from the non-working variant after HAL_SD_ERROR_DATA_TIMEOUT
online to the a working variant failed while being stuck with HAL_SD_ERROR_DATA_TIMEOUT
.
Describe the bug
I have observed cases like above where HAL_SD_ERROR_DATA_TIMEOUT
was set via SDMMC_FLAG_DTIMEOUT
and HAL_SD_Abort()
+ HAL_SD_Init()
could not recover from this.
How To Reproduce
-
Provoke a
HAL_SD_ERROR_DATA_TIMEOUT
error. -
Correct the hardware setup online (i.e. by adding pull-ups without a system reset).
-
Use
HAL_SD_Abort()
,HAL_SD_DeInit()
andHAL_SD_Init()
to re-initialize the device. -
Initialization fails and the error remains.
Additional context
I suggest to call SDMMC_CmdStopTransfer()
unconditionally within HAL_SD_Abort()
to allow proper error recovery. This issue may be also present in other STM32 series HAL like STM32F7.