FreeRTOS Support Archive

The FreeRTOS support forum can be used for active support both from Amazon Web Services
and the community. In return for using our software for
free, we request you play fair and do your bit to help others! Sign up
to receive notifications of new support topics then help where you can.

This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.

Assert in xQueueGenericReceive function of Queue.c File of FreeRTOS v9.0.0

In Our Project Host Controller(LPC4320) is ASSERTING at line no 1245 of "queue.c" file.There is "configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) );" function written over there.I really don't understand the condition written over there.We have guaranteed that pvBuffer isn't equal to NULL,so it won't ASSERT at the same line.Issue nature is Random.
Another confusion is that imagine a scenario in which pxQueue->uxItemSize is 0 but,pcBuffer isn't equal to NULL.
Project details are confidential but,let me know if more details required for this.

Assert in xQueueGenericReceive function of Queue.c File of FreeRTOS v9.0.0

The line is checking you do not try to write received data to a NULL
pointer. pvBuffer can be NULL if uxItemSize is 0 because no bytes are
written. You can work out a truth table for the inputs, it will only
have four rows, the only output that is 0 (and therefore cause the
assert to trigger) should be the row where

( ( pvBuffer == NULL ) && ( uxItemSize != 0 ) )

If you don't think that is the case then please post the truth table
here so we can see (I have done it myself before posting).

If the assert is really failing then you are violating the inputs. You
can turn asserts off, but then your program will just crash when you try
to write to NULL.

Assert in xQueueGenericReceive function of Queue.c File of FreeRTOS v9.0.0

According to this truth table i am sure that pvBuffer is passing as NULL Right?
Again we have dig to this issue and found that program is calling to xSemaphoreTake(line 248 semphr.h) where pvBuffer is passed as NULL.But there is some data in queue.

Assert in xQueueGenericReceive function of Queue.c File of FreeRTOS v9.0.0

So your finding is that the assert only occurs if pvBuffer is NULL, but
uxItemSize is not zero, which (without the assert) would result in
received data being copied to a NULL pointer, hence the assert is correct.

Again we have dig to this issue and found that program is calling to
xSemaphoreTake(line 248 semphr.h) where pvBuffer is passed as NULL.But
there is some data in queue.

If this is a semaphore then the assert is from an internal call where
pvBuffer should be NULL and uxItemSize should be 0 as that is the case
for all semaphores. If the assert is being hit then my guess is you
have a data corruption somewhere - maybe the semaphore's data structure
has been overwritten so uxItemSize is not 0?

Assert in xQueueGenericReceive function of Queue.c File of FreeRTOS v9.0.0

As said above that semaphore structure is corrupted and uxitemsize is not 0.I have done my full analysis on this issue and issue is same as said above "data corruption".But can you please tell more on this kind of data corruption.I mean full explaination of data corruption.

Assert in xQueueGenericReceive function of Queue.c File of FreeRTOS v9.0.0

Assert in xQueueGenericReceive function of Queue.c File of FreeRTOS v9.0.0

Sorry for trouble but got to know somemore reason.I will look into my sourcecode for this kind of possiblity.
There is problem that i have to provide solution in my next release immediately so time is less for analysis.Can you provide some suggession to solve this problem.

Assert in xQueueGenericReceive function of Queue.c File of FreeRTOS v9.0.0

Put as simply as possible, something in your code is writing over RAM it
is not supposed to be writing over. That is the symptom - Hein has
provided a list of possible causes - but you are the only one with the
code so only you can judge where that might happen.

Assert in xQueueGenericReceive function of Queue.c File of FreeRTOS v9.0.0