STM32F4xx_HAL_Driver  1.8.3
SmartCard Initialization and de-initialization functions

Initialization and Configuration functions. More...

+ Collaboration diagram for SmartCard Initialization and de-initialization functions:

Functions

HAL_StatusTypeDef HAL_SMARTCARD_Init (SMARTCARD_HandleTypeDef *hsc)
 Initializes the SmartCard mode according to the specified parameters in the SMARTCARD_InitTypeDef and create the associated handle. More...
 
HAL_StatusTypeDef HAL_SMARTCARD_ReInit (SMARTCARD_HandleTypeDef *hsc)
 
HAL_StatusTypeDef HAL_SMARTCARD_DeInit (SMARTCARD_HandleTypeDef *hsc)
 DeInitializes the USART SmartCard peripheral. More...
 
void HAL_SMARTCARD_MspInit (SMARTCARD_HandleTypeDef *hsc)
 SMARTCARD MSP Init. More...
 
void HAL_SMARTCARD_MspDeInit (SMARTCARD_HandleTypeDef *hsc)
 SMARTCARD MSP DeInit. More...
 
HAL_StatusTypeDef HAL_SMARTCARD_RegisterCallback (SMARTCARD_HandleTypeDef *hsc, HAL_SMARTCARD_CallbackIDTypeDef CallbackID, pSMARTCARD_CallbackTypeDef pCallback)
 Register a User SMARTCARD Callback To be used instead of the weak predefined callback. More...
 
HAL_StatusTypeDef HAL_SMARTCARD_UnRegisterCallback (SMARTCARD_HandleTypeDef *hsc, HAL_SMARTCARD_CallbackIDTypeDef CallbackID)
 Unregister an SMARTCARD callback SMARTCARD callback is redirected to the weak predefined callback. More...
 

Detailed Description

Initialization and Configuration functions.

  ==============================================================================
              ##### Initialization and Configuration functions #####
  ==============================================================================
  [..]
  This subsection provides a set of functions allowing to initialize the USART
  in Smartcard mode.
  [..]
  The Smartcard interface is designed to support asynchronous protocol Smartcards as
  defined in the ISO 7816-3 standard.
  [..]
  The USART can provide a clock to the smartcard through the SCLK output.
  In smartcard mode, SCLK is not associated to the communication but is simply derived
  from the internal peripheral input clock through a 5-bit prescaler.
  [..]
  (+) For the Smartcard mode only these parameters can be configured:
      (++) Baud Rate
      (++) Word Length => Should be 9 bits (8 bits + parity)
      (++) Stop Bit
      (++) Parity: => Should be enabled
      (++) USART polarity
      (++) USART phase
      (++) USART LastBit
      (++) Receiver/transmitter modes
      (++) Prescaler
      (++) GuardTime
      (++) NACKState: The Smartcard NACK state

     (+) Recommended SmartCard interface configuration to get the Answer to Reset from the Card:
        (++) Word Length = 9 Bits
        (++) 1.5 Stop Bit
        (++) Even parity
        (++) BaudRate = 12096 baud
        (++) Tx and Rx enabled
  [..]
  Please refer to the ISO 7816-3 specification for more details.

  [..]
   (@) It is also possible to choose 0.5 stop bit for receiving but it is recommended
       to use 1.5 stop bits for both transmitting and receiving to avoid switching
       between the two configurations.
  [..]
    The HAL_SMARTCARD_Init() function follows the USART  SmartCard configuration
    procedures (details for the procedures are available in reference manual
    (RM0430 for STM32F4X3xx MCUs and RM0402 for STM32F412xx MCUs
     RM0383 for STM32F411xC/E MCUs and RM0401 for STM32F410xx MCUs
     RM0090 for STM32F4X5xx/STM32F4X7xx/STM32F429xx/STM32F439xx MCUs
     RM0390 for STM32F446xx MCUs and RM0386 for STM32F469xx/STM32F479xx MCUs)).

The SMARTCARD frame format is given in the following table: +----------------------------------------------------------—+ | M bit | PCE bit | SMARTCARD frame | |------------------—|------------------------------------—| | 1 | 1 | | SB | 8 bit data | PB | STB | | +----------------------------------------------------------—+

Function Documentation

◆ HAL_SMARTCARD_DeInit()

HAL_StatusTypeDef HAL_SMARTCARD_DeInit ( SMARTCARD_HandleTypeDef hsc)

DeInitializes the USART SmartCard peripheral.

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

Definition at line 378 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_Init()

HAL_StatusTypeDef HAL_SMARTCARD_Init ( SMARTCARD_HandleTypeDef hsc)

Initializes the SmartCard mode according to the specified parameters in the SMARTCARD_InitTypeDef and create the associated handle.

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

Definition at line 299 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_MspDeInit()

__weak void HAL_SMARTCARD_MspDeInit ( SMARTCARD_HandleTypeDef hsc)

SMARTCARD MSP DeInit.

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

Definition at line 438 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_MspInit()

__weak void HAL_SMARTCARD_MspInit ( SMARTCARD_HandleTypeDef hsc)

SMARTCARD MSP Init.

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

Definition at line 422 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_RegisterCallback()

HAL_StatusTypeDef HAL_SMARTCARD_RegisterCallback ( SMARTCARD_HandleTypeDef hsc,
HAL_SMARTCARD_CallbackIDTypeDef  CallbackID,
pSMARTCARD_CallbackTypeDef  pCallback 
)

Register a User SMARTCARD Callback To be used instead of the weak predefined callback.

Note
The HAL_SMARTCARD_RegisterCallback() may be called before HAL_SMARTCARD_Init() in HAL_SMARTCARD_STATE_RESET to register callbacks for HAL_SMARTCARD_MSPINIT_CB_ID and HAL_SMARTCARD_MSPDEINIT_CB_ID
Parameters
hscsmartcard handle
CallbackIDID of the callback to be registered This parameter can be one of the following values:
pCallbackpointer to the Callback function
Return values
HALstatus

Definition at line 469 of file stm32f4xx_hal_smartcard.c.

◆ HAL_SMARTCARD_UnRegisterCallback()

HAL_StatusTypeDef HAL_SMARTCARD_UnRegisterCallback ( SMARTCARD_HandleTypeDef hsc,
HAL_SMARTCARD_CallbackIDTypeDef  CallbackID 
)

Unregister an SMARTCARD callback SMARTCARD callback is redirected to the weak predefined callback.

Note
The HAL_SMARTCARD_UnRegisterCallback() may be called before HAL_SMARTCARD_Init() in HAL_SMARTCARD_STATE_RESET to un-register callbacks for HAL_SMARTCARD_MSPINIT_CB_ID and HAL_SMARTCARD_MSPDEINIT_CB_ID
Parameters
hscsmartcard handle
CallbackIDID of the callback to be unregistered This parameter can be one of the following values:
Return values
HALstatus

Definition at line 580 of file stm32f4xx_hal_smartcard.c.