Closed royb3 closed 1 month ago
Hello @royb3,
Thank you for the report.
I agree that when SDMMC peripheral at 104MHz and switching to MMC high-speed causing the MMC Clock to run at 26MHz.
But I don't know what you mean in the third point: When running the clock slightly below 52MHz, did you mean, rather to work with 104MHz, you choose a clock below 52MHz?
Could you explain or share more details, so we can confirm the issue.
With regards.
Hi @KRASTM
When I set the sdmmc clock at 103.999 MHz, the clockdiv is correctly being set to 1, causing the MMC clock to run at 52MHz. This is the workaround I now use for getting 52MHz HighSpeed / DDR.
ST Internal reference: 184656
@KRASTM Thank, this fix would work for me since I will set the clock to 104, but if I now would set the clock to something between 52 and 104, this would lead now lead to an invalid clock div of 0.
Describe the set-up
Using STM32CubeIDE 1.15.0 with latest board package.
Describe the bug When running the SDMMC peripheral at 104MHz (Required for DDR), and switching the Bus speed to 52MHz DDR. The Clockdiv calculation is off by 1, causing the MMC Clock to run at 26MHz.
How To Reproduce
Indicate the global behavior of your application project
The modules that you suspect to be the cause of the problem (Driver, BSP, MW ...) The stm32h7xx_hal_mmc.c, line 4046: Init.ClockDiv = (sdmmc_clk / (2U * MMC_HIGH_SPEED_FREQ)) + 1U;
The use case that generates the problem When running the clock slightly below 52MHz, the clockdiv is set correctly, but at 52MHz precisely, it is set too high.
How we can reproduce the problem As described above.
Additional context A possible fix could be to add 1 to the divider, so the 52MHz would be rounded down: Init.ClockDiv = (sdmmc_clk / (2U * MMC_HIGH_SPEED_FREQ + 1U)) + 1U; 52MHz will then get rounded down, and the clock div gets correctly set to 1.