I’m experiencing some strange behavior while using xQueueSendFromISR and xQueueReceiveFromISR in a kind of long running process.
Being practical, let the array of bytes be a sample data among thousand others. Then an excerpt of an ISR could be:
cChar = U1RXREG;
xQueueSendFromISR(UART1RxQueue, &cChar, &xHigherPriorityTaskWoken);
Now supposing another sample data like was received via UART and then enqueued, in another task like this
if (xQueueReceiveFromISR(com1RxQueue, &cChar,
&xHigherPriorityTaskWoken) == pdTRUE)
// do something
one would expect getting the same sequence of bytes, but I just got instead - note the last byte of the first sample array is at the first index of its subsequent sample array.
It seems there’s a byte to be consumed at the queue, but the queue itself just doesn’t know about it. I think that "suspicious" byte was not lost, it just got stuck somewhere between xQueueSend and xQueueReceive.
Does anyone could help me, please? Thanks in advance.