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 hangs after sl_start

Other Parts Discussed in Thread: CC3200

In continuation with this post http://e2e.ti.com/support/wireless_connectivity/f/968/t/384415.aspx

At times right after calling sl_start(), my device goes into WLANeventHandler function, and whenever this happens, device stalls and is rebooted by my watchdog. 

Here is the log that I'm printing

//***********************************************//
Attempting to connect to stored network
Rebooting
//***********************************************//
Attempting to connect to stored network
Calling sl_start
I'm inside WlanEventHandler
WLAN Connected
returned after sl_start
new role is STA
Returned from WlanDisconnect
I'm inside WlanEventHandler
WLAN Connected
I'm inside WlanEventHandler
WLAN disconnected
Previous connections removed
I'm inside WlanEventHandler
WLAN Connected
Returned from sl_Stop
Calling sl_start
I'm inside WlanEventHandler
WLAN Connected
Returned from sl_start
//***********************************************//
Attempting to connect to stored network
Rebooting
//***********************************************//
Attempting to connect to stored network
Calling sl_start
returned after sl_start
new role is STA
Returned from WlanDisconnect
I'm inside WlanEventHandler
WLAN Connected
//***********************************************//
Attempting to connect to stored network
Rebooting
//***********************************************//
Attempting to connect to stored network
Calling sl_start
I'm inside WlanEventHandler
WLAN Connected
returned after sl_start
new role is STA
//***********************************************//
Attempting to connect to stored network
Rebooting
//***********************************************//
Attempting to connect to stored network
Calling sl_start
I'm inside WlanEventHandler
WLAN Connected
returned after sl_start
new role is STA
//***********************************************//
Attempting to connect to stored network
Rebooting
//***********************************************//
Attempting to connect to stored network
Calling sl_start
returned after sl_start
new role is STA
Returned from WlanDisconnect
I'm inside WlanEventHandler
WLAN disconnected
Previous connections removed
Returned from sl_Stop
Calling sl_start
Returned from sl_start
Returned from sl_Wlanpolicyset
..I'm inside WlanEventHandler
WLAN Connected
.
Fast connection succeeds
Waiting for an ip address

IP Address obtained
Commiting the code
getting status
0
Connected to network

