STM32Cube  Version 2.0
Create Projects for STM32U5 Series with STM32Cube HAL and STM32CubeMX
CMSIS-Driver USART Setup in SmartCard mode

The CMSIS-Driver USART requires:

  • Setup of USART/UART peripheral in SmartCard mode

Valid settings for various evaluation boards are listed in the table below:

Peripheral Resource B-U585I-IOT02A (PMOD CN4)
USART Peripheral USART2
USART Mode SmartCard
TX Pin PA2

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

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

Pinout view

  1. Configure USART2 pins
    • PA2: USART2_TX

Pinout & Configuration tab

  1. Under Connectivity open USART2:
    • Section Mode
      • Mode: SmartCard
    • Section Configuration
      • Parameter Settings: not used
      • User Constants: not used
      • NVIC Settings: configured later
      • DMA Settings: configured with GPDMA1
      • GPIO Settings: check used pins

  2. Under System Core open GPIO:
    • Group By Peripherals - USART:
      Pin Name Signal on Pin GPIO mode GPIO Pull-up/Pull.. Maximum out..
      PA2 USART2_TX Alternate F.. No pull-up and no.. Very High

  3. Under System Core open GPDMA1:
    • Section Mode
      • Channel 0: Standard Request Mode
    • Section Configuration
      • CH0
        • Request Configuration - Request: USART2_TX
        • Channel configuration - Direction: Memory to Peripheral
        • Source Data Setting - Source Address Inc..: Enabled
        • Source Data Setting - Data Width: Byte
        • Destination Data Setting - Destination Address Inc..: Disabled
        • Destination Data Setting - Data Width: Byte

  4. Under System Core open NVIC:
    • Section Configuration
      • NVIC
        NVIC Interrupt Table Enable Preemption Priority Sub Priority
        GPDMA1 Channel 0 global interrupt ON 0 0
        USART2 global interrupt ON 0 0

Clock Configuration tab

  1. Configure USART2 Clock.

Project Manager tab

  1. Open Advanced Settings:
    • enable Do Not Generate Function Call for MX_USART2_SMARTCARD_Init.
Note
The CMSIS Driver:USART (API):USART component in the Manage Run-Time Environment dialog adds multiple C source files to the project. The interface selection in STM32CubeMX selects the actual implementation that is compiled: IrDA, SmartCard, UART, or USART.