Question
STM32F103 HAL UART Receive Interrupt not working
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.
