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 mode switching without device reset

Other Parts Discussed in Thread: CC3200

Hello,

Is it possible to switch mode of CC3200 from AP to Station and vice verse without restarting device? I have looked at  mode_config example and it uses device restart to switch mode.

I am running TCP server at CC3200 side. Functionality what I want is user (TCP Client) can change the mode of CC3200. So I don't want reset switch to be pressed by user. How can I do this without resetting device..??

  • Hi Niral,

    The mode switch only needs the networking service to be restarted and not a reset.

    So you could do the following, for ex.:

    // Switch to STA role and restart

    lRetVal = sl_WlanSetMode(ROLE_STA);

    ASSERT_ON_ERROR(lRetVal);

    lRetVal = sl_Stop(0xFF);

    ASSERT_ON_ERROR(lRetVal);

    lRetVal = sl_Start(0, 0, 0);

    ASSERT_ON_ERROR(lRetVal);

     

    Best regards,

    Naveen

     

  • Hello Naveen,

    Thanks a lot for your replay. I did the same first.. But I stuck at sl_Start().

  • hello,

    I am facing trouble with connecting cc3200 module to work in AP mode. As and when I press reset button I am getting an error message. I am using ccs for debugging and have followed the getting started guide. I am able to view the pinging message on putty but once after I receive the message as 'application exits' my board gets disconnected. let me know how to resolve this issue.

    thanks

    regards sarvy

    have attached an image -

  • @Saravanan : Please post new question in new thread..

    @Naveen: I did it again (with 0xFF as an argument to sl_Stop) but CC3200 hangs at _SlDrvDriverCBInit() in driver.c after encountering sl_Start().

    My chip ID is xCC3200HZ. Can anyone tell me how to solve this issue? This is must to have feature for us. Please replay as soon as possible.

  • Hi SARAVANAN,

    This is the expected behavior of this example program.

    If you doesn’t want it you need to change the example to your needs.

  • Hi Niral,

    Please refer to the function ConfigureSimpleLinkToDefaultState for a reference implementation.

    Also do take care that you gracefully exit one session (close socket, disconnect from AP (if reqd.)...) and then invoke the networking engine reset (sl_stop followed by sl_start).

    Best regards,

    Naveen

    // If the device is not in station-mode, try configuring it in station-mode

    if (ROLE_STA != lMode)

    {

    if (ROLE_AP == lMode)

    {

    // If the device is in AP mode, we need to wait for this event

    // before doing anything

    while(!IS_IP_ACQUIRED(g_ulStatus))

    {

    #ifndef

    SL_PLATFORM_MULTI_THREADED

    _SlNonOsMainLoopTask();

    #endif

    }

    }

    // Switch to STA role and restart

    lRetVal = sl_WlanSetMode(ROLE_STA);

    ASSERT_ON_ERROR(lRetVal);

    lRetVal = sl_Stop(0xFF);

    ASSERT_ON_ERROR(lRetVal);

    lRetVal = sl_Start(0, 0, 0);

    ASSERT_ON_ERROR(lRetVal);

    // Check if the device is in station again

    if (ROLE_STA != lRetVal)

    {

    // We don't want to proceed if the device is not coming up in STA-mode

    ASSERT_ON_ERROR(DEVICE_NOT_IN_STATION_MODE);

    }

    }

  • Naveen Narayanan said:

    Please refer to the function ConfigureSimpleLinkToDefaultState for a reference implementation.

    Also do take care that you gracefully exit one session (close socket, disconnect from AP (if reqd.)...) and then invoke the networking engine reset (sl_stop followed by sl_start).

    Problem still does exist..Let me tell problem in more detail..

    I am using TI RTOS. CC3200 is in AP mode and running TCP server. I am using parent-child socket algorithm. Parent socket is bounded. I am using select() for receiving purpose only.  Now client is connected and initiate mode change request via sending command over TCP.

    After receiving this command first of all I clear file descriptor used by select() using SL_FD_ZERO(), next I close parent and child socket and afterwards I am doing....

    sl_WlanSetMode(ROLE_STA);
    
    iRet = sl_Stop(0xFF);
    
    iRet = sl_Start(0, 0, 0);

    And I end up with happening nothing at _slDrvDriverCBInit()

    Also this hang up is random means sometime it happen at sl_Stop() and sometime at sl_Start()..

  • Hi Niral,

    Please can you clarify the following:

    1. Do you see this issue the first time you attempt to switch itself or is it after some iterations?

    2. You do invoke the ConfigureSimpleLinkToDefaultState API in your application.

    3. While debugging from CCS IDE, do you have SOP2 connected?

    4. Do you add an AP profile in your code?

    Best regards,

    Naveen

     

  • Naveen Narayanan said:

    1. Do you see this issue the first time you attempt to switch itself or is it after some iterations?

    This is the first time I am seeing this issue.

    Naveen Narayanan said:

    2. You do invoke the ConfigureSimpleLinkToDefaultState API in your application.

    No I am not invoking it. But after this question of yours I have invoked it and tried to change mode to AP but again it hanged up at the same point.

    Naveen Narayanan said:

    3. While debugging from CCS IDE, do you have SOP2 connected?

    Yes SOP2 is connected

    Naveen Narayanan said:

    4. Do you add an AP profile in your code?

    No I am not adding any AP profile.

  • Hi Niral,

    As you started with the mode_config example as reference, what we tried was to loop the application to continuously perform the mode switch.

    The only additions we did to the app is the following:

    1. Added a profile and set the connection policy to auto in the beginning - to avoid invoking the connect API in the loop.

    2. Wait until an IP is acquired in both the modes.

    3. Loop to keep switching the modes.

    An the mode switch worked successfully for many iterations.

    Could you also try with this basic check if you are able to recreate the issue?

    Best regards,

    Naveen

  • Hi Niral,

    I am closing the thread, if issue still exist please open a new thread and add a link to this one for reference.

    Best regards,

    Naveen

  • Hello Naveen,

    My system (Hardware and Software both) is got crashed so I am not able to test anything on CC3200 launchpad. I will replay as soon as I will get access to my system. Accept my apology for this.

    Thank you very much

    Niral

  • No issues Niral!

    Do open a new post referring to this one in case you continue to see any issues.

    Best regards,

    Naveen

  • Hi Niral,

    I just had the same problem. It seems you should change modes from the main thread, not from a task. Maybe that is your problem.

    Regards,

    David

  • @David

    I am not getting you.. Could you please explain what do you mean by main thread..??

    Thanks for the replay,

    Niral

  • I was having a problem like the one you're describing. It was caused by trying to change to STA  mode in an event handler. It was solved by just setting a flag and letting the main thread( the function that is started when the application is started) change the mode

  • @David

    I am not initiating mode switch from event handlers..So it is not an issue..

    Regards,

    Niral