I need help with a blocking Queue

reny09 wrote on Thursday, June 05, 2008:

   I have a task that it blocks waiting for an item to be posted on a queue. The item is posted from an ISR. The first item posted on the queue unblocks the task successfully. The second item also unblock the task but when the task returns to the blocking receive the system get stuck. I don´t see anything strange in the memory, the stacks of the tasks are ok. I tried everything, I removed all the code from the task, I only leaved a led toggle. I need suggestions of what could be the problem.


rtel wrote on Thursday, June 05, 2008:

Its a bit tricky to offer suggestions as its quite a high level description of the problem.  Can you step into the code when the third item is posted to the queue to see that there is in fact a task blocked on the queue when the item is posted, and that this task is then unblocked during the post?


reny09 wrote on Thursday, June 05, 2008:

Thanks Richard for your support. After the second post on the queue the task gets unblocked but when it returns to the xqueue
receive the program get lost. I changed the xqueue receive to another task and the system get blocked on the first post. It seems that some variable of the kernel get corrupted. After the frozen, if you look with the debugger the ram content, it is very similar to the previous state, there isn´t a big ram area corrupted. Now I´m trying to look which one is the corrupted.

Is all the information about a task  in the TCB? and Is all the information about a Queue in the xqueue handle? or Is there any other area whith relevant information that could be damaged?


davedoors wrote on Friday, June 06, 2008:

The other place to check is the stack. Has the stack overflowed? http://www.freertos.org/Stacks-and-stack-overflow-checking.html

reny09 wrote on Friday, June 06, 2008:

Thanks Davedoors for your help. I´ve checked the stacks of the stacks and everything looks fine. In order to test I´ve quited everything. I´ve only have three tasks waiting for a byte to be posted on three differents queue each one, and. I have only a timer based interrupt with a little state machine and appart from the rtos timer nothing else is running. If in the interrupt I post a byte in only one queue the corresponding task gets unblocked it toggles a led and the system doesn´t crash. But when i post on two queues is when the problems begins. Depending the combinations the system crash with differents patterns but is always the same, you reset the system and sequence before crash is always the same.