Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
NiMc_1688136
Level 5
Level 5
10 sign-ins 50 questions asked 10 solutions authored

Interesting issue. I am trying to call vEventGroupDelete to remove an event group and reset a app thread to a know state but I am finding that I am hitting an assert in FreeRTOS queue.c, specifically the xQeueGenericReceive function:

configASSERT( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) );

With the debugger, I have captured the call stack:

vEventGroupDelete

--> vPortFree

--> free

--> some platform library call

--> malloc_lock (heap_3.c)

-->xSemaphoreTakeRecursive

-->xQueueGenericReceive

Since the FreeRTOS heap_3.c has been modified from stock FreeRTOS v9 to provide reentrancy for malloc/free calls, the malloc_lock function uses a mutex with a delay of portMAX_Delay, to wait until malloc or free can be called.

The problem appears to be that xQueueGenericReceive depends on the scheduler to provide a timeout (xTicksToWait). The first line in vEventGroupDelete suspends the scheduler.

Not exactly sure how to proceed, other than to shift from a dynamic EventGroup to a static EventGroup.

Anyone know other workarounds or what else this issue may impact.

Platform: CYW43907

OS: FreeRTOS v9.0.0

SDK: 6.2

0 Likes
2 Replies
GauravS_31
Moderator
Moderator
Moderator
10 questions asked 250 solutions authored 250 sign-ins

Based on the description, I'm not sure how the issue can be reproduced. Please share your application code where you can observe the issue.

0 Likes

The actual failure came from the AWS OTA agent library. I assume this can be replicated by making a simple FreeRTOS application with a task running a loop that dynamically creates an EventGroup and then deletes it with vEventGroupDelete.

0 Likes