STM32L4xx_HAL_Driver  1.14.0

Data transfers functions. More...

Functions

uint32_t SDMMC_CmdBlockLength (SDMMC_TypeDef *SDMMCx, uint32_t BlockSize)
 Send the Data Block Lenght command and check the response. More...
 
uint32_t SDMMC_CmdReadSingleBlock (SDMMC_TypeDef *SDMMCx, uint32_t ReadAdd)
 Send the Read Single Block command and check the response. More...
 
uint32_t SDMMC_CmdReadMultiBlock (SDMMC_TypeDef *SDMMCx, uint32_t ReadAdd)
 Send the Read Multi Block command and check the response. More...
 
uint32_t SDMMC_CmdWriteSingleBlock (SDMMC_TypeDef *SDMMCx, uint32_t WriteAdd)
 Send the Write Single Block command and check the response. More...
 
uint32_t SDMMC_CmdWriteMultiBlock (SDMMC_TypeDef *SDMMCx, uint32_t WriteAdd)
 Send the Write Multi Block command and check the response. More...
 
uint32_t SDMMC_CmdSDEraseStartAdd (SDMMC_TypeDef *SDMMCx, uint32_t StartAdd)
 Send the Start Address Erase command for SD and check the response. More...
 
uint32_t SDMMC_CmdSDEraseEndAdd (SDMMC_TypeDef *SDMMCx, uint32_t EndAdd)
 Send the End Address Erase command for SD and check the response. More...
 
uint32_t SDMMC_CmdEraseStartAdd (SDMMC_TypeDef *SDMMCx, uint32_t StartAdd)
 Send the Start Address Erase command and check the response. More...
 
uint32_t SDMMC_CmdEraseEndAdd (SDMMC_TypeDef *SDMMCx, uint32_t EndAdd)
 Send the End Address Erase command and check the response. More...
 
uint32_t SDMMC_CmdErase (SDMMC_TypeDef *SDMMCx)
 Send the Erase command and check the response. More...
 
uint32_t SDMMC_CmdStopTransfer (SDMMC_TypeDef *SDMMCx)
 Send the Stop Transfer command and check the response. More...
 
uint32_t SDMMC_CmdSelDesel (SDMMC_TypeDef *SDMMCx, uint64_t Addr)
 Send the Select Deselect command and check the response. More...
 
uint32_t SDMMC_CmdGoIdleState (SDMMC_TypeDef *SDMMCx)
 Send the Go Idle State command and check the response. More...
 
uint32_t SDMMC_CmdOperCond (SDMMC_TypeDef *SDMMCx)
 Send the Operating Condition command and check the response. More...
 
uint32_t SDMMC_CmdAppCommand (SDMMC_TypeDef *SDMMCx, uint32_t Argument)
 Send the Application command to verify that that the next command is an application specific com-mand rather than a standard command and check the response. More...
 
uint32_t SDMMC_CmdAppOperCommand (SDMMC_TypeDef *SDMMCx, uint32_t Argument)
 Send the command asking the accessed card to send its operating condition register (OCR) More...
 
uint32_t SDMMC_CmdBusWidth (SDMMC_TypeDef *SDMMCx, uint32_t BusWidth)
 Send the Bus Width command and check the response. More...
 
uint32_t SDMMC_CmdSendSCR (SDMMC_TypeDef *SDMMCx)
 Send the Send SCR command and check the response. More...
 
uint32_t SDMMC_CmdSendCID (SDMMC_TypeDef *SDMMCx)
 Send the Send CID command and check the response. More...
 
uint32_t SDMMC_CmdSendCSD (SDMMC_TypeDef *SDMMCx, uint32_t Argument)
 Send the Send CSD command and check the response. More...
 
uint32_t SDMMC_CmdSetRelAdd (SDMMC_TypeDef *SDMMCx, uint16_t *pRCA)
 Send the Send CSD command and check the response. More...
 
uint32_t SDMMC_CmdSendStatus (SDMMC_TypeDef *SDMMCx, uint32_t Argument)
 Send the Status command and check the response. More...
 
uint32_t SDMMC_CmdStatusRegister (SDMMC_TypeDef *SDMMCx)
 Send the Status register command and check the response. More...
 
