2021-06-11 12:20 PM
I'me using STM32F103C8 MCU with Stm32CubeIDE 1.6.1.
Project uses CMSIS OS v1 and 3 UARTs enabled global interrupts. UART settings 57600 8 N 1 for all three.
Interrupts handled in the callback:
uint8_t rxByte[UART_COUNT] = {0};
QueueHandle_t uartQueues[UART_COUNT] = {0};
UART_HandleTypeDef* uartList[UART_COUNT] = {
&huart1, // UART_CONSOLE
&huart2, // UART_ENG1
&huart3, // UART_ENG2
};
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
BaseType_t xHigerPriorityTaskWoken;
for (int u = 0; u < UART_COUNT; ++u) {
if (huart == uartList[u])
{
if (uartList[u]->RxXferCount == 0){
if (uartQueues[u]) xQueueSendFromISR(uartQueues[u], &rxByte[u], &xHigerPriorityTaskWoken);
HAL_UART_Receive_IT(uartList[u], &rxByte[u], 1);
}
return;
}
}
}
Everything works, but in unpredictable period one of three USARTs stop receiving data in HAL_UART_BUSY state. It has random fashion.
2021-06-11 12:48 PM
So likely waiting on actual reception. Is the UART flagging some kind of error status?
Viewing the UART registers in a debugger will result in unpredictable behaviour.
2021-06-12 12:13 AM
> Is the UART flagging some kind of error status?
+1
UART stops receiving when overrun error is unhandled.
JW