2019-10-10 02: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.
2019-10-10 02: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.
2019-10-10 02: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.
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
FreeRTOS
FatFS
2019-10-11 03:56 PM
Whoa! Any idea why you need to disable preemption??
2019-10-14 04:27 PM
I'm assuming that the FatFs library is not actually reentrant.
2019-10-16 03: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 ??