cancel
Showing results for 
Search instead for 
Did you mean: 

H7A3 SDMMC 2 not working, system stall at MX_SDMMC2_SD_Init().

AScha.3
Chief

Hello, when testing the SDcard on SDIO 1-bit interface , we see a big problem here:

when card in slot, cpu stall in MX_SDMMC2_SD_Init() , on debug can see: card info sector count, block size etc. read seem ok, but then waiting for response -- forever. (timeout -1)

SDclk set to 200/(4*2) MHz, 1-bit mode; tried different things: cache on/off, clk faster/slow, extra cap close to card holder, different cards, core volt.scale 0/1; now i am out of ideas, why it is not working. looked also H7A3 errata, but there i see no problem with SD .

Stall/wait is here, in init :

 while (!__HAL_SD_GET_FLAG(hsd, SDMMC_FLAG_RXOVERR | SDMMC_FLAG_DCRCFAIL | SDMMC_FLAG_DTIMEOUT | SDMMC_FLAG_DATAEND))

so: what is wrong? do i something wrong? or is something missing?

If you feel a post has answered your question, please click "Accept as Solution".
1 ACCEPTED SOLUTION

Accepted Solutions
AScha.3
Chief

Thx for your response.

AN5200 was on my list...and i use STM32CubeIDE, Version: 1.6.1, cube  6.2.1-RC2 ;

with update to actual version and after "right" setting of pins got it working now.

Read-speed about 3,4 MB/s , 1bit mode;

setting: 200Mhz clk, div 2 (gives clk/4 -> 50MHz SDHC standard; pins CMD+D0 : pullup, speed medium ("FAST" on H7A3 ).

With same setting also running on STM32H753 now.

and on my small STM32F411 board, 100MHz clk, div 0 (!) , 4 bit mode, all pins: pullup and high speed, get about 8MB/s read from microSD. =)

(speed is effective speed, including f_read() and without DMA , tested with 10KB block reading)

just what STM could do better: when using cube -> in RCC LSE clock initial setting : LSE drive -> high drive cap. This would save a lot of people wondering, why cpu not always start or stall .

and here, for SDMMC , setting for pins : pullups and medium/fast speed setting.

regards

Alfred

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

3 REPLIES 3
Imen.D
ST Employee

Hello @AScha.3​ and welcome to the STM32 Community,

I added the adequate topics to your question in order to increase its chance to be reviewed by our experts.

Which CubeMX and CubeH7 package version are you using ?

If possible to share your ioc file or the source code to check more this behavior.

Have a look at this AN5200 "Getting started with STM32H7 Series SDMMC host controller", which contains typical examples and it may help you on the SDMMC configuration.

Imen

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

Thx for your response.

AN5200 was on my list...and i use STM32CubeIDE, Version: 1.6.1, cube  6.2.1-RC2 ;

with update to actual version and after "right" setting of pins got it working now.

Read-speed about 3,4 MB/s , 1bit mode;

setting: 200Mhz clk, div 2 (gives clk/4 -> 50MHz SDHC standard; pins CMD+D0 : pullup, speed medium ("FAST" on H7A3 ).

With same setting also running on STM32H753 now.

and on my small STM32F411 board, 100MHz clk, div 0 (!) , 4 bit mode, all pins: pullup and high speed, get about 8MB/s read from microSD. =)

(speed is effective speed, including f_read() and without DMA , tested with 10KB block reading)

just what STM could do better: when using cube -> in RCC LSE clock initial setting : LSE drive -> high drive cap. This would save a lot of people wondering, why cpu not always start or stall .

and here, for SDMMC , setting for pins : pullups and medium/fast speed setting.

regards

Alfred

If you feel a post has answered your question, please click "Accept as Solution".

Hi @AScha.3​ ,

Really glad to know you overcame this problem 🙂

Thank you for all the details you provided. I will let our teams know about your suggestion.

Thank you once more for your contribution.

Imen

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