2025-11-19 6:38 AM
Hi,
I'm attempting to write to an SD Card using a Riverdi STM32U5A9 display board. Since TouchGFX natively uses FreeRTOS, I'm attempting to keep it within FreeRTOS. Porting to ThreadX has caused it's own issues which I have in a separate thread. In the Configurator, there is no longer an option for FATFS, so I'm using the STM32U5 Classic MW Git Repository as recommended by the FAE. I copy over and update the templates as required, but am still getting a Hard Fault during f_mkfs while the HAL library is initializing the SDMMC. I believe that my configuration is incorrect, but the example is only for SDRAM, so I'm not entirely sure where I've gone wrong... I have it setup for 4-bit width and I've changed the clocks to be 24MHz at the SDMMC clock output. The examples within the configuration are for older MCUs and have a tab to enable the DMA. My understanding is that the STM32U5 has an Internal DMA, so it's not required to setup the DMA within the configuration.
Any help is appreciated!
Thank you!
Solved! Go to Solution.
2025-11-19 1:00 PM
Update:
Got it working entirely thanks to this post:
Enabling the Hardware Flow Control, setting the clock to 8MHz, and keeping it at 4bit width is working.
2025-11-19 10:07 AM
Update:
I've managed to get beyond this issue. It turned out that CubeMX was not adding the SDMMC_Init to the main. After adding, I no longer hard fault. I now get FR_DISK_ERR at disk_write in ff.c during f_mkfs. Still leads me to believe that there is an issue with the configuration. I've lowered the SDMMC clock down to 12MHz, but that's not fixing the issue.
2025-11-19 1:00 PM
Update:
Got it working entirely thanks to this post:
Enabling the Hardware Flow Control, setting the clock to 8MHz, and keeping it at 4bit width is working.