Initializes the mmc card.
2927 uint32_t errorstate;
2928 uint16_t mmc_rca = 1U;
2929 #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx) 2930 MMC_InitTypeDef
Init;
2937 return HAL_MMC_ERROR_REQUEST_NOT_APPLICABLE;
2942 if(errorstate != HAL_MMC_ERROR_NONE)
2958 if(errorstate != HAL_MMC_ERROR_NONE)
2964 hmmc->MmcCard.RelCardAdd = mmc_rca;
2967 errorstate =
SDMMC_CmdSendCSD(hmmc->Instance, (uint32_t)(hmmc->MmcCard.RelCardAdd << 16U));
2968 if(errorstate != HAL_MMC_ERROR_NONE)
2984 #if !defined(STM32L4R5xx) && !defined(STM32L4R7xx) && !defined(STM32L4R9xx) && !defined(STM32L4S5xx) && !defined(STM32L4S7xx) && !defined(STM32L4S9xx) 2988 return hmmc->ErrorCode;
2992 errorstate =
SDMMC_CmdSelDesel(hmmc->Instance, (uint32_t)(((uint32_t)hmmc->MmcCard.RelCardAdd) << 16U));
2993 if(errorstate != HAL_MMC_ERROR_NONE)
2999 (void)
SDMMC_Init(hmmc->Instance, hmmc->Init);
3002 errorstate =
SDMMC_CmdSelDesel(hmmc->Instance, (uint32_t)(((uint32_t)hmmc->MmcCard.RelCardAdd) << 16U));
3003 if(errorstate != HAL_MMC_ERROR_NONE)
3011 return hmmc->ErrorCode;
3015 errorstate =
SDMMC_CmdSendStatus(hmmc->Instance, (uint32_t)(((uint32_t)hmmc->MmcCard.RelCardAdd) << 16U));
3016 if(errorstate != HAL_MMC_ERROR_NONE)
3018 hmmc->ErrorCode |= errorstate;
3022 Init.ClockEdge = hmmc->Init.ClockEdge;
3023 Init.ClockPowerSave = hmmc->Init.ClockPowerSave;
3024 Init.BusWide = SDMMC_BUS_WIDE_1B;
3025 Init.HardwareFlowControl = hmmc->Init.HardwareFlowControl;
3026 Init.ClockDiv = hmmc->Init.ClockDiv;
3031 return HAL_MMC_ERROR_NONE;
uint32_t SDMMC_CmdSelDesel(SDMMC_TypeDef *SDMMCx, uint64_t Addr)
Send the Select Deselect command and check the response.
uint32_t SDMMC_CmdSendStatus(SDMMC_TypeDef *SDMMCx, uint32_t Argument)
Send the Status command and check the response.
uint32_t SDMMC_GetPowerState(SDMMC_TypeDef *SDMMCx)
Get SDMMC Power state.
uint32_t SDMMC_CmdSendCSD(SDMMC_TypeDef *SDMMCx, uint32_t Argument)
Send the Send CSD command and check the response.
uint32_t SDMMC_CmdSetRelAdd(SDMMC_TypeDef *SDMMCx, uint16_t *pRCA)
Send the Send CSD command and check the response.
uint32_t SDMMC_CmdSendCID(SDMMC_TypeDef *SDMMCx)
Send the Send CID command and check the response.
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...
HAL_StatusTypeDef HAL_MMC_GetCardCSD(MMC_HandleTypeDef *hmmc, HAL_MMC_CardCSDTypeDef *pCSD)
Returns information the information of the card which are stored on the CSD register.