This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3100: Assert cause by MUTEX_UNLOCK

Part Number: CC3100

Hello,

I'm using Free RTOS with NWP v2.14.0.0. I keep hitting an assert when I call sl_ExtLib_MqttClientCtxCreate(). Below is the sequence of SL_x calls for different scenarios that I've tried.


1. Power on CC3100

2. sl_Start

- WiFi profile already exists

3. sl_ExtLib_MqttClientInit

- interrupt comes in and IP's are received

4. Ensure client context is disconnected and deleted: sl_ExtLib_MqttClientDisconnect & sl_ExtLib_MqttClientCtxDelete

5. sl_ExtLib_MqttClientCtxCreate

- ID's, Will Params, etc are set.

6. sl_ExtLib_MqttClientConnect

7. sl_ExtLib_MqttClientSub

^ this is the normal connection flow that I use and works well.


I've been trying to implement a way to reset the mqtt session and restart the CC3100 without needing to restart the host MCU. This is what I'm doing for that:

1. sl_ExtLib_MqttClientUnsub

2. Ensure client context is disconnected and deleted: sl_ExtLib_MqttClientDisconnect & sl_ExtLib_MqttClientCtxDelete

3. sl_ExtLib_MqttClientExit

4. sl_Stop

5. Power off CC3100

6. Start the same steps as shown in the previous section but now an assert happens in sl_ExtLib_MqttClientCtxCreate -> mqtt_client_ctx_create -> MUTEX_UNLOCK() -> xQueueGenericSend

- Specifically the assert in FREE RTOS's queue.c:

...
    #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
        {
            configASSERT( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) );
        }
    #endif
...

It seems like the scheduler is suspended when it gets here. 

Any insight on why this might be happening? Or can I get some guidance on a better way to implement a "reset WiFi" api?