uint32_t SDMMC_CmdOpCondition (SDMMC_TypeDef *SDMMCx, uint32_t Argument)
 Sends host capacity support information and activates the card's initialization process. Send SDMMC_CMD_SEND_OP_COND command. More...
 
uint32_t SDMMC_CmdSwitch (SDMMC_TypeDef *SDMMCx, uint32_t Argument)
 Checks switchable function and switch card function. SDMMC_CMD_HS_SWITCH comand. More...
 
uint32_t SDMMC_CmdVoltageSwitch (SDMMC_TypeDef *SDMMCx)
 Send the command asking the accessed card to send its operating condition register (OCR) More...
 
uint32_t SDMMC_CmdSendEXTCSD (SDMMC_TypeDef *SDMMCx, uint32_t Argument)
 Send the Send EXT_CSD command and check the response. More...
 

Detailed Description

Data transfers functions.

 ===============================================================================
                   ##### Commands management functions #####
 ===============================================================================
    [..]
    This subsection provides a set of functions allowing to manage the needed commands.

Function Documentation

◆ SDMMC_CmdAppCommand()

uint32_t SDMMC_CmdAppCommand ( SDMMC_TypeDef *  SDMMCx,
uint32_t  Argument 
)

Send the Application command to verify that that the next command is an application specific com-mand rather than a standard command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
ArgumentCommand Argument
Return values
HALstatus

Definition at line 906 of file stm32l4xx_ll_sdmmc.c.

907 {
908  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
909  uint32_t errorstate;
910 
911  sdmmc_cmdinit.Argument = (uint32_t)Argument;
912  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_APP_CMD;
913  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
914  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
915  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
916  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
917 
918  /* Check for error conditions */
919  /* If there is a HAL_ERROR, it is a MMC card, else
920  it is a SD card: SD card 2.0 (voltage range mismatch)
921  or SD card 1.x */
922  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_APP_CMD, SDMMC_CMDTIMEOUT);
923 
924  return errorstate;
925 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdAppOperCommand()

uint32_t SDMMC_CmdAppOperCommand ( SDMMC_TypeDef *  SDMMCx,
uint32_t  Argument 
)

Send the command asking the accessed card to send its operating condition register (OCR)

Parameters
SDMMCxPointer to SDMMC register base
ArgumentCommand Argument
Return values
HALstatus

Definition at line 934 of file stm32l4xx_ll_sdmmc.c.

935 {
936  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
937  uint32_t errorstate;
938 
939 #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx)
940  sdmmc_cmdinit.Argument = Argument;
941 #else
942  sdmmc_cmdinit.Argument = SDMMC_VOLTAGE_WINDOW_SD | Argument;
943 #endif /* STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx */
944  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_SD_APP_OP_COND;
945  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
946  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
947  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
948  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
949 
950  /* Check for error conditions */
951  errorstate = SDMMC_GetCmdResp3(SDMMCx);
952 
953  return errorstate;
954 }
static uint32_t SDMMC_GetCmdResp3(SDMMC_TypeDef *SDMMCx)
Checks for error conditions for R3 (OCR) response.
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
SDMMC Command Control structure.

◆ SDMMC_CmdBlockLength()

uint32_t SDMMC_CmdBlockLength ( SDMMC_TypeDef *  SDMMCx,
uint32_t  BlockSize 
)

Send the Data Block Lenght command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
Return values
HALstatus

Definition at line 553 of file stm32l4xx_ll_sdmmc.c.

554 {
555  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
556  uint32_t errorstate;
557 
558  /* Set Block Size for Card */
559  sdmmc_cmdinit.Argument = (uint32_t)BlockSize;
560  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_SET_BLOCKLEN;
561  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
562  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
563  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
564  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
565 
566  /* Check for error conditions */
567  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_SET_BLOCKLEN, SDMMC_CMDTIMEOUT);
568 
569  return errorstate;
570 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdBusWidth()

uint32_t SDMMC_CmdBusWidth ( SDMMC_TypeDef *  SDMMCx,
uint32_t  BusWidth 
)

Send the Bus Width command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
BusWidthBusWidth
Return values
HALstatus