mqtt configured

  • Hi Shatuddha,

    Could you clarify the following:

    1. Are you using the OS or non-OS mode?

    2. Is sl_start returning with an error? Could you share the error code?

    Best regards,

    Naveen

  • Hi Naveen,

    I'm using Non-Os mode. My board is Rev 4.1 and I'm using latest service pack. 

    sl_start returns with 0. but the very next command after this hangs if wlanevent has occured. 

    Here is my configuresimplelinktodefault function

    int WiFiClass::configureSimpleLinkToDefaultState()
    {
    _WlanRxFilterOperationCommandBuff_t RxFilterIdMask = {0};

    unsigned char val = 1;
    unsigned char configOpt = 0;
    unsigned char power = 0;

    int retVal = -1;
    int mode = -1;
    int count = 0;

    WiFiClass::ipAcquired = false;
    Serial.println("Calling sl_start");
    mode = sl_Start(0, 0, 0);
    Serial.println("returned after sl_start");

    /* If the device is not in station-mode, try configuring it in station-mode */
    if (ROLE_STA != mode)
    {
    if (ROLE_AP == mode)
    {
    /* If the device is in AP mode, we need to wait for this event before doing anything */
    while(!WiFiClass::ipAcquired) { _SlNonOsMainLoopTask(); }
    }
    /* Switch to STA role and restart */
    retVal = sl_WlanSetMode(ROLE_STA);
    retVal = sl_Stop(0);
    retVal = sl_Start(0, 0, 0);

    /* Check if the device is in station again */
    if (ROLE_STA != retVal)
    {
    /* We don't want to proceed if the device is not coming up in station-mode */
    configureSimpleLinkToDefaultState();
    }
    }
    Serial.println("new role is STA");
    WiFiClass::role = ROLE_STA;

    retVal = sl_WlanDisconnect();
    Serial.println("Returned from WlanDisconnect");

    if(0 == retVal)
    {
    while(WiFi.status() == WL_CONNECTED)
    {
    _SlNonOsMainLoopTask();
    retVal = sl_WlanDisconnect();
    }
    }

    Serial.println("Previous connections removed");
    /* Enable DHCP client*/
    retVal = sl_NetCfgSet(SL_IPV4_STA_P2P_CL_DHCP_ENABLE,1,1,&val);

    /* Disable scan */
    configOpt = SL_SCAN_POLICY(0);
    retVal = sl_WlanPolicySet(SL_POLICY_SCAN , configOpt, NULL, 0);

    /* Set Tx power level for station mode
    Number between 0-15, as dB offset from max power - 0 will set maximum power */
    power = 0;
    retVal = sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_STA_TX_POWER, 1, (unsigned char *)&power);

    //Serial.println("setting wlan policy");
    /* Set PM policy to normal */
    retVal = sl_WlanPolicySet(SL_POLICY_PM , SL_NORMAL_POLICY, NULL, 0);

    /* Unregister mDNS services */
    retVal = sl_NetAppMDNSUnRegisterService(0, 0);

    /* Remove all 64 filters (8*8) */
    pal_Memset(RxFilterIdMask.FilterIdMask, 0xFF, 8);
    retVal = sl_WlanRxFilterSet(SL_REMOVE_RX_FILTER, (unsigned char *)&RxFilterIdMask,
    sizeof(_WlanRxFilterOperationCommandBuff_t));

    retVal = sl_Stop(0x10);
    Serial.println("Returned from sl_Stop");

    delay(50);

    Serial.println("Calling sl_start");
    mode = sl_Start(0, 0, 0);
    Serial.println("Returned from sl_start");

    retVal = sl_WlanPolicySet(SL_POLICY_CONNECTION, SL_CONNECTION_POLICY(1, 0, 0, 0, 0), NULL, 0);
    Serial.println("Returned from sl_Wlanpolicyset");

    count = 0;
    while (((WiFi.status() != WL_CONNECTED) || (!ipAcquired))&&(count++ < 30) )
    {
    _SlNonOsMainLoopTask();
    Serial.print(".");
    delay(200);
    }
    Serial.println();
    if(count >= 30)
    {
    Serial.println("Fast connection failed");
    }
    else
    {
    Serial.println("Fast connection succeeds");
    }
    return retVal;
    }

    As can be seen from log, device always hangs whenever wlanevant has occured at around sl_start.

  • Hi Shatuddha,

    Apologies for delayed response.

    From the code I couldn't find how are you ACK-ing the watchdog. CC3200 Watchdog requires to be acknowledged at-least once in the configured timeout period else it would reset the device

    What is the watchdog timeout period. Can you increase the timeout and try ?


    Thanks and Regards,
    Praveen
  • Hi Praveen,
    Here is my watchdog implementation code

    long WDTReloadVal = 80000000*5;
    void WDTInit()
    {
    MAP_PRCMPeripheralClkEnable(PRCM_WDT,PRCM_RUN_MODE_CLK);

    MAP_WatchdogUnlock(WDT_BASE);
    MAP_WatchdogReloadSet(WDT_BASE,WDTReloadVal);
    MAP_WatchdogEnable(WDT_BASE);

    if(PRCMSysResetCauseGet() == PRCM_WDT_RESET)
    {
    Serial.println("Rebooting");
    WiFi_OTA.RebootMCU();
    }
    }

    static void WatchdogAck()
    {
    WatchdogIntClear(WDT_BASE);
    }

    So right now Watchdog is set to 5 seconds. Which I think is fairly large amount to time to process. But anyways I tried 10-15 seconds as well. It just halts and doesn't come back.

    should I be calling _SlNonOsMainLoopTask(); after each step?/ will that be of any help?
  • Well, I tried calling _SlNonOsMainLoopTask(); at each step, that doesn't improve the situation.
  • Hi Shatuddha,

    Regarding the WDT reset sequence that you are following, may I suggest you update it to the sequence prescribed in the section on "MCU Watch Dog Controller Usage Caveats" in the TRM (http://processors.wiki.ti.com/index.php/CC32xx_Technical_Reference_Manual).

    There is also an example in the SDK (cc3200-sdk\example\watchdog_system_demo) showcasing the sequence.

    Best regards,

    Naveen

  • Hey Praveen,
    I'm following the same sdk example that you mentioned. Moreover, watchdog is not the cause at all. It has been working like charm.
    My issue is wlan_event happening around sl_start, which causes execution to hang.
  • Hi Shatuddha,

    The reason for my suggesting following the watchdog sequence mentioned in the TRM is the following:

    The WDT reset does not reset the WLAN domain (MAC and Baseband). In order to completely reset the system (APPs + networking engine), the sequence described in the TRM/example will need to be followed.

    A clean reset of the system may ensure that the subsequent sl_start (being a network enable) goes through.

    Best regards,

    Naveen

  • ok, I was unaware of that.
    Let me try and get back to you.
  • Hi Naveen,
    I'm doing the PRCM reset as well. If you look at the log above,
    "
    //***********************************************//
    Attempting to connect to stored network
    Rebooting
    //***********************************************//
    Attempting to connect to stored network
    "
    Here "Attempting to connect to stored network " is printed first time by WDT reset and than "Rebooting" is when I check if reset cause was WDT and do PRCM reset.

    you can see the code in WDTInit()
    "
    if(PRCMSysResetCauseGet() == PRCM_WDT_RESET)
    {
    Serial.println("Rebooting");
    WiFi_OTA.RebootMCU();
    }
    "

    Here WiFi_OTA.RebootMCU() is defined as

    void WiFiOTA::RebootMCU()
    {

    // Configure hibernate RTC wakeup
    PRCMHibernateWakeupSourceEnable(PRCM_HIB_SLOW_CLK_CTR);

    // Delay loop
    delay(100);

    // Set wake up time
    PRCMHibernateIntervalSet(330);

    // Request hibernate
    PRCMHibernateEnter();

    // Control should never reach here
    while(1)
    {

    }
    }

    Am I missing something?
  • Hi Shatuddha,

    Your sequence looks ok. Do subsequent sl_start also fail after the reboot?

    Best regards,

    Naveen

     

  • Hi Shatuddha,
    Sorry I think I misinterpreted your statement. You meant that you were already doing the right sequence and the log corresponds to the result with this sequence.
    Best regards,Naveen
  • Yeah Right,

    But this problem still persists with no solution or workaround so far. 

    Please keep me updated if you come across any solution

  • Hi , Me also facing the Same Issue , what is the solution or woork around for it
  • Hello ,

    I also experience the same problem using TCP demo in server mode where I added only LEDs from the blink demo.
    Device was working fine for number of times, but it stucks on the same problem.

    Patrick
  • HI,
    I have the same problem too.
    I have tried to set sl_WlanPolicySet to (0, 0, 0, 0, 0) so it doesn´t reconnect during start, but it doesn´t work.

    Adolfo.