2025-08-29 3:40 PM - edited 2025-08-29 3:41 PM
Hi everyone,
I’m working with a NUCLEO-F411RE board and I need to use USART2 (PA2=TX, PA3=RX) to communicate with a LoRa module (Reyax RYLR998).
The issue is: even though I configure USART2 in CubeMX, all data I send ends up on the COM9 (ST-LINK VCP) of my PC (USB micro connector), not on the physical pins PA2/PA3.
What I want:
Data should go out via PA2/PA3 → LoRa module.
But instead it always goes to the PC via COM9.
CubeMX configuration
USART2 enabled in Asynchronous mode.
PA2 assigned to USART2_TX, PA3 assigned to USART2_RX.
Baudrate = 115200, 8N1, no flow control.
SYS/Debug set to Serial Wire (not Trace Asynchronous SW).
printf redirection
No active redirection to ITM/SWV.
When using printf, I have _write function pointing to huart2:
SWV disabled
In CubeMX: Debug = Serial Wire only.
Not using ITM or ITM_SendChar.
Direct test in code
Configured PA2/PA3 manually as alternate function AF7 and tested:
→ The string still shows up on COM9, not on the LoRa module.
Registers checked in debugger
GPIOA->MODER shows AF mode for PA2/PA3.
GPIOA->AFR[0] = 7 for those pins.
USART2->CR1 is enabled.
Maybe printf redirection is still enabled towards ST-LINK VCP somehow.
On NUCLEO boards, solder bridges SB62/SB63 connect PA2/PA3 to the ST-LINK VCP, so maybe that’s why the PC always sees the data.
I’m not sure if it’s even possible to receive from an external sensor on USART2_RX (PA3) while those solder bridges remain connected, or if that would cause line conflicts with ST-LINK RX.
How can I force USART2 to use only the physical PA2/PA3 pins and not be redirected to COM9 (ST-LINK VCP)?
Is cutting SB62/SB63 really the only option, or is there a CubeMX/firmware configuration I’m missing?
If I connect a sensor to USART2_RX (PA3), will it conflict with ST-LINK RX and cause collisions?
Any advice on how to free PA2/PA3 for my LoRa module (ideally without losing COM9 debugging) would be very helpful.
Thanks in advance!
2025-08-29 4:29 PM
Hello @JaunAlejo and welcome to the ST Community.
The USART2 interface available on PA2 and PA3 of the STM32 microcontroller can be connected to ST-LINK MCU, ST morpho connector, or ARDUINO® connector. The choice can be changed by setting the related solder bridges. By default, the USART2 communication between the target STM32 and ST-LINK MCU is enabled, to support virtual COM port (SB13 and SB14 ON, SB62 and SB63 OFF). If the communication between the target STM32 PA2 (D1) or PA3 (DO) and shield or extension board is required, SB62 and SB63 must be ON, while SB13 and SB14 must be OFF. In such a case, it is possible to connect another USART to the ST-LINK MCU using flying wires between the ST morpho connector and CN3.
So, as a conclusion, to use the USART2 on physical PA2/PA3 pins, you have to solder the SB62 and SB63 and take off the SB13 and SB14.
Best Regards.
STTwo-32.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.