Definition at line 962 of file stm32l4xx_ll_sdmmc.c.

963 {
964  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
965  uint32_t errorstate;
966 
967  sdmmc_cmdinit.Argument = (uint32_t)BusWidth;
968  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_APP_SD_SET_BUSWIDTH;
969  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
970  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
971  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
972  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
973 
974  /* Check for error conditions */
975  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_APP_SD_SET_BUSWIDTH, SDMMC_CMDTIMEOUT);
976 
977  return errorstate;
978 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdErase()

uint32_t SDMMC_CmdErase ( SDMMC_TypeDef *  SDMMCx)

Send the Erase command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
Return values
HALstatus

Definition at line 769 of file stm32l4xx_ll_sdmmc.c.

770 {
771  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
772  uint32_t errorstate;
773 
774  /* Set Block Size for Card */
775  sdmmc_cmdinit.Argument = 0U;
776  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_ERASE;
777  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
778  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
779  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
780  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
781 
782  /* Check for error conditions */
783  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_ERASE, SDMMC_MAXERASETIMEOUT);
784 
785  return errorstate;
786 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdEraseEndAdd()

uint32_t SDMMC_CmdEraseEndAdd ( SDMMC_TypeDef *  SDMMCx,
uint32_t  EndAdd 
)

Send the End Address Erase command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
Return values
HALstatus

Definition at line 745 of file stm32l4xx_ll_sdmmc.c.

746 {
747  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
748  uint32_t errorstate;
749 
750  /* Set Block Size for Card */
751  sdmmc_cmdinit.Argument = (uint32_t)EndAdd;
752  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_ERASE_GRP_END;
753  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
754  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
755  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
756  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
757 
758  /* Check for error conditions */
759  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_ERASE_GRP_END, SDMMC_CMDTIMEOUT);
760 
761  return errorstate;
762 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdEraseStartAdd()

uint32_t SDMMC_CmdEraseStartAdd ( SDMMC_TypeDef *  SDMMCx,
uint32_t  StartAdd 
)

Send the Start Address Erase command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
Return values
HALstatus

Definition at line 721 of file stm32l4xx_ll_sdmmc.c.

722 {
723  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
724  uint32_t errorstate;
725 
726  /* Set Block Size for Card */
727  sdmmc_cmdinit.Argument = (uint32_t)StartAdd;
728  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_ERASE_GRP_START;
729  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
730  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
731  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
732  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
733 
734  /* Check for error conditions */
735  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_ERASE_GRP_START, SDMMC_CMDTIMEOUT);
736 
737  return errorstate;
738 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdGoIdleState()

uint32_t SDMMC_CmdGoIdleState ( SDMMC_TypeDef *  SDMMCx)

Send the Go Idle State command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
Return values
HALstatus

Definition at line 852 of file stm32l4xx_ll_sdmmc.c.

