I have a very simple UART application, which I have ported from another
RTOS to FreeRTOS.
But now I got problems:
very simple task:
- In my UART RX interrupt, i send byte to a queue.
- In a task, I read the bytes from the queue.
// Read byte from UART:
u8UART_Data = UART_ReceiveByte(UART);
// Send the byte to the queue:
xQueueSendToBackFromISR(xByteQueue, &u8UART_Data, &xHigherPriorityTaskWoken
In my receiving task, I wait for a byte in the queue:
xQueueReceive( xByteQueue, &u8Received_byte, portMAX_DELAY );
My problem is that I sometimes looses a byte. Not many, but maybe 1 out of
The ISR receives EVERY bytes sent to it.
But when reading the queue, some bytes are missing.
By mistake, I used the NON-ISR xQueueSendToBack in the first version.
When using this, I never lost any bytes, but entered HardfaultHandler once
in a while.
Anyone knows why I loose bytes between xQueueSend and xQueueReceive?
thanks in advance!