I have created rx and tx tasks with priority as 1,2.
My rx task will post item back to Queue using xQueueSendToBack and tx task will receive an item from Queue.
Before posting item to Queue my rx task will perform compression(LZ4) on my data then post item to Queue but after compression of item my rx task always stuck at xQueueSendToBack() func
Can any body faced the same issue. Please help me to find the root cause.
I am using var-som-mini board.
So without using compression queuing basically works (with some test data) ?
Without compression queuing works. After adding compression only facing this issue.
My first thought is what exactly are you posting on the queue. Queues deal with fixed length items, so ‘compression’, which tends to give a variable length, doesn’t really seem applicable.
My guess (since we see no code) is that the sending task is adding more data than the receiving task tasks, so the queue fills and blocks.
I am not posting compressed length to Queue. Always posting fixed length to Queue.
I am just compressing for an array of of 5 bytes and storing compressed data in other buffer.
Well, then it seems that the invocation of your compression routine corrupts something maybe due to a stack overflow.
The Q itself doesn’t care about 5 compressed or uncompressed bytes so the invocation routine is the only difference.
Did you enable the debug check macros like
Would agree with the above. If sending to the queue works, but performing some unrelated compression then sending to the same queue in the same way doesn’t, it would see that it was the compression operation that was causing the issue - and that was unrelated to the queue send operation if that has not changed. Take a look through the following to see if it helps - it mentions things like stack overflow detection as per hs2’s post: https://www.freertos.org/FAQHelp.html
After setting configCHECK_FOR_STACK_OVERFLOW to 1 or 2 while compiling facing below error.
tasks.c:(.text.vTaskSwitchContext+0x3e): undefined reference to `vApplicationStackOverflowHook’
collect2: error: ld returned 1 exit status
Because you need to define the routine in your code, that is why it begins with Application. Generally I try to print some error message and then halt the program.
I have defined vApplicationStackOverflowHook routine in my code and added some dummy log to print the task name.
It doesn’t hit this routine when it stuck after compression.
As pointed in above replies, the symptoms seems that of a memory corruption. Would you be able to break the code in debugger and see where it is stuck? Also, have you defined
Another quick check to ensure that it is not stack overflow is to increase the size of stack and see if the problem persists.