Intention
By default the UART2 is connected to the virtual COM of the ST-Link. The same UART is possible to connect to the Arduino connector.
So I want to connect the UART3 to the virtual COM connector and use the UART2 for the Arduino connector (CN9 Pin 1 and 2),
The description is for an Nucleo-64 STM32L476, but should be compatible to some more Nucleo-64 boards, too.
Hardware changes
Switch UART2 to the Arduino connector
- open solder bridge SB13 and SB14
- close solder bridge SB62 and SB63
Switch UART3 to the VCOM of the ST-Link
- connect ST-Link connector TX to PC5 (Uart3 RX, CN10 pin 6)
- connect ST-Link connector RX to PC4 (Uart3 TX, CN10 pin 34)
Software changes
- initialize UART3 (e.g. 115200 Baud, 8N1) with PC4 and PC5
- in case you want to use printf
int __io_putchar(int ch) { HAL_UART_Transmit(&huart3, (uint8_t *)&ch, 1, 0xFFFF); //ITM_SendChar(ch); return ch; }
- alternatively overwrite _write()