cancel
Showing results for 
Search instead for 
Did you mean: 

Endless loop at configASSERT( pxQueue->uxItemSize == 0 );

MFäh.1
Associate II

Hi all

I'm pretty sure this was already a topic, but i haven't found a solution yet. Since i'm a beginner i definitely need some help here.

I'm sending UDP data with LWIP and FreeRTOS. It works, but after some (random) time the code gets stuck at  

 

Screenshot 2023-12-13 125302.png
 
configASSERT( pxQueue->uxItemSize == 0 );
 
I tried some settings but nothing helps. It is stopping even if I do not send data .
 
Any ideas?
 
Cheers
6 REPLIES 6
hs2
Senior

A stack overflow might cause this kind of internal data corruption. Did you enable stack checking ? See https://www.freertos.org/Stacks-and-stack-overflow-checking.html

Thank you for your reply.

 

Yes, i did. My ioc file has following FreeRTOS settings (maybe this helps)

FREERTOS.FootprintOK=true
FREERTOS.IPParameters=Tasks01,configMINIMAL_STACK_SIZE,configUSE_NEWLIB_REENTRANT,copyHeapFile,FootprintOK,configENABLE_FPU,configCHECK_FOR_STACK_OVERFLOW,configQUEUE_REGISTRY_SIZE
FREERTOS.Tasks01=defaultTask,24,256,StartDefaultTask,Default,NULL,Dynamic,NULL,NULL;
FREERTOS.configCHECK_FOR_STACK_OVERFLOW=1
FREERTOS.configENABLE_FPU=1
FREERTOS.configMINIMAL_STACK_SIZE=256
FREERTOS.configQUEUE_REGISTRY_SIZE=0
FREERTOS.configUSE_NEWLIB_REENTRANT=0
FREERTOS.copyHeapFile=1

 

Cheers

 

David Littell
Senior III

This might be a buffer overrun resulting in the memory at pxQueue being stomped.  I'd suggest looking at what's in memory prior to pxQueue for clues.

hs2
Senior

Also try FREERTOS.configCHECK_FOR_STACK_OVERFLOW=2 and ensure that you have configASSERT defined. (sorry, I’m not familiar with cube)

BTW what’s the stack size(s) you’re using for your task(s) ?

Thank you both for your replies. I try to test both, not sure if I do it correctly ;-). 

@David Littell : "I'd suggest looking at what's in memory prior to pxQueue for clues". Does this help somehow: 

MFh1_0-1702542633591.png

 

Stack size for the taks is, if I'm correct 256 (words).

Cheers

It does look like the queue structure in memory is being stomped by something.  As a quick test you could try 4x all the stacks.  You can also convert the uxMessagesWaiting value to hex and see if that's a memory address you can examine.

Issues like this force you to dig around and work to really understand what's being allocated versus statically defined in memory - simple IDE debugger snippets aren't usually enough.