deiti123 wrote on Friday, November 14, 2014:
Hi there,
i’m just experiencing problems that freertos locks up in vListInsert, exactly at this line:
for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext )
when calling xQueueReceive with portMAX_DELAY
Theres only one line in a thread where i’m using the queue,
and only one thread where I’m sending something to the queue (also only once).
I checked out the note directly above the freeze, nothing of this things caused the problem.
I checked out the stacks, interupt priorities (i know the speciality of Cortex-M3 with priorities) and so on…
Then i saw the comment above the NOTE:
/* If the list already contains a list item with the same item value then
the new list item should be placed after it. This ensures that TCB’s which
are stored in ready lists (all of which have the same ulListItem value)
get an equal share of the CPU. However, if the xItemValue is the same as
the back marker the iteration loop below will not end. This means we need
to guard against this by checking the value first and modifying the
algorithm slightly if necessary. */
After checking out the values of xValueOfInsertion and pxNext->xItemValue, i discovered that both entries have the same value (its always “3”), and theres only one item in the list (pxList->uxNumberOfItems == 1).
I just coudln’t exactly figure out, when the xItemValue is set, and what the value it has means. Is it used in different cases? Sometimes something with priorities is assigned to it and sometimes a delay-value…
What can i do to avoid the problem of 2 same xItemValues like described in the comment i found in the code?
Anyone else having this trouble?
EDIT:
Just checked out pointer-values in the pxIterator-struct. They seems correct, beacuse pxNext and pxPrevious have the same adress (adress is located im ram-region), this seems to be correct, cause there is only one item there.
Thx for responses.
Best regards,
David