Skip to main content
load2005
Associate III
April 4, 2025
Question

CubeMX+SD card 4 bit+STM32F796 DISCO SD_FindSCR problem

  • April 4, 2025
  • 3 replies
  • 481 views

HI All,

I am using STM32F769 DISCO board.
I have configured SD card in 1 bit moe and it works fine.
But it doesn't work in 4 bit mode.
The problem is in SD_FindSCR function.

if(__HAL_SD_GET_FLAG(hsd, SDMMC_FLAG_RXDAVL))

is never executed.
Cube MX version is 6.8.1

I see there are many similar post's on the forum but
none of the solution worked.
I have set the clock to 12Mhz and I see that
HAL initialize sd card with 1 bit line then trying to read SCR
register to check if 4 bit data line is supported.
And can't read SCR register.
Maybe there are fixes to this HAL library?
Thanks,

3 replies

STTwo-32
Technical Moderator
April 4, 2025

Hello @load2005 

Could you please try using the STM32CubeMX V6.14.0 and the STM32CubeF7 V1.17.2.

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
load2005
load2005Author
Associate III
April 5, 2025

Hello,

 

I have updates to CubeMx V6.14 and checked that I am using F7 V1.17.2.

The problem is still the same.

This part is hit when reading SCR register

 

else if(!__HAL_SD_GET_FLAG(hsd, SDMMC_FLAG_RXACT))
{
break;
}

 

Can you confirm the problem with your setup please?

Visitor II
April 28, 2025

Same issue with STM32F746NGHx, FW V1.17.2.

A logic analyzer shows that the SD card is responding, but the SDMMC_FLAG_RXDAVL flag is never set. Adding some delay in between doesn't change the situation.

load2005
load2005Author
Associate III
May 8, 2025

Hi ALL

I have fixed the issue.

The problem was that SD was initialized in 4 bit mode but before checking 4bit mode availability

it must be initialized in 1 bit mode.

I had to dig through a code mess to find the problem.