STM32Cube  Version 2.0
Create Projects for STM32G4 Series with STM32Cube HAL and STM32CubeMX
CMSIS-Driver USART

History

  • Version 1.1
    • Version synchronized with USART driver component version
  • Version 1.0
    • Initial release

Instances

Hardware resource relating to CMSIS-Driver instance is shown in the table below:

Driver Instance Hardware Resource
Driver_USART1 USART1
Driver_USART2 USART2
Driver_USART3 USART3

Limitations

STM32 HAL limitations:

  • Rx Overflow event can be detected only when send/receive/transfer operation is active

STM32CubeMX Setup

The CMSIS-Driver USART requires:

  • Setup of USART in Synchronous mode

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

Peripheral Resource NUCLEO-G474RE
USART Peripheral USART1
USART Mode Synchronous Master
TX Pin PC4
RX Pin PC5
CK Pin PA8

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

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

Pinout view

  1. Configure USART1 pins
    • PC4: USART1_TX
    • PC5: USART1_RX
    • PA8: USART1_CK

Pinout & Configuration tab

  1. Under Connectivity open USART1:
    • Section Mode
      • Mode: Synchronous Master
    • Section Configuration
      • Parameter Settings: not used
      • User Constants: not used
      • NVIC Settings: configured later
      • DMA Settings: configured with DMA
      • 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.. User Label
      PC4 USART1_TX Alternate F.. No pull-up and no.. Very High .
      PC5 USART1_RX Alternate F.. No pull-up and no.. Very High .
      PA8 USART1_CK Alternate F.. No pull-up and no.. Very High .
  3. Under System Core open DMA:
    • Section Configuration
      • DMA1, DMA2
        • Click on Add button and add requests as in table below:
          DMA Request Channel Direction Priority
          USART1_RX DMA1 Channel 1 Peripheral to Memory Low
          USART1_TX DMA1 Channel 2 Memory to Peripheral Low
  4. Under System Core open NVIC:
    • Section Configuration
      • NVIC
        NVIC Interrupt Table Enabled Preemption Priority Sub Priority
        DMA1 channel1 global interrupt ON 0 0
        DMA1 channel2 global interrupt ON 0 0
        USART1 global interrupt ON 0 0

Clock Configuration tab

  1. Configure USART1 Clock.

Project Manager tab

  1. Open Advanced Settings:
    • enable Do Not Generate Function Call for MX_USART1_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.