STM32F4xx_HAL_Driver  1.8.3

SMARTCARD Transmit and Receive functions. More...

+ Collaboration diagram for IO operation functions:

Functions

HAL_StatusTypeDef HAL_SMARTCARD_Transmit (SMARTCARD_HandleTypeDef *hsc, const uint8_t *pData, uint16_t Size, uint32_t Timeout)
 Send an amount of data in blocking mode. More...
 
HAL_StatusTypeDef HAL_SMARTCARD_Receive (SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size, uint32_t Timeout)
 Receive an amount of data in blocking mode. More...
 
HAL_StatusTypeDef HAL_SMARTCARD_Transmit_IT (SMARTCARD_HandleTypeDef *hsc, const uint8_t *pData, uint16_t Size)
 Send an amount of data in non blocking mode. More...
 
HAL_StatusTypeDef HAL_SMARTCARD_Receive_IT (SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size)
 Receive an amount of data in non blocking mode. More...
 
HAL_StatusTypeDef HAL_SMARTCARD_Transmit_DMA (SMARTCARD_HandleTypeDef *hsc, const uint8_t *pData, uint16_t Size)
 Send an amount of data in non blocking mode. More...
 
HAL_StatusTypeDef HAL_SMARTCARD_Receive_DMA (SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size)
 Receive an amount of data in non blocking mode. More...
 
HAL_StatusTypeDef HAL_SMARTCARD_Abort (SMARTCARD_HandleTypeDef *hsc)
 Abort ongoing transfers (blocking mode). More...
 
HAL_StatusTypeDef HAL_SMARTCARD_AbortTransmit (SMARTCARD_HandleTypeDef *hsc)
 Abort ongoing Transmit transfer (blocking mode). More...
 
HAL_StatusTypeDef HAL_SMARTCARD_AbortReceive (SMARTCARD_HandleTypeDef *hsc)
 Abort ongoing Receive transfer (blocking mode). More...
 
HAL_StatusTypeDef HAL_SMARTCARD_Abort_IT (SMARTCARD_HandleTypeDef *hsc)
 Abort ongoing transfers (Interrupt mode). More...
 
HAL_StatusTypeDef HAL_SMARTCARD_AbortTransmit_IT (SMARTCARD_HandleTypeDef *hsc)
 Abort ongoing Transmit transfer (Interrupt mode). More...
 
HAL_StatusTypeDef HAL_SMARTCARD_AbortReceive_IT (SMARTCARD_HandleTypeDef *hsc)
 Abort ongoing Receive transfer (Interrupt mode). More...
 
void HAL_SMARTCARD_IRQHandler (SMARTCARD_HandleTypeDef *hsc)
 This function handles SMARTCARD interrupt request. More...
 
void HAL_SMARTCARD_TxCpltCallback (SMARTCARD_HandleTypeDef *hsc)
 Tx Transfer completed callbacks. More...
 
void HAL_SMARTCARD_RxCpltCallback (SMARTCARD_HandleTypeDef *hsc)
 Rx Transfer completed callback. More...
 
void HAL_SMARTCARD_ErrorCallback (SMARTCARD_HandleTypeDef *hsc)
 SMARTCARD error callback. More...
 
void HAL_SMARTCARD_AbortCpltCallback (SMARTCARD_HandleTypeDef *hsc)
 SMARTCARD Abort Complete callback. More...
 
void HAL_SMARTCARD_AbortTransmitCpltCallback (SMARTCARD_HandleTypeDef *hsc)
 SMARTCARD Abort Transmit Complete callback. More...
 
void HAL_SMARTCARD_AbortReceiveCpltCallback (SMARTCARD_HandleTypeDef *hsc)
 SMARTCARD Abort Receive Complete callback. More...
 

Detailed Description

