Re-routing of the C library printf function to the UART. The UART outputs a message on the HyperTerminal.
Board: NUCLEO-C031C6
LED4 toggles when there is an error.
The USART is configured as follows:
- BaudRate = 115200 baud
- Word Length = 8 Bits (7 data bit + 1 parity bit)
- One Stop Bit
- Odd parity
- Hardware flow control disabled (RTS and CTS signals)
- Reception and transmission are enabled in the time
When the parity is enabled, the computed parity is inserted at the MSB position of the transmitted data.
Care must be taken when using HAL_Delay(), this function provides accurate delay (in milliseconds) based on variable incremented in SysTick ISR. This implies that if HAL_Delay() is called from a peripheral ISR process, then the SysTick interrupt must have higher priority (numerically lower) than the peripheral interrupt. Otherwise the caller ISR process will be blocked. To change the SysTick interrupt priority you have to use HAL_NVIC_SetPriority() function.
The application needs to ensure that the SysTick time base is always set to 1 millisecond to have correct HAL operation.
Connectivity, UART/USART, Printf, baud rate, RS-232, HyperTerminal, full-duplex, Interrupt, Transmitter, Receiver, Asynchronous
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 Connect ST-Link cable to the PC USB port to display data on the HyperTerminal. A virtual COM port will then appear in the HyperTerminal.
Hyperterminal configuration:
In order to make the program work, you must do the following :