2018-09-10 05:02 AM
currently I'm implementing a sdio device in mbed-os for STM32F4. This is using the HAL and I had problems with setting the timeout for Read/Write Blocks.
This line looks bad for me:
The function is returning an error if timeout=0 is passed as argument. Reading or writing the blocks has no chance to succeed, if timeout is = it will fail. Usually, a timeout=0 means infinit waiting and the function should look like if ((timeout != 0) && (...)).
Is this right?
2018-09-10 05:56 AM
Yes, this doesn't look like the intent they wanted
ST on occasions uses 0xFFFFFFFF (49.5 days), or 30 seconds for SDIO
Honestly something like a second should be sufficient for SDIO were interactions should be taking less than 100ms
2018-09-10 07:06 AM
Thanks for your very fast reply.
You are right, the timeout value should be something greater than 0, but a 0 should not return an error after a successfull read or write.
The timeout should also depend on the amount of data, 1 MB takes much more time than 1 kB to write. The HAL function uses the timeout value for the whole operation, so the user application should calculate a size dependent limit.
2018-09-10 07:39 AM
Arguably, the command/response time is very large compared to the data phase, and it's always fetching much large blocks from the array, don't expect time to be linear. The timeout loop is so you don't dwell there forever, but given the lack of downstream recovery/retry, somewhat moot.
2019-02-19 11:52 PM
Hey @JojoS ,
Just wanted to ask about this. Did you have the same issue with the timeout where the sdcard driver just seems to be stuck in there forever?
I had constant successful reads and writes, but every once in a while, the sdcard driver will get stuck in what seems to be an infinite loop in the timeout when doing tasks like creating a file, reading,writing, etc.
2024-03-06 12:30 AM
Hi @JojoS,
Facing the same issue as @con3
Our SD card read write works well for like minutes, but then it gets stuck and remains there till the MBED_CONF_SD_TIMEOUT value.
Do you have any solution to this issue? We are observing that the SDIO DMA transfer is still ongoing, even though we see a STOP TRANMISSION CMD12 on the logic analyzer
2024-03-15 06:43 AM
Hi, On observing the CLK & CMD lines of the SD card connected via the SDMMC interface to our STM32U5 board, could confirm that the commands were triggered at the falling edge of the clock.
But on the SDMMC interface init settings, the setting for the sdmmc clock edge was Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING; so here was the error.
On chaning the clock edge to SDMMC_CLOCK_EDGE_FALLING, all our previous errors related to write halts and timeout errors vanished! We are running at 4 MHz on the SDMMC interface..