Closed daniel-starke closed 5 months ago
Hello @daniel-starke,
Sorry for the very late response, I hope you are well. I want to know if you still got this problem even after the update of the firmware during this time.
With regards.
I do not have the test setup anymore so it is hard for me to try out at the point. Would you like me to do a code review instead?
Hello @daniel-starke,
Since you do not have the setup anymore, I would like to share some information related to the issue.
Usually, it's recommended to use external Pull up to get a better and stable operation, already other board equipped by SD Card contain Pull ups on the lines.
I shared your proposal with our development team, they don't accept it because we use HAL_SD_Abort()
only when something is ongoing, and the state is busy. So, the call of SDMMC_CmdStopTransfer() must be conditionally within HAL_SD_Abort().
Finally, please allow me to close this issue, thank you for your comprehension.
With regards.
Hello @KRASTM,
The issue is that in case of a HAL_SD_ERROR_DATA_TIMEOUT
error (the missing pull-up was just an easy example on how to reproduce it) the HAL layer goes out of sync with the PHY. HAL falsely assumes that the PHY has finished. As is has not and HAL performs no appropriate reset the PHY remains in the error state until system reset. Feel free to use another mechanism to recover from that state. Calling SDMMC_CmdStopTransfer()
unconditionally within HAL_SD_Abort()
was an easy workaround which worked for me.
Hello @daniel-starke,
Thank you for the explanation and the report, at least we have a trace on the topic. I will share this with our team in order to enhance or to find a solution for that case (maybe your workaround in another way).
With regards.
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 withHAL_SD_ERROR_DATA_TIMEOUT
.Describe the bug I have observed cases like above where
HAL_SD_ERROR_DATA_TIMEOUT
was set viaSDMMC_FLAG_DTIMEOUT
andHAL_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 withinHAL_SD_Abort()
to allow proper error recovery. This issue may be also present in other STM32 series HAL like STM32F7.