HAL UART HAL_UART_Receive Timeout
Hi,
I’m using a CubeMX generation for STM32F746BETx which contains 2 serial ports. These 2 serial ports are both connected to a putty terminal. (The behaviour is the same for STM32F769I-DISCO and STM32F746G-DISCO.)
I can transmit messages from both and I can also receive messages on one UART. But as soon as I’m receiving characters on both UARTS in the main loop both receive functions return timeout and no character is delivered any more.
This is my code within main:
while (1)
{
uint8_t aTxBuffer150 = “W123456789”;
uint8_t aTxBuffer750 = “X1Y2Z”;
HAL_UART_Receive(&huart1, (uint8_t *)aTxBuffer1, 50, 50);
HAL_UART_Transmit(&huart1, (uint8_t*)aTxBuffer1, 50, 0xFFFF);
HAL_UART_Receive(&huart7, (uint8_t *)aTxBuffer7, 50, 50);
HAL_UART_Transmit(&huart7, (uint8_t*)aTxBuffer7, 50, 0xFFFF);
}
When I insert something like
__HAL_UART_CLEAR_IT(&huart1, UART_CLEAR_NEF | UART_CLEAR_OREF | UART_FLAG_RXNE | UART_FLAG_ORE);
for each UART before calling Receive, the Receive functions do not return timeout all the time, but the receive methods loose a lot of characters of the received messages.