cancel
Showing results for 
Search instead for 
Did you mean: 

SDMMC_ERROR_CMD_RSP_TIMEOUT in SDMMC_GetCmdResp1

antoine4449
Associate

Hello everyone,

I create a project for the board STEVAL MKBOXPRO STM32U585. When i run it, there is an error in the initialisation of SDMMC1 with the initial generation of the function : 

 

static void MX_SDMMC1_SD_Init(void)

{

hsd1.Instance = SDMMC1;

hsd1.Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING;

hsd1.Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE;

hsd1.Init.BusWide = SDMMC_BUS_WIDE_4B;

hsd1.Init.HardwareFlowControl = SDMMC_HARDWARE_FLOW_CONTROL_DISABLE;

hsd1.Init.ClockDiv = 8;

if (HAL_SD_Init(&hsd1) != HAL_OK)

{

Error_Handler();

}

}

 

So it goes in the Error_Handler() function. I tried to debug it and i found that the error is in the function called "SDMMC_GetCmdResp1" which return SDMMC_ERROR_CMD_RSP_TIMEOUT.

I tried to find a solution on ST forum but i don't think the problem has been really solved. I see things like it can be the delay, so i tried to put some but nothing changed.

Here a part of the function SDMMC_GetCmdResp1 :

uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)

{

uint32_t response_r1;

uint32_t sta_reg;

 

/* 8 is the number of required instructions cycles for the below loop statement.

The Timeout is expressed in ms */

uint32_t count = Timeout * (SystemCoreClock / 8U / 1000U);

 

do

{

if (count-- == 0U)

{

return SDMMC_ERROR_TIMEOUT;

}

sta_reg = SDMMCx->STA;

} while (((sta_reg & (SDMMC_FLAG_CCRCFAIL | SDMMC_FLAG_CMDREND | SDMMC_FLAG_CTIMEOUT |

SDMMC_FLAG_BUSYD0END)) == 0U) || ((sta_reg & SDMMC_FLAG_CMDACT) != 0U));

 

if (__SDMMC_GET_FLAG(SDMMCx, SDMMC_FLAG_CTIMEOUT))

{

__SDMMC_CLEAR_FLAG(SDMMCx, SDMMC_FLAG_CTIMEOUT);

 

return SDMMC_ERROR_CMD_RSP_TIMEOUT;

}

 

Also my SDMMC clock is 48MHz. Thanks for any help.

 

3 REPLIES 3
AScha.3
Chief III

Hi,

did you search sdmmc on forum here ? ...read...also my comments.

Set for beginning: 1bit mode, pin speed medium + pullup ON , on all lines.

Then try again.

If you feel a post has answered your question, please click "Accept as Solution".

I tried your solution but i still have the same error. I put screenshots of the parameters of SDMMC1, i think i'm missing something. 

And to answer to your question yes i search SDMMC on the forum, i tried solutions about the delay like i said but nothing works.

 

antoine4449_0-1743580666554.pngantoine4449_1-1743580695731.png

antoine4449_2-1743580823946.png

 

 

Ok,

next...is the interface voltage setting ok ?

AScha3_0-1743589451814.png

from cpu: PH8 + PH10 :

AScha3_1-1743589478245.png

+

You dont need to look at card commands , just : init..., then mount(...1); parameter 1 = mount now .

Then try to read directory...if its ok, then sd-card access looking fine.

If you feel a post has answered your question, please click "Accept as Solution".