853 {
854  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
855  uint32_t errorstate;
856 
857  sdmmc_cmdinit.Argument = 0U;
858  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_GO_IDLE_STATE;
859  sdmmc_cmdinit.Response = SDMMC_RESPONSE_NO;
860  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
861  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
862  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
863 
864  /* Check for error conditions */
865  errorstate = SDMMC_GetCmdError(SDMMCx);
866 
867  return errorstate;
868 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdError(SDMMC_TypeDef *SDMMCx)
Checks for error conditions for CMD0.
SDMMC Command Control structure.

◆ SDMMC_CmdOpCondition()

uint32_t SDMMC_CmdOpCondition ( SDMMC_TypeDef *  SDMMCx,
uint32_t  Argument 
)

Sends host capacity support information and activates the card's initialization process. Send SDMMC_CMD_SEND_OP_COND command.

Parameters
SDMMCxPointer to SDMMC register base Argument: Argument used for the command
Return values
HALstatus

Definition at line 1132 of file stm32l4xx_ll_sdmmc.c.

1133 {
1134  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
1135  uint32_t errorstate;
1136 
1137  sdmmc_cmdinit.Argument = Argument;
1138  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_SEND_OP_COND;
1139  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
1140  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
1141  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
1142  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
1143 
1144  /* Check for error conditions */
1145  errorstate = SDMMC_GetCmdResp3(SDMMCx);
1146 
1147  return errorstate;
1148 }
static uint32_t SDMMC_GetCmdResp3(SDMMC_TypeDef *SDMMCx)
Checks for error conditions for R3 (OCR) response.
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
SDMMC Command Control structure.

◆ SDMMC_CmdOperCond()

uint32_t SDMMC_CmdOperCond ( SDMMC_TypeDef *  SDMMCx)

Send the Operating Condition command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
Return values
HALstatus

Definition at line 875 of file stm32l4xx_ll_sdmmc.c.

876 {
877  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
878  uint32_t errorstate;
879 
880  /* Send CMD8 to verify SD card interface operating condition */
881  /* Argument: - [31:12]: Reserved (shall be set to '0')
882  - [11:8]: Supply Voltage (VHS) 0x1 (Range: 2.7-3.6 V)
883  - [7:0]: Check Pattern (recommended 0xAA) */
884  /* CMD Response: R7 */
885  sdmmc_cmdinit.Argument = SDMMC_CHECK_PATTERN;
886  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_HS_SEND_EXT_CSD;
887  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
888  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
889  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
890  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
891 
892  /* Check for error conditions */
893  errorstate = SDMMC_GetCmdResp7(SDMMCx);
894 
895  return errorstate;
896 }
static uint32_t SDMMC_GetCmdResp7(SDMMC_TypeDef *SDMMCx)
Checks for error conditions for R7 response.
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
SDMMC Command Control structure.

◆ SDMMC_CmdReadMultiBlock()

uint32_t SDMMC_CmdReadMultiBlock ( SDMMC_TypeDef *  SDMMCx,
uint32_t  ReadAdd 
)

Send the Read Multi Block command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
Return values
HALstatus

Definition at line 601 of file stm32l4xx_ll_sdmmc.c.

602 {
603  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
604  uint32_t errorstate;
605 
606  /* Set Block Size for Card */
607  sdmmc_cmdinit.Argument = (uint32_t)ReadAdd;
608  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_READ_MULT_BLOCK;
609  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
610  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
611  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
612  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
613 
614  /* Check for error conditions */
615  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_READ_MULT_BLOCK, SDMMC_CMDTIMEOUT);
616 
617  return errorstate;
618 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdReadSingleBlock()

uint32_t SDMMC_CmdReadSingleBlock ( SDMMC_TypeDef *  SDMMCx,
uint32_t  ReadAdd 
)

Send the Read Single Block command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
Return values
HALstatus

Definition at line 577 of file stm32l4xx_ll_sdmmc.c.

578 {
579  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
580  uint32_t errorstate;
581 
582  /* Set Block Size for Card */
583  sdmmc_cmdinit.Argument = (uint32_t)ReadAdd;
584  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_READ_SINGLE_BLOCK;
585  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
586  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
587  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
588  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
589 
590  /* Check for error conditions */
591  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_READ_SINGLE_BLOCK, SDMMC_CMDTIMEOUT);
592 
593  return errorstate;
594 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdSDEraseEndAdd()

uint32_t SDMMC_CmdSDEraseEndAdd ( SDMMC_TypeDef *  SDMMCx,
uint32_t  EndAdd 
)

Send the End Address Erase command for SD and check the response.

Parameters
SDMMCxPointer to SDMMC register base
Return values
HALstatus

Definition at line 697 of file stm32l4xx_ll_sdmmc.c.

698 {
699  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
700  uint32_t errorstate;
701 
702  /* Set Block Size for Card */
703  sdmmc_cmdinit.Argument = (uint32_t)EndAdd;
704  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_SD_ERASE_GRP_END;
705  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
706  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
707  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
708  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
709 
710  /* Check for error conditions */
711  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_SD_ERASE_GRP_END, SDMMC_CMDTIMEOUT);
712 
713  return errorstate;
714 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdSDEraseStartAdd()

uint32_t SDMMC_CmdSDEraseStartAdd ( SDMMC_TypeDef *  SDMMCx,
uint32_t  StartAdd 
)

Send the Start Address Erase command for SD and check the response.

Parameters
SDMMCxPointer to SDMMC register base
Return values
HALstatus

Definition at line 673 of file stm32l4xx_ll_sdmmc.c.

674 {
675  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
676  uint32_t errorstate;
677 
678  /* Set Block Size for Card */
679  sdmmc_cmdinit.Argument = (uint32_t)StartAdd;
680  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_SD_ERASE_GRP_START;
681  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
682  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
683  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
684  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
685 
686  /* Check for error conditions */
687  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_SD_ERASE_GRP_START, SDMMC_CMDTIMEOUT);
688 
689  return errorstate;
690 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdSelDesel()

uint32_t SDMMC_CmdSelDesel ( SDMMC_TypeDef *  SDMMCx,
uint64_t  Addr 
)

Send the Select Deselect command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
addrAddress of the card to be selected
Return values
HALstatus

Definition at line 828 of file stm32l4xx_ll_sdmmc.c.

829 {
830  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
831  uint32_t errorstate;
832 
833  /* Send CMD7 SDMMC_SEL_DESEL_CARD */
834  sdmmc_cmdinit.Argument = (uint32_t)Addr;
835  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_SEL_DESEL_CARD;
836  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
837  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
838  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
839  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
840 
841  /* Check for error conditions */
842  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_SEL_DESEL_CARD, SDMMC_CMDTIMEOUT);
843 
844  return errorstate;
845 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdSendCID()

uint32_t SDMMC_CmdSendCID ( SDMMC_TypeDef *  SDMMCx)

Send the Send CID command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
Return values
HALstatus

Definition at line 1009 of file stm32l4xx_ll_sdmmc.c.

1010 {
1011  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
1012  uint32_t errorstate;
1013 
1014  /* Send CMD2 ALL_SEND_CID */
1015  sdmmc_cmdinit.Argument = 0U;
1016  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_ALL_SEND_CID;
1017  sdmmc_cmdinit.Response = SDMMC_RESPONSE_LONG;
1018  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
1019  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
1020  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
1021 
1022  /* Check for error conditions */
1023  errorstate = SDMMC_GetCmdResp2(SDMMCx);
1024 
1025  return errorstate;
1026 }
static uint32_t SDMMC_GetCmdResp2(SDMMC_TypeDef *SDMMCx)
Checks for error conditions for R2 (CID or CSD) response.
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
SDMMC Command Control structure.

◆ SDMMC_CmdSendCSD()

uint32_t SDMMC_CmdSendCSD ( SDMMC_TypeDef *  SDMMCx,
uint32_t  Argument 
)

Send the Send CSD command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
ArgumentCommand Argument
Return values
HALstatus

Definition at line 1034 of file stm32l4xx_ll_sdmmc.c.

1035 {
1036  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
1037  uint32_t errorstate;
1038 
1039  /* Send CMD9 SEND_CSD */
1040  sdmmc_cmdinit.Argument = Argument;
1041  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_SEND_CSD;
1042  sdmmc_cmdinit.Response = SDMMC_RESPONSE_LONG;
1043  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
1044  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
1045  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
1046 
1047  /* Check for error conditions */
1048  errorstate = SDMMC_GetCmdResp2(SDMMCx);
1049 
1050  return errorstate;
1051 }
static uint32_t SDMMC_GetCmdResp2(SDMMC_TypeDef *SDMMCx)
Checks for error conditions for R2 (CID or CSD) response.
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
SDMMC Command Control structure.

◆ SDMMC_CmdSendEXTCSD()

uint32_t SDMMC_CmdSendEXTCSD ( SDMMC_TypeDef *  SDMMCx,
uint32_t  Argument 
)

Send the Send EXT_CSD command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
ArgumentCommand Argument
Return values
HALstatus

Definition at line 1207 of file stm32l4xx_ll_sdmmc.c.

1208 {
1209  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
1210  uint32_t errorstate;
1211 
1212  /* Send CMD9 SEND_CSD */
1213  sdmmc_cmdinit.Argument = Argument;
1214  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_HS_SEND_EXT_CSD;
1215  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
1216  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
1217  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
1218  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
1219 
1220  /* Check for error conditions */
1221  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_HS_SEND_EXT_CSD,SDMMC_CMDTIMEOUT);
1222 
1223  return errorstate;
1224 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdSendSCR()

uint32_t SDMMC_CmdSendSCR ( SDMMC_TypeDef *  SDMMCx)

Send the Send SCR command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
Return values
HALstatus

Definition at line 985 of file stm32l4xx_ll_sdmmc.c.

986 {
987  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
988  uint32_t errorstate;
989 
990  /* Send CMD51 SD_APP_SEND_SCR */
991  sdmmc_cmdinit.Argument = 0U;
992  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_SD_APP_SEND_SCR;
993  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
994  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
995  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
996  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
997 
998  /* Check for error conditions */
999  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_SD_APP_SEND_SCR, SDMMC_CMDTIMEOUT);
1000 
1001  return errorstate;
1002 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdSendStatus()

uint32_t SDMMC_CmdSendStatus ( SDMMC_TypeDef *  SDMMCx,
uint32_t  Argument 
)

Send the Status command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
ArgumentCommand Argument
Return values
HALstatus

Definition at line 1084 of file stm32l4xx_ll_sdmmc.c.

1085 {
1086  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
1087  uint32_t errorstate;
1088 
1089  sdmmc_cmdinit.Argument = Argument;
1090  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_SEND_STATUS;
1091  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
1092  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
1093  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
1094  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
1095 
1096  /* Check for error conditions */
1097  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_SEND_STATUS, SDMMC_CMDTIMEOUT);
1098 
1099  return errorstate;
1100 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdSetRelAdd()

uint32_t SDMMC_CmdSetRelAdd ( SDMMC_TypeDef *  SDMMCx,
uint16_t *  pRCA 
)

Send the Send CSD command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
pRCACard RCA
Return values
HALstatus

Definition at line 1059 of file stm32l4xx_ll_sdmmc.c.

1060 {
1061  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
1062  uint32_t errorstate;
1063 
1064  /* Send CMD3 SD_CMD_SET_REL_ADDR */
1065  sdmmc_cmdinit.Argument = 0U;
1066  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_SET_REL_ADDR;
1067  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
1068  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
1069  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
1070  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
1071 
1072  /* Check for error conditions */
1073  errorstate = SDMMC_GetCmdResp6(SDMMCx, SDMMC_CMD_SET_REL_ADDR, pRCA);
1074 
1075  return errorstate;
1076 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
SDMMC Command Control structure.
static uint32_t SDMMC_GetCmdResp6(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint16_t *pRCA)
Checks for error conditions for R6 (RCA) response.

◆ SDMMC_CmdStatusRegister()

uint32_t SDMMC_CmdStatusRegister ( SDMMC_TypeDef *  SDMMCx)

Send the Status register command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
Return values
HALstatus

Definition at line 1107 of file stm32l4xx_ll_sdmmc.c.

1108 {
1109  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
1110  uint32_t errorstate;
1111 
1112  sdmmc_cmdinit.Argument = 0U;
1113  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_SD_APP_STATUS;
1114  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
1115  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
1116  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
1117  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
1118 
1119  /* Check for error conditions */
1120  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_SD_APP_STATUS, SDMMC_CMDTIMEOUT);
1121 
1122  return errorstate;
1123 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdStopTransfer()

uint32_t SDMMC_CmdStopTransfer ( SDMMC_TypeDef *  SDMMCx)

Send the Stop Transfer command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
Return values
HALstatus

Definition at line 793 of file stm32l4xx_ll_sdmmc.c.

794 {
795  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
796  uint32_t errorstate;
797 
798  /* Send CMD12 STOP_TRANSMISSION */
799  sdmmc_cmdinit.Argument = 0U;
800  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_STOP_TRANSMISSION;
801  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
802  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
803  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
804 
805 #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx)
806  __SDMMC_CMDSTOP_ENABLE(SDMMCx);
807  __SDMMC_CMDTRANS_DISABLE(SDMMCx);
808 #endif /* STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx */
809 
810  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
811 
812  /* Check for error conditions */
813  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_STOP_TRANSMISSION, SDMMC_STOPTRANSFERTIMEOUT);
814 
815 #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx)
816  __SDMMC_CMDSTOP_DISABLE(SDMMCx);
817 #endif /* STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx */
818 
819  return errorstate;
820 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdSwitch()

uint32_t SDMMC_CmdSwitch ( SDMMC_TypeDef *  SDMMCx,
uint32_t  Argument 
)

Checks switchable function and switch card function. SDMMC_CMD_HS_SWITCH comand.

Parameters
SDMMCxPointer to SDMMC register base Argument: Argument used for the command
Return values
HALstatus

Definition at line 1156 of file stm32l4xx_ll_sdmmc.c.

1157 {
1158  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
1159  uint32_t errorstate;
1160 
1161  /* Send CMD6 to activate SDR50 Mode and Power Limit 1.44W */
1162  /* CMD Response: R1 */
1163  sdmmc_cmdinit.Argument = Argument; /* SDMMC_SDR25_SWITCH_PATTERN;*/
1164  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_HS_SWITCH;
1165  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
1166  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
1167  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
1168  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
1169 
1170  /* Check for error conditions */
1171  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_HS_SWITCH, SDMMC_CMDTIMEOUT);
1172 
1173  return errorstate;
1174 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdVoltageSwitch()

uint32_t SDMMC_CmdVoltageSwitch ( SDMMC_TypeDef *  SDMMCx)

Send the command asking the accessed card to send its operating condition register (OCR)

Parameters
None
Return values
HALstatus

Definition at line 1183 of file stm32l4xx_ll_sdmmc.c.

1184 {
1185  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
1186  uint32_t errorstate;
1187 
1188  sdmmc_cmdinit.Argument = 0x00000000;
1189  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_VOLTAGE_SWITCH;
1190  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
1191  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
1192  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
1193  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
1194 
1195  /* Check for error conditions */
1196  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_VOLTAGE_SWITCH, SDMMC_CMDTIMEOUT);
1197 
1198  return errorstate;
1199 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdWriteMultiBlock()

uint32_t SDMMC_CmdWriteMultiBlock ( SDMMC_TypeDef *  SDMMCx,
uint32_t  WriteAdd 
)

Send the Write Multi Block command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
Return values
HALstatus

Definition at line 649 of file stm32l4xx_ll_sdmmc.c.

650 {
651  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
652  uint32_t errorstate;
653 
654  /* Set Block Size for Card */
655  sdmmc_cmdinit.Argument = (uint32_t)WriteAdd;
656  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_WRITE_MULT_BLOCK;
657  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
658  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
659  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
660  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
661 
662  /* Check for error conditions */
663  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_WRITE_MULT_BLOCK, SDMMC_CMDTIMEOUT);
664 
665  return errorstate;
666 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.

◆ SDMMC_CmdWriteSingleBlock()

uint32_t SDMMC_CmdWriteSingleBlock ( SDMMC_TypeDef *  SDMMCx,
uint32_t  WriteAdd 
)

Send the Write Single Block command and check the response.

Parameters
SDMMCxPointer to SDMMC register base
Return values
HALstatus

Definition at line 625 of file stm32l4xx_ll_sdmmc.c.

626 {
627  SDMMC_CmdInitTypeDef sdmmc_cmdinit;
628  uint32_t errorstate;
629 
630  /* Set Block Size for Card */
631  sdmmc_cmdinit.Argument = (uint32_t)WriteAdd;
632  sdmmc_cmdinit.CmdIndex = SDMMC_CMD_WRITE_SINGLE_BLOCK;
633  sdmmc_cmdinit.Response = SDMMC_RESPONSE_SHORT;
634  sdmmc_cmdinit.WaitForInterrupt = SDMMC_WAIT_NO;
635  sdmmc_cmdinit.CPSM = SDMMC_CPSM_ENABLE;
636  (void)SDMMC_SendCommand(SDMMCx, &sdmmc_cmdinit);
637 
638  /* Check for error conditions */
639  errorstate = SDMMC_GetCmdResp1(SDMMCx, SDMMC_CMD_WRITE_SINGLE_BLOCK, SDMMC_CMDTIMEOUT);
640 
641  return errorstate;
642 }
HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command)
Configure the SDMMC command path according to the specified parameters in SDMMC_CmdInitTypeDef struct...
static uint32_t SDMMC_GetCmdResp1(SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout)
Checks for error conditions for R1 response.
SDMMC Command Control structure.