cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE : SDMMC Mode unable to set SD 4-Bit Mode (Bug Report ?)

Karan 123
Senior

Hi,

I am working on STMCubeIDE 1.3.0 with STM32722VE LQFP-100 Package .

SD 1-Bit mode is working Fine for me .

When I am trying to set SD 4-bit the code always generate SD 1-Bit mode .

Is there any Bug ?

hsd2.Init.BusWide = SDMMC_BUS_WIDE_1B;

0693W000001sz3XQAQ.png

Also , By changing to SDMMC_BUS_WIDE_4B with DMA SDMMC_TX, SDMMC_RX and

SDMMC Interrupt .

SDMMC Card is not working .

--

Karan

7 REPLIES 7
TDK
Guru

It is initialized in stages. First it's initialized as 1bit, then it switches to 4bit.

0693W000001t1ZBQAY.png

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

Agreed, usually it is brought up in one mode and then switched if successful.

ST has been a bit inconsistent about how they do this across lines and HAL releases, some have similar code in HAL_SD_Init() whilst other pop it out a level in the BSP side initialization code.

If 1-bit mode doesn't work 4-bit surely won't. And 4-bit mode is a lot less tolerant of wiring, loading/drive and skewing issues. Real easy to get it to not work.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Karan 123
Senior

Hi,

Thanks... Both of you...

1-bit is working as my end . I am using SDMMC2 .

But HAL_SD_ConfigWideBusOperation() is not generated at my setup as per below setting..

0693W000001t3COQAY.png0693W000001t3CsQAI.png0693W000001t3BkQAI.png0693W000001t3BLQAY.png

Any thing I am missing..

--

Karan

TDK
Guru

> Any thing I am missing..

I don't see anything wrong in your setup.

I generated a project and initialized SD as 4-bit and pasted the screenshot of what it generated. I don't see why it would behave any differently for you.

You can always edit the CubeMX generated code.

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

Ok..

Are you using STM32CubeIDE ​1.3.0.

Please share your generated .c file from your setup.

--

Karan​

Hi,

Thanks​

I have succeeded to work with

SD ​4-Bit Mode by manually adding in CubeMX generated Code. Able to Create txt file.

How to be sure that 4-bit Mode Configure and Worked properly..?

--

Karan​

TDK
Guru

> How to be sure that 4-bit Mode Configure and Worked properly..?

I would examine the traces on a scope, or time a particularly long transaction and ensure it completes faster than would be possible in 1-bit mode.

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