Skip to content

Commit 3e57496

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

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

stm32cube/stm32u5xx/README

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,10 @@ Patch List:
4848
Impacted files:
4949
drivers/include/Legacy/stm32_hal_legacy.h
5050

51+
*Fix SDIO initialization failure when skipping card identification sequence
52+
Fixes an issue in the STM32U5 SDIO driver where HAL_SDIO_Init() fails if
53+
the card identification sequence is skipped.
54+
Impacted files:
55+
stm32cube/stm32u5xx/drivers/src/stm32u5xx_hal_sdio.c
56+
5157
See release_note.html from STM32Cube

stm32cube/stm32u5xx/drivers/src/stm32u5xx_hal_sdio.c

Lines changed: 6 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;
317-
uint8_t data;
318317

319318
/* Check the parameters */
320319
assert_param(hsdio != NULL);
@@ -398,12 +397,6 @@ HAL_StatusTypeDef HAL_SDIO_Init(SDIO_HandleTypeDef *hsdio)
398397
Init.ClockDiv = hsdio->Init.ClockDiv;
399398
(void)SDMMC_Init(hsdio->Instance, Init);
400399

401-
data = (hsdio->Init.BusWide == HAL_SDIO_4_WIRES_MODE) ? 2U : 0U;
402-
if (SDIO_WriteDirect(hsdio, SDMMC_SDIO_CCCR4_SD_BYTE3, HAL_SDIO_WRITE_ONLY, SDIO_FUNCTION_0, &data) != HAL_OK)
403-
{
404-
return HAL_ERROR;
405-
}
406-
407400
hsdio->Context = SDIO_CONTEXT_NONE;
408401
hsdio->State = HAL_SDIO_STATE_READY;
409402

@@ -2560,6 +2553,12 @@ static HAL_StatusTypeDef SDIO_InitCard(SDIO_HandleTypeDef *hsdio)
25602553
return HAL_ERROR;
25612554
}
25622555

2556+
uint8_t data = (hsdio->Init.BusWide == HAL_SDIO_4_WIRES_MODE) ? 2U : 0U;
2557+
if (SDIO_WriteDirect(hsdio, SDMMC_SDIO_CCCR4_SD_BYTE3, HAL_SDIO_WRITE_ONLY, SDIO_FUNCTION_0, &data) != HAL_OK)
2558+
{
2559+
return HAL_ERROR;
2560+
}
2561+
25632562
return HAL_OK;
25642563
}
25652564

0 commit comments

Comments
 (0)