stm32h7xx_hal_driver icon indicating copy to clipboard operation
stm32h7xx_hal_driver copied to clipboard

SDMMC stuck with HAL_SD_ERROR_DATA_TIMEOUT

Open daniel-starke opened this issue 2 years ago • 0 comments

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

  1. Provoke a HAL_SD_ERROR_DATA_TIMEOUT error.

  2. Correct the hardware setup online (i.e. by adding pull-ups without a system reset).

  3. Use HAL_SD_Abort(), HAL_SD_DeInit() and HAL_SD_Init() to re-initialize the device.

  4. 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.

daniel-starke avatar Oct 04 '22 18:10 daniel-starke