0 Replies Latest reply on Oct 8, 2018 8:27 AM by nickmckendree_1688136

    FreeRTOS v9 (WICED version) and vEventGroupDelete

    nickmckendree_1688136

      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