cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with read and write SD Card through SPI /(freertos+fatfs)

Dushyantsingh
Associate II

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

Dushyantsingh_0-1710452766231.png

 

 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?

2 REPLIES 2
Saket_Om
ST Employee

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. 

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar

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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..