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.

cc3200 sl_start stuck after sl_stop

Other Parts Discussed in Thread: SYSBIOS

I'm using a non-os library version of simplelink library

For trying to save battery, I try to turn off nwp when I don't need network and turn it on when I need it.

But I see that sl_start will stuck sometime (I think that's sl_stop may not finish yet and cause the problem)

Is there anyway I can know if the sl_stop finished success. 

I make my function wait for about 10 seconds, but sometimes it still stuck at sl_start.

Is there any suggestion to solve this problem.

This is my sample code :

static void resetting_network(network_state_machine_t *self, unsigned char
event)
{
    switch (event)
    {
        case enter_state_event:
            network_if_stop();
            break;
        case tick_isr_event:
            if (self->super.timer_count >= TIME_TO_RESET_WIFI_NETWORK)
            {
                network_if_init();
                MAP_change_to_state(&idle_connection);
            }
            break;
        default:
            break;
    }
}
int16_t network_if_stop(){
    CLR_STATUS_BIT_ALL(g_ulStatus);
    return sl_Stop(0);
}

  • Hi Huy,

    You should check the return value of sl_Stop to know any such status.
    I would suggest you to give a bigger time out value as argument for sl_Stop. Don't give this as 0. The allowed time out value can be up to 0xFF.

    Regards,
    Raghavendra
  • Thanks Raghavendra,
    It solves my problem.
    It seems really stable, I don't have any fail case for sl_Stop.
    Just to make sure, what I need to do if the sl_Stop return -1
    because up to now, I don't see the case when it return -1 yet.
  • Hi Huy,

    Every APIs would not have same set of error codes. For example: sl_Stop would return a -6 if it has not completed its operations. In this case you should wait for some more time and issue sl_Stop again.

    Regards,
    Raghavendra
  • thanks you so much for your confirm

  • Hi Raghavendra,

    I just your suggestion

    I use the code below to retry to stop.

    But it gets stuck if I retry sl_Stop after the first one return -6. ( at _SlNonOsSemGet function)

    Does it mean that I didn't wait long enough , or what else I did wrong here 

            stop_count = 0;
            CLR_STATUS_BIT_ALL(g_ulStatus);
            do {
                _SlNonOsMainLoopTask();
                network_lRetVal = sl_Stop(SL_STOP_TIMEOUT);
                _SlNonOsMainLoopTask();
                stop_count++;
                if (stop_count > 5){
                   power_management_force_hibernate();
                }
                if (network_lRetVal != 0){
                    MAP_UtilsDelay(80000);
                }
            } while (network_lRetVal != 0);

  • Hi Huy,

    What is the value of 'SL_STOP_TIMEOUT' here? Can you please invoke sl_Stop again after you get -6 and try?

    Regards,
    Raghavendra
  • hi Raghavendra,

    it's 200 for SL_STOP_TIMEOUT ( I saw all TI example use it so I think it's good to just reuse this value )

    It's hard to come to sl_Stop return -6. It just happens one time for me now 

    I already invoke sl_Stop again with the loop. Do you mean that I need to do it immediately after the first sl_Stop

  • Hello, I'm doing what you say here:

    void socketsShutDown(void *handle)
    {
    	int16_t retVal;
    	uint32_t key;
    	do {
    		key = Hwi_disable();
    		retVal = sl_Stop(200);
    	    Hwi_restore(key);
    		Task_sleep(100);
    	} while (retVal != 0);
        WiFi_close((WiFi_Handle)handle);
        Task_sleep(10000);
    }

    The first time it returns -6, so when I call it again, the program goes to hardfault:

    ti.sysbios.family.arm.m3.Hwi: line 1095: E_hardFault: FORCED
    ti.sysbios.family.arm.m3.Hwi: line 1172: E_busFault: PRECISERR: Immediate Bus Fault, exact addr known, address: 702000e7
    Exception occurred in background thread at PC = 0x2001c9d2.
    Core 0: Exception occurred in ThreadType_Task.
    Task name: {unknown-instance-name}, handle: 0x2002c588.
    Task stack base: 0x20028000.
    Task stack size: 0x800.
    R0 = 0x702000e7 R8 = 0x2002fc54
    R1 = 0x80f44f47 R9 = 0x2002fc4c
    R2 = 0x00000160 R10 = 0x2002fc50
    R3 = 0x2001c9c9 R11 = 0x00000020
    R4 = 0x00009797 R12 = 0x2002fc34
    R5 = 0x00000090 SP(R13) = 0x200286b8
    R6 = 0xffffffff LR(R14) = 0x2000cbd7
    R7 = 0x00000000 PC(R15) = 0x2001c9d2
    PSR = 0x21001c00
    ICSR = 0x0440f803
    MMFSR = 0x00
    BFSR = 0x82
    UFSR = 0x0000
    HFSR = 0x40000000
    DFSR = 0x0000000b
    MMAR = 0x702000e7
    BFAR = 0x702000e7
    AFSR = 0x00000000
    Terminating execution...

    I have a timer which expires every second, can this be the cause? But why? After all, interrupts are disabled!

    What should I do?

  • Hello Rodrigo,

    This is a very old thread that is already closed.

    Please opena new thread pointing to this one as reference.

    Regards,

    Shlomi