Is there a fix on using FREERTOS + FATFS + SDIO + DMA?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-10 2:11 PM
I am creating a project for the STM32F767ZI. The Fatfs library WITHOUT freeRTOS works well. When I include freeRTOS in my project, I cannot get past mounting the disk:
retSD = f_mount(&SDFatFS, (TCHAR const*) SDPath, 1);
From reading the forums, I found that some people have found a solution for certain MCUs. Is there a configuration where I can use FREERTOS + FATFS + SDIO + DMA?
My cubemx settings are as follows: I am using SDIO 1 bit bus and DMA for RX and TX. I have set my stack size to 0x2000, my heap size to 0x4000. I'm using FatFS with the DMA template.
- Labels:
-
DMA
-
FatFS
-
FreeRTOS
-
SDIO-SDMMC
-
STM32CubeMX
-
STM32F7 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-10 2:17 PM
Try keeping ALL the SDIO/FATFS stuff in a singular thread, and use DTCMRAM for all SDIO/SDMMC work. Put checks in DISKIO to confirm both memory usage AND alignment.
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
‎2019-10-10 2:30 PM
I am using it in a single thread. In fact, I'm calling the mount command in the "default task", so I'm already single threaded.
Is setting the SDIO to use DTCRAM an option in cubeMX?
Can you point to any resources for putting checks in DiskIO that check memory usage and alignment? On my cube IDE I see that my current project uses only 20% of the ram resources.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-11 10:52 AM
I have solved this issue and it comes down to choosing the correct cubeMX settings. Here are the settings that work on the STM32F767ZI:
SDMMC
- SDIO 1 bit
- Hardware flow control turned ON
- enable NVIC for all 3 items in the table (it should read DMA2 chan 0, DMA2 chan5, SDMMC)
- Add SDMMC_TX, SDMMC_RX in the DMA menu
- Ensure DO and CMD pins in the GPIO have a pullup resistor
FreeRTOS
- Enabled
- Disable premption
- under tasks and queues make the default task stack size 512 words
FatFS
- Enable LFN
- under platform settings choose a GPIO input pin to serve as the SD detect pin. Create one if the menu is empty.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-11 3:56 PM
Whoa! Any idea why you need to disable preemption??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-14 4:27 PM
I'm assuming that the FatFs library is not actually reentrant.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-10-16 3:52 PM
@shabbir.hussain​ - It doesn't need to be, unless you are using it in multiple tasks, or FatFS uses non-reentrant components (which it should not do), right ??
