Skip to main content
Associate
February 26, 2026
Question

SDIO initialization fails on STM32F439 for SD card interfacing

  • February 26, 2026
  • 2 replies
  • 250 views

I am working with [STM32F439ZI] and I am trying to initialize SDIO in 4-bit mode.

I'm following "STM32 – Creating a File System on a SD card" this video for reference.

However, SDIO initialization is failing during the power-on phase.

  • The error occurs during HAL_SD_Init()

  • The failure happens inside the power-on initialization sequence

  • The function always returns an error status

  • The board is currently tested using the DATA3 line only (this is the only difference from a standard setup)

  • Even when I modify the function / test return values, the error still occurs at power-on initialization

  • I changed the function for card detect so that the return status is always "card present".

    The error occurs in

    errorstate = SDMMC_CmdAppCommand(hsd->Instance, 0);

    if(errorstate != HAL_SD_ERROR_NONE)

    {

    return HAL_SD_ERROR_UNSUPPORTED_FEATURE;

    }

    }

    This function returns a CRC error.

    I have attached the hardware changes I did along with the clock config settings and sdio settings. Please help me resolve it.

2 replies

mƎALLEm
Technical Moderator
March 2, 2026

Hello,

What do you mean by?!:


@Ekeshwari wrote:
  • The board is currently tested using the DATA3 line only


How do you expect that it will work normally with only DATA3 line in 4-bit mode?

"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."
EkeshwariAuthor
Associate
March 2, 2026

Data 3 line is used to detect the card first. Then after the card is initialized it goes back to being the data line. But that is not the issue my card initialization itself fails (even in 1 bit mode), even when I use a GPIO as card detect pin. HAL_SD_Init()  this returns an error