STM32 – Wiring STM32 Nucleo UART2 to UART3 Pins

nucleostm32uart

I am exploring UARTs on the STM32F103RB on a nucleo board. The board is connected via USB to my laptop, and I can send/receive messages using the HAL_UART_Transmit_IT and HAL_UART_Receive_IT functions.

What I am actually failing to do, is send a message from UART2 to UART3. I wired as follows:

  • UART2 TX (PA2) => UART3 RX (PB11)
  • UART2 RX (PA3) => UART3 TX (PB10)

Then I send a transmit an array of 2 bytes from UART2 to UART3, but the interrupt handler never fires.

So I thought to isolate the problem further, and just connect RX to RX and TX to TX, so that the signals to UART2 are "mirrored" to UART3.

Wiring as follows:

  • UART2 TX (PA2) => UART3 TX (PB10)
  • UART2 RX (PA3) => UART3 RX (PB11)

From the pinout here that I identified the following pins:

enter image description here
PA2 and PA3

enter image description here
PB10 and PB11

In that setup, I again activate the callback on UART3, send a message from my laptop to UART2 (and thus 'also' to UART3 if my theory works in practice) and hoped to hit the breakpoint in the HAL_UART_RxCpltCallback. But it doesn't work.

The code for completeness:

In the main function:

  // Activate the callback on receive UART3 
  HAL_UART_Receive_IT(&huart3, receive, 2);

  __NOP();
  while (1)
  {
      // Do nothing, all is done via callbacks
  }

(the default setting up of UARTs and GPIO, generated with CubeMX, is left out for readability)

The UART receive callback:

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
  /* Prevent unused argument(s) compilation warning */
  UNUSED(huart);

  if (huart->Instance == huart3.Instance)
  {
      __NOP();
      HAL_UART_Receive_IT(&huart3, (uint8_t *)receive, 2);
  }
}

I am sending a few bytes using a tool (Hercules). It works fine when I change to huart2. So I am sure the code works as it supposed to.

Is it possible to "mirror" UART2 pins to UART3 pins like I did?
Or is there something else that comes to mind what I might be doing wrong?

Update

As already explained in the comments, this is not a duplicate of the linked question (otherwise I wouldn't have asked it, since both are mine…). The problem in the linked question was regarding transmitting from UART2 to UART3, the question now is to mirror receiving pins to drill down to the actual issue at hand.

Update 2

Justme was spot on. The problem that I can't mirror the pins is simply because no signal is receive on the PA3 pin. I need to solder a bridge to make that happen, as explained in the user manual:

enter image description here

The answer / comment of Justme is most likely the actual problem that solves my issue.

Best Answer

Do not wire two or more outputs together. That is a standard rule for push-pull type digital outputs. When other drives low while other drives high, abnormally large current flows from pin to pin and may damage one or both output pins. Also, UART needs TX output connected to RX input for communications.