SDIO multi block write fails sometimes
Hi.
I have few questions regarding SDIO and SD card write performance.
I am using STM32F446 MCU and a simple application using polling SDIO that writes (appends) 32 blocks (16KB) of data to the SD card every 20ms. I do not use filesystem, just writing RAW bytes. Application increases block address offset for 32 before every call to multi block write.
Problem is, that sometimes multi block write fails - times out. It is rare and does not look to have any pattern - looks random.
It times out in a block data writing loop because SDIO_STA_TXFIFOHE becomes 0 during transfer. So, it may write few blocks and then it is stuck until it times out.
Data transfer timeout in DTIMER is set to 0xFFFFFFFF.
I have few questions if there is anyone with more experience with SD cards:
1. Since I do RAW writes, should writing duration be more or less constant? (around 3MB/s)
2. Why would SDIO HW and/or SD card not be ready to receive new words in FIFO once transfer is already in progress?
3. What would be the best way to handle this kind of failure? Because if I call multi block write again immediately, it also fails and needs more than 50ms timeout before another transfer succeeds?
Thank you very much, any help highly appreciated.
