2024-03-14 02:50 PM
I'm facing an issue with reading and writing data on an SD card using SPI and FATFS on an STM32F767ZIT6 microcontroller. When I don't enable FreeRTOS, the SD card operations work fine. However, when I enable FreeRTOS, the SD card operations fail. During code generation, I receive a suggestion
I've referred to the following guide for implementing SD card read and write: https://www.micropeta.com/video29
Can anyone provide guidance on resolving this issue?
2024-04-18 09:06 AM
Hello @Dushyantsingh
You can refer to the examples provided in STM32Cube firmware H7 located at the following path: Projects\STM32F769I_EVAL\Applications\FatFs\FatFs_uSD_RTOS
.
Also, it is recommended to use DMA process when using FreeRTOS with SD card.
2024-04-18 09:18 AM
I'd opt for a different socket, WaveShare has several suitable for 3V STM32 operation, and has pull-ups on the correct pins. And supportive of SDIO/SDMMC peripheral usage.
SD Cards have zero tolerance for you wandering off-task mid way through data interactions.
Best to use DMA. For F7 use DTCM RAM for DMA buffering with SDMMC, avoids a lot of coherency issues.
Multiple threads can't use SDIO/SDMMC/SPI and FATFS concurrently. It's a resource that must be serialized / mutex'd