2025-03-12 2:57 PM
Hi all
I'm struggling for a while getting a µSD Card to run via SDMMC on FileX. I'm using a Nucleo U575 Board with an external SDMMC/SDIO-breakout board. I tried to follow the "Fx_uSD_File_Edit" example for the U575I-EV board.
Long story short, I set up a FileX application thread on ThreadX and I'm trying to just open the media.
In main.c there's the automatically generated MX_SDMMC1_SD_Init() initializing the the SDMMC1 interface just after GPIOs and ICACHE were initialized. In main.c everything runs through without any error.
However, when entering the FileX application, the very first function getting called is MX_SDMMC1_SD_Init() again - as I configured FileX to initialize the SD IP (just as seen in the Fx_uSD_File_Edit-example). This time it ends in a HardFault in the Init. The one thing that I really don't understand is that it happens just on the call of
sdmmc_clk = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_SDMMC);
in stm32u5xx_hal_sd.c
I enabled a breakpoint on the very first line of HAL_RCCEx_GetPeriphCLKFreq. The first time (called from inside main.c) it runs through flawlessly as stated above. But on the second call (from fx_stm32_sd_driver_glue.c) it doesn't even stop at the breakpoint but just going to a HardFault.
Can anyone explain this problem or try to give me a hint on how to fix this issue?
Best
M