FATFS on SD card with FreeRTOS, does it insist on using DMA?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-22 3: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:
- Do I have to use DMA with FATFS-SD card and FreeRTOS? If not, where do I change it to polled mode?
- If I do need to use DMA, how do I set it up? CubeMX offers options I don't understand, so is there a crib somewhere?
Solved! Go to Solution.
- Labels:
-
FatFS
-
FreeRTOS
-
SDIO-SDMMC
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-10-21 5:56 AM
The data transfer is intolerant to you wandering off mid task. DMA allows it to meet the hard clock deadlines.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-10-21 5:39 AM
Back to the top
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-10-21 5:56 AM
The data transfer is intolerant to you wandering off mid task. DMA allows it to meet the hard clock deadlines.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-10-21 6:29 AM
OK, DMA it is. CubeMX offers three DMA requests in the 'Select' drop down, so which do I want?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-10-21 7: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.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-10-22 5: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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-10-29 4: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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-11-04 8: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.
