cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H757I-EVAL: SDMMC Initialization problem

pepsi_zero_sugar
Associate II

I'm using STM32H757I-EVAL and trying to implement SDMMC.
However,  I get some errors in these parts of code.

At first, the error happened SDMMC_cmdAppCommnad.
But now I can see the error SDMMC_CmdGoIdleState

I did change frequnecy of sdmmc, enable hardware control, enable USE_SD_TRANSCEIVER. These were not working.

I used these versions and generated code.

STM32CubeIDE Version: 1.16.0
STM32CubeMX Version: 6.12 
STM32CubeH7 Firmware Package V1.11.0 / 04-Nov-2022

1.png2.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Imen.D
ST Employee

Hello @pepsi_zero_sugar ,

Ensure that the SDMMC clock is configured correctly:

For a peripheral clock of 200MHz, the default speed frequency (25MHz max) should use a clock divider of 0x4, and the high-speed frequency (50MHz max) should use a clock divider of 0x2.

/* SDMMC Default Speed Frequency (25Mhz max) for Peripheral CLK 200MHz*/
#define SDMMC_NSpeed_CLK_DIV ((uint8_t)0x4)
/* SDMMC High Speed Frequency (50Mhz max) for Peripheral CLK 200MHz*/
#define SDMMC_HSpeed_CLK_DIV ((uint8_t)0x2)

So, please use the value 0x4 or 0x2 :

 

hsd1.Init.ClockDiv = 0x4; // or 0x2 for high-speed

 

Refer to this AN5200 "Getting started with STM32H7 Series SDMMC host controller," which contains examples projects might help with the SDMMC configuration.

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

View solution in original post

1 REPLY 1
Imen.D
ST Employee

Hello @pepsi_zero_sugar ,

Ensure that the SDMMC clock is configured correctly:

For a peripheral clock of 200MHz, the default speed frequency (25MHz max) should use a clock divider of 0x4, and the high-speed frequency (50MHz max) should use a clock divider of 0x2.

/* SDMMC Default Speed Frequency (25Mhz max) for Peripheral CLK 200MHz*/
#define SDMMC_NSpeed_CLK_DIV ((uint8_t)0x4)
/* SDMMC High Speed Frequency (50Mhz max) for Peripheral CLK 200MHz*/
#define SDMMC_HSpeed_CLK_DIV ((uint8_t)0x2)

So, please use the value 0x4 or 0x2 :

 

hsd1.Init.ClockDiv = 0x4; // or 0x2 for high-speed

 

Refer to this AN5200 "Getting started with STM32H7 Series SDMMC host controller," which contains examples projects might help with the SDMMC configuration.

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