2020-09-22 03:41 AM
So I'm back to getting the FATFS-SDMMC-FreeRTOS combo working on my board. I've got a simple project working without FreeRTOS and it uses the HAL_SD in polled mode. Stepping through my FreeRTOS project I see that this project calls HAL_SD_ReadBlocks_DMA() which fails. This doesn't surprise me as I haven't set up DMA and I can't see that CubeMX does either!
My questions are:
Solved! Go to Solution.
2020-10-21 05:56 AM
The data transfer is intolerant to you wandering off mid task. DMA allows it to meet the hard clock deadlines.
2020-10-21 05:39 AM
Back to the top
2020-10-21 05:56 AM
The data transfer is intolerant to you wandering off mid task. DMA allows it to meet the hard clock deadlines.
2020-10-21 06:29 AM
OK, DMA it is. CubeMX offers three DMA requests in the 'Select' drop down, so which do I want?
2020-10-21 07:00 AM
Not a CubeMX guy, the RM should provide details of the DMA plumbing options. The SDMMC/SDIO is half-duplex, so it is either reading or writing, it doesn't do both concurrently. Took ST a couple of part generations to determine this. Often 2x choices for RX/TX, choice usually depends on utilization by other peripheral sharing a stream/channel (limited mapping options). On the H7 DMA is done by the SDMMC1 peripheral itself.
2020-10-22 05:58 AM
The STM32F7 reference manual is pretty helpful (section 39.3) but it's not completely clear how it relates to all the CubeMX settings. The good news is that the defaults for SDMMC DMA seem to work!
2020-10-29 04:54 AM
This is going backwards at a fair rate of knots! The settings I shared previously only worked for reads, not writes. I tried setting up two DMA streams, one for read and one for write, which seemed to help for a while. Now nothing works and I can't seem to get back to anything working.
Come on ST, provide some documentation!
2020-11-04 08:29 AM
Just for anyone following this thread, I'd opened a new thread at https://community.st.com/s/question/0D53W00000MgE7qSAF/stm32f767-sdmmc-dma-read-missing-first-16-bytes. Once the DMA cache coherency problem was addressed the SDMMC FATFS sprang into life. It's disappointing that the ST Cube example projects aren't 'real world robust' and will fail in unexpected ways.