Question
UART forwarding
Posted on July 14, 2014 at 15:44
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);
}
}