Skip to main content
gorgabab
Associate II
April 24, 2025
Solved

CubeMX wrong generation of HAL_SD_MspInit for SDMMC2 STM32U5G9ZJT6Q

  • April 24, 2025
  • 2 replies
  • 493 views

Hello,

I stumbled upon a cubemx generation issue for sdmmc2 for the stm32u5g9zjt6q (I didn't have this issue with some other stm32u5xx).

For a basic cubemx configuration of sdmmc2, the HAL_SD_MspInit is wrongly generated. It is a bit annoying as I have to manually edit the file for each code generation or create my own overload function (not a huge effort I concede).

In the Src/stm32u5xx_hal_msp.c, void HAL_SD_MspInit(SD_HandleTypeDef* hsd) calls

__HAL_RCC_SDMMC1_CLK_ENABLE();

instead of

__HAL_RCC_SDMMC2_CLK_ENABLE();

Same for void HAL_SD_MspDeInit(SD_HandleTypeDef* hsd) with the __HAL_RCC_SDMMC1_CLK_DISABLE()

I might be the only one to experience it but I put it here just in case.

 

2 replies

gorgabab
gorgababAuthor
Associate II
April 24, 2025

I forgot to mention that I use:

 - STM32CUBEIDE 1.17.0

 - STM32CUBEMX 6.13.0

TDK
TDKAnswer
Super User
April 24, 2025
"If you feel a post has answered your question, please click ""Accept as Solution""."