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 | STM32L496G-DISCO |
| USART Peripheral | USART1 |
| USART Mode | SmartCard |
| TX Pin | PB6 |
For different boards, refer to the hardware schematics to reflect correct setup values.
The STM32CubeMX configuration for STM32L496G-DISCO with steps for Pinout, Clock, and System Configuration are listed below. Enter the values that are marked bold.
Pinout tab
- Configure USART1 mode
- Peripherals USART1: Mode=SmartCard
Clock Configuration tab
- Configure USART1 Clock.
Configuration tab
- Under Connectivity open USART1 Configuration:
- optional DMA Settings: setup DMA transfers for Rx and Tx (DMA is optional)
Add - Select USART1_RX: Stream=DMA1 Channel 5, DMA Request Settings: not used
Add - Select USART1_TX: Stream=DMA1 Channel 4, DMA Request Settings: not used
- GPIO Settings: review settings, no changes required
| Pin Name | Signal on Pin | GPIO mode | GPIO Pull-up/Pull.. | Maximum out | User Label |
| PB6 | USART1_TX | Alternate | Pull-up | Very High | . |
- NVIC Settings: enable interrupts
| Interrupt Table | Enable | Preemption Priority | Sub Priority |
| USART1 global interrupt | ON | 0 | 0 |
| DMA1 stream5 global interrupt | ON | 0 | 0 |
| DMA1 stream4 global interrupt | ON | 0 | 0 |
- Parameter Settings: not used
- User Constants: not used
- Click OK to close the USART1 Configuration dialog
- Open Project - Settings - Advanced Settings from the menu and enable "Not Generate Function call" for MX_USART1_SMARTCARD_Init