2024-11-07 09:14 AM
It can be especially useful during code development to display messages in a terminal window about various system parameters to help with debugging. An easy way to do that is to use the printf function and redirect the output to a UART for display in a terminal window.
The ST-LINKs embedded on ST Nucleo boards have a virtual com port feature, and we can easily get debugging information on a terminal using printf redirected to the UART of the STM32 connected to the ST-LINK pins used for the virtual COM port.
2024-11-07 09:14 AM
How to redirect the printf function to a UART for debug messagesIt can be especially useful during code development to display messages in a terminal window about various system parameters to help with debugging. An easy way to do that is to use the printf function and redirect the output to a UART for display in a terminal window.
The ST-LINKs embedded on ST Nucleo boards have a virtual com port feature, and we can easily get debugging information on a terminal using printf redirected to the UART of the STM32 connected to the ST-LINK pins used for the virtual COM port.
2024-11-07 09:18 AM - edited 2024-11-07 09:22 AM
Are you asking a question, or just making an observation (twice)?
The first thing to do - before worrying about printf - is to get the basic UART comms working:
Once that is done, then - and only then - move on to redirecting printf:
And here's a 3rd-party article on the same: