We encountered a strange behavior of xQueueReceive function, it goes as follows:
- We created a Queue using xQueueCreate function.
- We created a task using xTaskCreate function, this task is waiting on the queue with xTickToWait=portMAX_DELAY which means it’s blocking without timeout till a message is inserted to the queue.
- The problem is that from time to time when our device comes back from reset, the queue message counter is showing 1 although there are already 2 messages in the queue (the last message and the one before it). This creates a sort of continuous 1 message delay (instead of picking msg[N] we always pick up msg[N-1]).
- We’ve tried several workarounds:
* We used xQueueReset in order to “re-start” the queue, with no help – the message counter goes to 0, but the queue still had the previous message inside it.
* We called xQueueReceive() with xTickToWait=0 in order to empty the queue but that did not help either.
It seems like the queue message counter is somehow missing the “1’st time message”, not incrementing itself and this cannot be cleaned until reset.
Any idea will be appreciated.
Thanks in advance!