Question
[STM32F072] Problem in use all 4 UARTs in same time
I am creating a hub to connect several devices together. When I send a frame to one of the UARTs from an external device, I get an interrupt from each of the UARTs instead of just the one I sent to. what i am doing wrong?
I generated configuration in STM32CubeIDE.
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
if (huart->Instance == USART1)
{
HAL_UART_Receive_IT(&huart1, &rxBuffer[0], 1);
}
else if (huart->Instance == USART2)
{
HAL_UART_Receive_IT(&huart2, &rxBuffer[1], 1);
}
else if (huart->Instance == USART3)
{
HAL_UART_Receive_IT(&huart3, &rxBuffer[2], 1);
}
else if (huart->Instance == USART4)
{
HAL_UART_Receive_IT(&huart4, &rxBuffer[3], 1);
}
}