AN4989
7.2
Printf via UART
Direct connection from PC UART to board pinout does not work due to signal level
incompatibility.
Take care to use external adapter (such as MAX232, ST3241EB, FTDI USB/UART) or the
USART connected to Virtual COM port.
Trick:
The straight-forward way to set a Serial Com port with PC host is to use the USART
connected to VCP.
USART connected to VCP depends on the hardware kit:
•
Nucleo-32/Nucleo-64: USART2 - PA2/PA3
•
Nucleo-144: USART3 - PA9/PA10
•
Discovery: not standard. Refer to the board schematics
•
EVAL: not standard. Refer to the board schematics. Either the VCP or the RS232
connector can be used
In STM32CubeMX, for Nucleo board, the VCP USART pins (PA2/PA3) are reserved by
default, but required to be enabled by selecting "asynchronous" in USART mode selection
box as shown in
Figure 48. USART Pinout configuration with STM32CubeMX
Then, set the UART communication settings in Configuration -> USART2 Configuration
-> Parameter Settings as shown in
Appendix B: Use Nucleo "cuttable" ST-LINK as stand-alone VCP on page 106
explains how to use ST-LINK Nucleo stand-alone part as VCP.
Figure
48.
Figure
49.
AN4989 Rev 3
Printf debugging
69/118
117
Need help?
Do you have a question about the STM32 and is the answer not in the manual?