STM32Cube  Version 2.0
Create Projects for STM32L0 Series with STM32Cube HAL and STM32CubeMX
 All Files Pages
CMSIS-Driver USART Setup in SmartCard mode

The CMSIS-Driver USART requires:

  • Setup of USART/UART peripheral in SmartCard mode

For different boards, refer to the hardware schematics to reflect correct setup values.

The STM32CubeMX configuration example with steps for Pinout, Clock, and System Configuration are listed below. Enter the values that are marked bold.

Pinout tab

  1. Configure peripheral
    • Peripherals USART2: Mode=SmartCard
  2. Configure pins PA2 and PD7 as USART2 peripheral alternative pins
    • Click in chip diagram on pin PA2 and select USART2_TX
    • Click in chip diagram on pin PD7 and select USART2_CK

Clock Configuration tab

  1. Configure USART2 Clock

Configuration tab

  1. Under Connectivity open USART2 Configuration:
    • Parameter Settings: not used
    • User Constants: not used
    • NVIC Settings: enable interrupts
      Interrupt Table Enabled Preemption Priority
      DMA1 channel 4, channel 5, channel 6 and..ON 0
      USART2 global interrupt / USART2 wake-up..ON 0
    • optional DMA Settings: setup DMA transfers for Rx and Tx (DMA is optional)
      Add - Select USART2_RX: Stream=DMA1 Channel 5, DMA Request Settings: not used, Priority=Low
      Add - Select USART2_TX: Stream=DMA1 Channel 4, DMA Request Settings: not used, Priority=Low
    • GPIO Settings: review settings, no changes required
      Pin Name Signal on Pin GPIO output..GPIO mode GPIO Pull-up/Pull..Maximum out Fast Mode User Label
      PA2 USART2_TX n/a Alternate ..Pull-up Very High n/a .
      PD7 USART2_CK n/a Alternate ..Pull-up Very High n/a .
      Click OK to close the USART2 Configuration dialog