Skip to content

Commit 9f57a33

Browse files
ExaltZephyrerwango
authored andcommitted
stm32cube: stm32h5: sdio: fix SDIO_Init failure
when skipping card identification sequence. This commit fixes an issue in the STM32H5 SDIO driver where HAL_SDIO_Init() fails if the card identification sequence is skipped. Signed-off-by: Sara Touqan <[email protected]>
1 parent 3e57496 commit 9f57a33

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

stm32cube/stm32h5xx/README

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,10 @@ Patch List:
6161
Impacted files:
6262
drivers/include/Legacy/stm32_hal_legacy.h
6363

64+
*Fix SDIO initialization failure when skipping card identification sequence
65+
Fixes an issue in the STM32H5 SDIO driver where HAL_SDIO_Init() fails if
66+
the card identification sequence is skipped.
67+
Impacted files:
68+
stm32cube/stm32h5xx/drivers/src/stm32h5xx_hal_sdio.c
69+
6470
See release_note.html from STM32Cube

stm32cube/stm32h5xx/drivers/src/stm32h5xx_hal_sdio.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ HAL_StatusTypeDef HAL_SDIO_Init(SDIO_HandleTypeDef *hsdio)
314314
{
315315
SDIO_InitTypeDef Init;
316316
uint32_t sdmmc_clk = 0U;
317-
uint8_t data;
318317

319318
/* Check the parameters */
320319
assert_param(hsdio != NULL);
@@ -407,12 +406,6 @@ HAL_StatusTypeDef HAL_SDIO_Init(SDIO_HandleTypeDef *hsdio)
407406
Init.ClockDiv = hsdio->Init.ClockDiv;
408407
(void)SDMMC_Init(hsdio->Instance, Init);
409408

410-
data = (hsdio->Init.BusWide == HAL_SDIO_4_WIRES_MODE) ? 2U : 0U;
411-
if (SDIO_WriteDirect(hsdio, SDMMC_SDIO_CCCR4_SD_BYTE3, HAL_SDIO_WRITE_ONLY, SDIO_FUNCTION_0, &data) != HAL_OK)
412-
{
413-
return HAL_ERROR;
414-
}
415-
416409
hsdio->Context = SDIO_CONTEXT_NONE;
417410
hsdio->State = HAL_SDIO_STATE_READY;
418411

@@ -2507,6 +2500,7 @@ HAL_StatusTypeDef HAL_SDIO_RegisterIOFunctionCallback(SDIO_HandleTypeDef *hsdio,
25072500
*/
25082501
static HAL_StatusTypeDef SDIO_InitCard(SDIO_HandleTypeDef *hsdio)
25092502
{
2503+
uint8_t data;
25102504
uint32_t errorstate;
25112505
uint32_t timeout = 0U;
25122506
uint16_t sdio_rca = 1U;
@@ -2581,6 +2575,12 @@ static HAL_StatusTypeDef SDIO_InitCard(SDIO_HandleTypeDef *hsdio)
25812575
return HAL_ERROR;
25822576
}
25832577

2578+
data = (hsdio->Init.BusWide == HAL_SDIO_4_WIRES_MODE) ? 2U : 0U;
2579+
if (SDIO_WriteDirect(hsdio, SDMMC_SDIO_CCCR4_SD_BYTE3, HAL_SDIO_WRITE_ONLY, SDIO_FUNCTION_0, &data) != HAL_OK)
2580+
{
2581+
return HAL_ERROR;
2582+
}
2583+
25842584
return HAL_OK;
25852585
}
25862586

0 commit comments

Comments
 (0)