Missing items in queues

NevynSelby
Posts: 34
Joined: Thu Dec 24, 2015 12:04 pm

Missing items in queues

Postby NevynSelby » Thu Nov 29, 2018 8:57 am

I have some code with multiple tasks and queues and I'm creating some test data and the application is exhibiting some odd behaviour.

Basic principle, the main application posts a series of messages to a queue (UARTTaskQueue). A task, UARTTxTask, waits on the queue and retrieves the messages being posted. It then sends the bytes in the message over the UART.

Should be simple.

The odd behaviour I am seeing is the fact that odd numbered messages go into the queue and the UARTTxTask processes the messages as expected. The even numbered messages appear to go into the queue but they do not get processed, they seem to go into the queue and then disappear.

I have put some debug statements around the post message statement (xQueueSendToBack) and uxQueueMessagesWaiting shows an increase in the number of messages in the queue.

I can get the application to work as expected if I add a vTaskDelay call prior to posting the data.

Has anyone seen this before? Any pointers to what I need to do to get the expected behaviour?

Regards,
Mark

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Re: Missing items in queues

Postby permal » Thu Nov 29, 2018 5:49 pm

Are you checking the return value of xQueueSendToBack?

It sounds to me that you're posting more messages than fit in the queue, i.e. not reading the queue quickly enough.

NevynSelby
Posts: 34
Joined: Thu Dec 24, 2015 12:04 pm

Re: Missing items in queues

Postby NevynSelby » Fri Nov 30, 2018 10:55 am

I think you are right about the timing issue, I did some optimisation yesterday and it looks to be performing as expected. I'll see how it does under stress testing :)

Thanks for your time,
Mark

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Re: Missing items in queues

Postby permal » Fri Nov 30, 2018 1:35 pm

Check the return value and you'll know for sure if you're dropping items.

Who is online

Users browsing this forum: No registered users and 112 guests