Skip to main content
Karan 123
Senior
July 16, 2020
Question

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

  • July 16, 2020
  • 7 replies
  • 3038 views

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

This topic has been closed for replies.

7 replies

TDK
July 16, 2020

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""."
Tesla DeLorean
Guru
July 16, 2020

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
Karan 123
Karan 123Author
Senior
July 16, 2020

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
July 16, 2020

> 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""."
Karan 123
Karan 123Author
Senior
July 16, 2020

Ok..

​

Are you using STM32CubeIDE ​1.3.0.

​

Please share your generated .c file from your setup.

​

--

Karan​

​

Karan 123
Karan 123Author
Senior
July 17, 2020

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
July 17, 2020

> 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""."