AnsweredAssumed Answered

UART forwarding

Question asked by Phua.Eugene on Jul 14, 2014
Latest reply on Jul 29, 2015 by thy
Hello there, I am trying to read in serial data from UART2 Rx and retransmit out to UART3 Tx. I am using the STM32CubeMx code generator with the F4 discovery board. Both UART are configure to the same baud rate.

I would like to ask if the method I am using is efficient:

In the while loop in main, I have 1 function:
while (1)
  {
      HAL_UART_Receive_IT(&huart2, &rx_char, 1);
  }


and in the receive callback:

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *UartHandle)
{
    if (UartHandle->Instance == USART2) {      
        HAL_UART_Transmit_IT(&huart3, &rx_char, 1);
    }
}

Outcomes