cancel
Showing results for 
Search instead for 
Did you mean: 

Problem Interfacing SD Card with STM32H753ZIT6

Ematic
Associate II

Hi, 

I'm facing issues while trying to interface a 32GB SD card with the STM32H753ZIT6 development board using SDMMC1 and FatFS. Below are the key problems observed:

  1. SD Initialization Fails:
    HAL_SD_Init() consistently returns HAL_ERROR (Status: 1).

  2. Card Not Ready:
    The card state remains 0, indicating that it is not ready or not properly initialized.

  3. Incorrect Card Capacity Reported:
    Despite using a 32GB SD card, the detected capacity is only about 1.8GB (1806848 KB).

This suggests the card isn't being properly initialized or detected, and capacity detection is failing. Looking for help identifying the root cause—whether it's clock config, pin setup, timing issues, or something else.

I have attached the code and output file.

Pin connection between SD card to STM32:

-------------------------------------------------------------

DAT0    ->   PC8

DAT1    ->   PC9

DAT2    ->   PC10

DAT2    ->   PC11

CLK      ->   PC12

CMD     ->   PD2

VCC     ->   3.3V

GND     ->  GND

 

3 REPLIES 3
KDJEM.1
ST Employee

Hello @Ematic;

 

Did you get the same issue when working in 1 bit bus wide mode?

Could you try to use the latest STM32CubeMX version to generate your code.

I recommend you to look at How to create a file system on a SD card using STM32CubeIDE - STMicroelectronics Community

 

Thank you.

Kaouthar

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.

Andrew Neil
Super User

@Ematic wrote:

the STM32H753ZIT6 development board


Which board, exactly?  NUCLEO-H753ZI ?

 

Have you checked that there's nothing else on the board using the pins you've chosen?

 


@Ematic wrote:
  1. SD Initialization Fails:
    HAL_SD_Init() consistently returns HAL_ERROR (Status: 1).


So have you stepped into that function to find where and why it fails?

 


@Ematic wrote:

3. Incorrect Card Capacity Reported:


If the initialisation has failed, then that's not surprising

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.