Skip to main content
Visitor II
January 26, 2024
Solved

STM32U5 Error HAL_SD_ERROR_CMD_RSP_TIMEOUT after switching SDCard voltage to 1.8V

  • January 26, 2024
  • 1 reply
  • 1566 views

Hello to all,

in our project we are using an STM32U5A5, and we need to be able to drive the sdcards at 1.8V if they are capable of it.

We are using CubeMX to generate the basic code for initialization having configured the SDMMC1 to handle the transceiver.
The part that switches the voltage works, and the callback "HAL_SD_DriveTransceiver_1_8V_Callback" is executed: inside this function we switched the voltage to 1.8V via a PIN.
But the commands to the SDCard following this operation return the error: HAL_SD_ERROR_CMD_RSP_TIMEOUT.

The error comes after executing "SD_PowerON", which completes successfully and performs the voltage change. More precisely it happens in the "SD_InitCard", executing the command: "SDMMC_CmdSendCID". (both function are on the stm32u5xx_hal_sd.c source file)

 

 

static uint32_t SD_InitCard(SD_HandleTypeDef *hsd)
{
 HAL_SD_CardCSDTypeDef CSD;
 uint32_t errorstate;
 uint16_t sd_rca = 0U;
 uint32_t tickstart = HAL_GetTick();

 /* Check the power State */
 if (SDMMC_GetPowerState(hsd->Instance) == 0U)
 {
 /* Power off */
 return HAL_SD_ERROR_REQUEST_NOT_APPLICABLE;
 }

 if (hsd->SdCard.CardType != CARD_SECURED)
 {
 /* Send CMD2 ALL_SEND_CID */
 errorstate = SDMMC_CmdSendCID(hsd->Instance);
 if (errorstate != HAL_SD_ERROR_NONE)
 {
 return errorstate; // errorstate = HAL_SD_ERROR_CMD_RSP_TIMEOUT
 }
 else
 {
 /* Get Card identification number data */
 hsd->CID[0U] = SDMMC_GetResponse(hsd->Instance, SDMMC_RESP1);
 hsd->CID[1U] = SDMMC_GetResponse(hsd->Instance, SDMMC_RESP2);
 hsd->CID[2U] = SDMMC_GetResponse(hsd->Instance, SDMMC_RESP3);
 hsd->CID[3U] = SDMMC_GetResponse(hsd->Instance, SDMMC_RESP4);
 }
 }

 

 

We checked the voltage on the PINs several times and the transition from 3.3V to 1.8V is evident. 

SDCards that do not have the ability to change voltage, complete initialization without problems at 3.3V.

What can cause this error?

Thanks in advance

Best Regards

Clemente

 

 

    This topic has been closed for replies.
    Best answer by

    Problem solved: an error on the PCB.

    The SDCard power supply was also changed to 1.8V, while it must remain at 3.3V

    Best Regards

    Clemente

    1 reply

    Answer
    February 5, 2024

    Problem solved: an error on the PCB.

    The SDCard power supply was also changed to 1.8V, while it must remain at 3.3V

    Best Regards

    Clemente