Enables wide bus operation for the requested card if supported by card.
2431 __IO uint32_t count = 0U;
2432 SDMMC_InitTypeDef
Init;
2433 uint32_t errorstate;
2434 uint32_t response = 0U, busy = 0U;
2440 hmmc->State = HAL_MMC_STATE_BUSY;
2442 #if !defined(STM32L4R5xx) && !defined(STM32L4R7xx) && !defined(STM32L4R9xx) && !defined(STM32L4S5xx) && !defined(STM32L4S7xx) && !defined(STM32L4S9xx) 2444 Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING;
2445 Init.ClockBypass = SDMMC_CLOCK_BYPASS_DISABLE;
2446 Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE;
2447 Init.BusWide = WideMode;
2448 Init.HardwareFlowControl = SDMMC_HARDWARE_FLOW_CONTROL_DISABLE;
2449 Init.ClockDiv = SDMMC_INIT_CLK_DIV;
2454 if(WideMode == SDMMC_BUS_WIDE_8B)
2457 if(errorstate != HAL_MMC_ERROR_NONE)
2459 hmmc->ErrorCode |= errorstate;
2462 else if(WideMode == SDMMC_BUS_WIDE_4B)
2465 if(errorstate != HAL_MMC_ERROR_NONE)
2467 hmmc->ErrorCode |= errorstate;
2470 else if(WideMode == SDMMC_BUS_WIDE_1B)
2473 if(errorstate != HAL_MMC_ERROR_NONE)
2475 hmmc->ErrorCode |= errorstate;
2481 hmmc->ErrorCode |= HAL_MMC_ERROR_PARAM;
2487 if(count == SDMMC_MAX_TRIAL)
2489 hmmc->State = HAL_MMC_STATE_READY;
2490 hmmc->ErrorCode |= HAL_MMC_ERROR_REQUEST_NOT_APPLICABLE;
2496 errorstate =
SDMMC_CmdSendStatus(hmmc->Instance, (uint32_t)(((uint32_t)hmmc->MmcCard.RelCardAdd) << 16U));
2497 if(errorstate != HAL_MMC_ERROR_NONE)
2499 hmmc->ErrorCode |= errorstate;
2506 busy = (((response >> 7U) == 1U) ? 0U : 1U);
2510 count = SDMMC_DATATIMEOUT;
2511 while((response & 0x00000100U) == 0U)
2515 hmmc->State = HAL_MMC_STATE_READY;
2516 hmmc->ErrorCode |= HAL_MMC_ERROR_REQUEST_NOT_APPLICABLE;
2522 errorstate =
SDMMC_CmdSendStatus(hmmc->Instance, (uint32_t)(((uint32_t)hmmc->MmcCard.RelCardAdd) << 16U));
2523 if(errorstate != HAL_MMC_ERROR_NONE)
2525 hmmc->ErrorCode |= errorstate;
2532 if(hmmc->ErrorCode != HAL_MMC_ERROR_NONE)
2535 __HAL_MMC_CLEAR_FLAG(hmmc, SDMMC_STATIC_FLAGS);
2536 hmmc->State = HAL_MMC_STATE_READY;
2542 Init.ClockEdge = hmmc->Init.ClockEdge;
2543 #if !defined(STM32L4R5xx) && !defined(STM32L4R7xx) && !defined(STM32L4R9xx) && !defined(STM32L4S5xx) && !defined(STM32L4S7xx) && !defined(STM32L4S9xx) 2544 Init.ClockBypass = hmmc->Init.ClockBypass;
2546 Init.ClockPowerSave = hmmc->Init.ClockPowerSave;
2547 Init.BusWide = WideMode;
2548 Init.HardwareFlowControl = hmmc->Init.HardwareFlowControl;
2549 Init.ClockDiv = hmmc->Init.ClockDiv;
2554 hmmc->State = HAL_MMC_STATE_READY;
uint32_t SDMMC_CmdSendStatus(SDMMC_TypeDef *SDMMCx, uint32_t Argument)
Send the Status command and check the response.
uint32_t SDMMC_CmdSwitch(SDMMC_TypeDef *SDMMCx, uint32_t Argument)
Checks switchable function and switch card function. SDMMC_CMD_HS_SWITCH comand.
uint32_t SDMMC_GetResponse(SDMMC_TypeDef *SDMMCx, uint32_t Response)
Return the response received from the card for the last command.
HAL_StatusTypeDef SDMMC_Init(SDMMC_TypeDef *SDMMCx, SDMMC_InitTypeDef Init)
Initializes the SDMMC according to the specified parameters in the SDMMC_InitTypeDef and create the a...
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))