SMARTCARD Transmit and Receive functions.

 ===============================================================================
                      ##### IO operation functions #####
 ===============================================================================
 [..]
   This subsection provides a set of functions allowing to manage the SMARTCARD data transfers.

 [..]
    (#) Smartcard is a single wire half duplex communication protocol.
    The Smartcard interface is designed to support asynchronous protocol Smartcards as
    defined in the ISO 7816-3 standard.
    (#) The USART should be configured as:
       (++) 8 bits plus parity: where M=1 and PCE=1 in the USART_CR1 register
       (++) 1.5 stop bits when transmitting and receiving: where STOP=11 in the USART_CR2 register.

    (#) There are two modes of transfer:
       (++) Blocking mode: The communication is performed in polling mode.
            The HAL status of all data processing is returned by the same function
            after finishing transfer.
       (++) Non Blocking mode: The communication is performed using Interrupts
           or DMA, These APIs return the HAL status.
           The end of the data processing will be indicated through the
           dedicated SMARTCARD IRQ when using Interrupt mode or the DMA IRQ when
           using DMA mode.
           The HAL_SMARTCARD_TxCpltCallback(), HAL_SMARTCARD_RxCpltCallback() user callbacks
           will be executed respectively at the end of the Transmit or Receive process
           The HAL_SMARTCARD_ErrorCallback() user callback will be executed when a communication error is detected

    (#) Blocking mode APIs are :
        (++) HAL_SMARTCARD_Transmit()
        (++) HAL_SMARTCARD_Receive()

    (#) Non Blocking mode APIs with Interrupt are :
        (++) HAL_SMARTCARD_Transmit_IT()
        (++) HAL_SMARTCARD_Receive_IT()
        (++) HAL_SMARTCARD_IRQHandler()

    (#) Non Blocking mode functions with DMA are :
        (++) HAL_SMARTCARD_Transmit_DMA()
        (++) HAL_SMARTCARD_Receive_DMA()

    (#) A set of Transfer Complete Callbacks are provided in non Blocking mode:
        (++) HAL_SMARTCARD_TxCpltCallback()
        (++) HAL_SMARTCARD_RxCpltCallback()
        (++) HAL_SMARTCARD_ErrorCallback()

    (#) Non-Blocking mode transfers could be aborted using Abort API's :
        (+) HAL_SMARTCARD_Abort()
        (+) HAL_SMARTCARD_AbortTransmit()
        (+) HAL_SMARTCARD_AbortReceive()
        (+) HAL_SMARTCARD_Abort_IT()
        (+) HAL_SMARTCARD_AbortTransmit_IT()
        (+) HAL_SMARTCARD_AbortReceive_IT()

    (#) For Abort services based on interrupts (HAL_SMARTCARD_Abortxxx_IT), a set of Abort Complete Callbacks are provided:
        (+) HAL_SMARTCARD_AbortCpltCallback()
        (+) HAL_SMARTCARD_AbortTransmitCpltCallback()
        (+) HAL_SMARTCARD_AbortReceiveCpltCallback()

    (#) In Non-Blocking mode transfers, possible errors are split into 2 categories.
        Errors are handled as follows :
       (+) Error is considered as Recoverable and non blocking : Transfer could go till end, but error severity is
           to be evaluated by user : this concerns Frame Error, Parity Error or Noise Error in Interrupt mode reception .
           Received character is then retrieved and stored in Rx buffer, Error code is set to allow user to identify error type,
           and HAL_SMARTCARD_ErrorCallback() user callback is executed. Transfer is kept ongoing on SMARTCARD side.
           If user wants to abort it, Abort services should be called by user.
       (+) Error is considered as Blocking : Transfer could not be completed properly and is aborted.
           This concerns Frame Error in Interrupt mode transmission, Overrun Error in Interrupt mode reception and all errors in DMA mode.
           Error code is set to allow user to identify error type, and HAL_SMARTCARD_ErrorCallback() user callback is executed.

Function Documentation

◆ HAL_SMARTCARD_Abort()

HAL_StatusTypeDef HAL_SMARTCARD_Abort ( SMARTCARD_HandleTypeDef hsc)

Abort ongoing transfers (blocking mode).

Parameters
hscSMARTCARD handle.
Note
This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode. This procedure performs following operations :
  • Disable PPP Interrupts
  • Disable the DMA transfer in the peripheral register (if enabled)
  • Abort DMA transfer by calling HAL_DMA_Abort (in case of transfer in DMA mode)
  • Set handle State to READY
This procedure is executed in blocking mode : when exiting function, Abort is considered as completed.
Return values
HALstatus

Definition at line 1099 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_Abort_IT()

HAL_StatusTypeDef HAL_SMARTCARD_Abort_IT ( SMARTCARD_HandleTypeDef hsc)

Abort ongoing transfers (Interrupt mode).

Parameters
hscSMARTCARD handle.
Note
This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode. This procedure performs following operations :
  • Disable PPP Interrupts
  • Disable the DMA transfer in the peripheral register (if enabled)
  • Abort DMA transfer by calling HAL_DMA_Abort_IT (in case of transfer in DMA mode)
  • Set handle State to READY
  • At abort completion, call user abort complete callback
This procedure is executed in Interrupt mode, meaning that abort procedure could be considered as completed only when user abort complete callback is executed (not when exiting function).
Return values
HALstatus

Definition at line 1250 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_AbortCpltCallback()

__weak void HAL_SMARTCARD_AbortCpltCallback ( SMARTCARD_HandleTypeDef hsc)

SMARTCARD Abort Complete callback.

Parameters
hscSMARTCARD handle.
Return values
None

Definition at line 1713 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_AbortReceive()

HAL_StatusTypeDef HAL_SMARTCARD_AbortReceive ( SMARTCARD_HandleTypeDef hsc)

Abort ongoing Receive transfer (blocking mode).

Parameters
hscSMARTCARD handle.
Note
This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode. This procedure performs following operations :
  • Disable PPP Interrupts
  • Disable the DMA transfer in the peripheral register (if enabled)
  • Abort DMA transfer by calling HAL_DMA_Abort (in case of transfer in DMA mode)
  • Set handle State to READY
This procedure is executed in blocking mode : when exiting function, Abort is considered as completed.
Return values
HALstatus

Definition at line 1205 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_AbortReceive_IT()

HAL_StatusTypeDef HAL_SMARTCARD_AbortReceive_IT ( SMARTCARD_HandleTypeDef hsc)

Abort ongoing Receive transfer (Interrupt mode).

Parameters
hscSMARTCARD handle.
Note
This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode. This procedure performs following operations :
  • Disable SMARTCARD Interrupts (Rx)
  • Disable the DMA transfer in the peripheral register (if enabled)
  • Abort DMA transfer by calling HAL_DMA_Abort_IT (in case of transfer in DMA mode)
  • Set handle State to READY
  • At abort completion, call user abort complete callback
This procedure is executed in Interrupt mode, meaning that abort procedure could be considered as completed only when user abort complete callback is executed (not when exiting function).
Return values
HALstatus

Definition at line 1454 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_AbortReceiveCpltCallback()

__weak void HAL_SMARTCARD_AbortReceiveCpltCallback ( SMARTCARD_HandleTypeDef hsc)

SMARTCARD Abort Receive Complete callback.

Parameters
hscSMARTCARD handle.
Return values
None

Definition at line 1743 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_AbortTransmit()

HAL_StatusTypeDef HAL_SMARTCARD_AbortTransmit ( SMARTCARD_HandleTypeDef hsc)

Abort ongoing Transmit transfer (blocking mode).

Parameters
hscSMARTCARD handle.
Note
This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode. This procedure performs following operations :
  • Disable SMARTCARD Interrupts (Tx)
  • Disable the DMA transfer in the peripheral register (if enabled)
  • Abort DMA transfer by calling HAL_DMA_Abort (in case of transfer in DMA mode)
  • Set handle State to READY
This procedure is executed in blocking mode : when exiting function, Abort is considered as completed.
Return values
HALstatus

Definition at line 1163 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_AbortTransmit_IT()

HAL_StatusTypeDef HAL_SMARTCARD_AbortTransmit_IT ( SMARTCARD_HandleTypeDef hsc)

Abort ongoing Transmit transfer (Interrupt mode).

Parameters
hscSMARTCARD handle.
Note
This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode. This procedure performs following operations :
  • Disable SMARTCARD Interrupts (Tx)
  • Disable the DMA transfer in the peripheral register (if enabled)
  • Abort DMA transfer by calling HAL_DMA_Abort_IT (in case of transfer in DMA mode)
  • Set handle State to READY
  • At abort completion, call user abort complete callback
This procedure is executed in Interrupt mode, meaning that abort procedure could be considered as completed only when user abort complete callback is executed (not when exiting function).
Return values
HALstatus

Definition at line 1377 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_AbortTransmitCpltCallback()

__weak void HAL_SMARTCARD_AbortTransmitCpltCallback ( SMARTCARD_HandleTypeDef hsc)

SMARTCARD Abort Transmit Complete callback.

Parameters
hscSMARTCARD handle.
Return values
None

Definition at line 1728 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_ErrorCallback()

__weak void HAL_SMARTCARD_ErrorCallback ( SMARTCARD_HandleTypeDef hsc)

SMARTCARD error callback.

Parameters
hscPointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module.
Return values
None

Definition at line 1698 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_IRQHandler()

void HAL_SMARTCARD_IRQHandler ( SMARTCARD_HandleTypeDef hsc)

This function handles SMARTCARD interrupt request.

Parameters
hscPointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module.
Return values
None

Definition at line 1524 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_Receive()

HAL_StatusTypeDef HAL_SMARTCARD_Receive ( SMARTCARD_HandleTypeDef hsc,
uint8_t *  pData,
uint16_t  Size,
uint32_t  Timeout 
)

Receive an amount of data in blocking mode.

Parameters
hscPointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module.
pDataPointer to data buffer
SizeAmount of data to be received
TimeoutTimeout duration
Return values
HALstatus

Definition at line 816 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_Receive_DMA()

HAL_StatusTypeDef HAL_SMARTCARD_Receive_DMA ( SMARTCARD_HandleTypeDef hsc,
uint8_t *  pData,
uint16_t  Size 
)

Receive an amount of data in non blocking mode.

Parameters
hscPointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module.
pDataPointer to data buffer
SizeAmount of data to be received
Note
When the SMARTCARD parity is enabled (PCE = 1) the data received contain the parity bit.s
Return values
HALstatus

Definition at line 1029 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_Receive_IT()

HAL_StatusTypeDef HAL_SMARTCARD_Receive_IT ( SMARTCARD_HandleTypeDef hsc,
uint8_t *  pData,
uint16_t  Size 
)

Receive an amount of data in non blocking mode.

Parameters
hscPointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module.
pDataPointer to data buffer
SizeAmount of data to be received
Return values
HALstatus

Definition at line 922 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_RxCpltCallback()

__weak void HAL_SMARTCARD_RxCpltCallback ( SMARTCARD_HandleTypeDef hsc)

Rx Transfer completed callback.

Parameters
hscPointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module.
Return values
None

Definition at line 1682 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_Transmit()

HAL_StatusTypeDef HAL_SMARTCARD_Transmit ( SMARTCARD_HandleTypeDef hsc,
const uint8_t *  pData,
uint16_t  Size,
uint32_t  Timeout 
)

Send an amount of data in blocking mode.

Parameters
hscPointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module.
pDataPointer to data buffer
SizeAmount of data to be sent
TimeoutTimeout duration
Return values
HALstatus

Definition at line 754 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_Transmit_DMA()

HAL_StatusTypeDef HAL_SMARTCARD_Transmit_DMA ( SMARTCARD_HandleTypeDef hsc,
const uint8_t *  pData,
uint16_t  Size 
)

Send an amount of data in non blocking mode.

Parameters
hscPointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module.
pDataPointer to data buffer
SizeAmount of data to be sent
Return values
HALstatus

Definition at line 967 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_Transmit_IT()

HAL_StatusTypeDef HAL_SMARTCARD_Transmit_IT ( SMARTCARD_HandleTypeDef hsc,
const uint8_t *  pData,
uint16_t  Size 
)

Send an amount of data in non blocking mode.

Parameters
hscPointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module.
pDataPointer to data buffer
SizeAmount of data to be sent
Return values
HALstatus

Definition at line 874 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_TxCpltCallback()

__weak void HAL_SMARTCARD_TxCpltCallback ( SMARTCARD_HandleTypeDef hsc)

Tx Transfer completed callbacks.

Parameters
hscPointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module.
Return values
None

Definition at line 1666 of file stm32f4xx_hal_smartcard.c.