2021-06-15 09:33 AM
Why isn't the SDMMC code tolerant to interrupts?
2021-06-15 10:23 AM
> Why isn't the SDMMC code tolerant to interrupts?
Because the hardware needs to be fed data (or have data read) with strict timing requirements to avoid overrun/underrun of the hardware buffer.
Disable interrupts during access or use DMA based accessing to avoid.
2021-06-15 10:35 AM
The FIFO adds some tolerance, but you can't go wandering off in the middle of the data transfer phase, the cards just don't have a mid-transfer abort protocol..
Figure you're interrupt routines are very tardy, or you're task switching to some completely alternate universe.
Use DMA, polled is very fragile, as I think I've expressed here multiple times.
2021-06-15 10:39 AM
Hi TDK,
Thanks for the quick reply. I have disabled interrupts during the read access which, as you said, solved the problem. However it raised a new problem. If the interrupts are disabled then the timeout, which uses the systick interrupt, no longer works :( I have not used DMA so far but I'm willing to try it. Do you have any examples showing how to use DMA with the SDMMC?
Thanks...
2021-06-15 10:44 AM
There should be example diskio drivers in the FatFs Middleware directories.
H7 going to want to be conscious of the memory being utilized, the alignment and cache coherency.
2021-06-15 02:28 PM
Hi Tesla,
I have searched all of the FatFs directories (including Middleware) for an example using DMA but I cannot find a single one :(
2021-06-17 05:19 AM
Hi Bert,
i was searching also (about 4 minutes) and see: sd_diskio_dma.c
(in STM32CubeH7-master\Projects\STM32H747I-EVAL\Applications\FatFs\FatFs_Dual_Instance\CM7\Src ) .
Maybe this is what you want.
2021-06-17 06:53 AM
Hi AScha.3,
Thanks for the reply :)
The example you mentioned is for a dual-core STM32H7 device but it may work for my needs. I'll give it a try as time permits.