2021-03-15 05:56 AM
I am running into a problem with the SD card driver on the STM32L476. The DATATIMEOUT flag is occasionally set when trying to do a single block read using the DMA. I have set a breakpoint at the DATATIMEOUT flag in the SD IRQ handler. When the break point triggers, the DTIMER register is still at the maximum value (0xffffffff) so I don't believe this is a genuine data timeout. I think the DTIMEOUT flag is getting set in error. I have attached a screen shot of the registers at the point when the breakpoint triggers.
My code is based in the example in the Cube library (sd_diskio_dma_rtos.c). I am using the latest HAL library with FatFS and FreeRTOS. I am using DMA 2 channel 5 for both TX and RX.
Can anyone help me on this? Is this a known issue about the DTIMEOUT flag? What could be causing it to get set?
Would it make sense to check DTIMER for zero when this flag is set to check if it's a genuine error?