This example shows how to configure GPIO and USART peripheral to send characters asynchronously to/from an HyperTerminal (PC) in DMA mode. This example is based on STM32C0xx USART LL API. Peripheral initialization is done using LL unitary services functions for optimization purpose (performance and size).
USART Peripheral is configured in asynchronous mode (115200 bauds, 8 data bit, 1 start bit, 1 stop bit, no parity). No HW flow control is used.
GPIO associated to User push-button is linked with EXTI. Virtual Com port feature of STLINK is used for UART communication between board and PC.
Example execution:
After startup from reset and system configuration, LED4 is blinking quickly and wait User push-button action. USART and DMA are configured. On press on push button , TX DMA transfer to PC is initiated. RX DMA transfer is also ready to retrieve characters from PC (“END” string is expected to be entered by user on PC side (HyperTerminal).
In case of both transfers successfully completed, LED4 is turned on.
In case of errors, LED4 is blinking (1sec period).
Connectivity, UART/USART, Asynchronous, RS-232, baud rate, DMA, HyperTerminal, Transmitter, Receiver
This example runs on STM32C031C6Tx devices.
This example has been tested with NUCLEO-C031C6 board and can be easily tailored to any other supported device and development board.
NUCLEO-C031C6 Set-up :
In order use of Virtual Com port feature of STLINK for connection between NUCLEO-C031C6 and PC, please ensure that USART communication between the target MCU and ST-LINK MCU is properly enabled on HW board in order to support Virtual Com Port (Default HW SB configuration allows use of VCP)
Launch serial communication SW on PC (as HyperTerminal or TeraTerm) with proper configuration (115200 bauds, 8 bits data, 1 stop bit, no parity, no HW flow control).
Launch the program. Press on User push button on board to initiate data transfer.
In order to make the program work, you must do the following :