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.

SSID change within FREERTOS

Other Parts Discussed in Thread: CC3200

Hi,

I've been playing with the cc3200 websock_camera demo, and I wanted to change the SSID but am unable to work out how to. I found this post: 

https://e2e.ti.com/support/wireless_connectivity/f/968/t/377130

However, copying and pasting the code into my project just generates a fault ISR- I guess because its inside an RTOS (freertos). I figured it would be a case of moving this code to somewhere within the simplelink task, but I am going in circles without any kind of success.

I have tried trying to find where simplelink task calls sl_WlanSet but apparently this never happens, so the SSID and other parameters are set magically?

I have tried editing common.h, but this has no effect. 

I have tried using the OOB demo, and can change the SSID etc through the web interface, and restarting with J15 removed changes the SSID etc as expected. I have attempted to find how the OOB demo achieves this, but it again seems magical. 

Any pointers of where to look would be greatly appreciate, I have been attempting this for longer than I would like to admit, now completely confused and wishing there would be some proper documentation somewhere!!!

 

  • It should work as detailed in that post. I do not think there is anything special needed for FreeRTOS.

    Where are you making to call to change the SSID?

    Can I suggest yo format your serial flash, reinstall the service pack and then try again.

    Glenn.
  • Thanks for the reply,

    I have formatted the flash, reinstalled the service pack (1.0.0.10.0). I then power cycle the board. I then enter debug of websock_camera.

    There is a function in main.c "VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);". On my first attempt I placed the code

    	_i16 configValue;// = sl_WlanSetMode(ROLE_AP);
    
    	// Set SSID name for AP mode
    	unsigned char  str[33] = "YourAPname";
    	unsigned short  length = strlen((const char *)str);
    	sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SSID, length, str);
    
    	// Set security type for AP mode
    	//Security options are:
    	//Open security: SL_SEC_TYPE_OPEN
    	//WEP security:  SL_SEC_TYPE_WEP
    	//WPA security:  SL_SEC_TYPE_WPA
    	unsigned char  val = SL_SEC_TYPE_OPEN;
    	sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SECURITY_TYPE, 1, (unsigned char *)&val);
    
    	//Set Password for for AP mode (for WEP or for WPA) example:
    	//Password - for WPA: 8 - 63 characters
    	//           for WEP: 5 / 13 characters (ascii)
    	// unsigned char  strpw[65] = "passWORD";
    	// unsigned short  len = strlen((const char *)strpw);
    	// memset(strpw, 0, 65);
    	// memcpy(strpw, "passWORD", len);
    	// sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_PASSWORD, len, (unsigned char *)strpw);
    
    	/* Restart the network processor */
    	configValue = sl_Stop(0);
    	configValue = sl_Start(NULL, NULL, NULL);

    after the named function. Fault ISR is generated by the first line of the code.

    I have attempted swapping the order, so that  VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); comes after the code snippet, but still generates Fault ISR. Debugging, the fault is generated as a result of this line:

    OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->GlobalLockObj, SL_OS_WAIT_FOREVER));

    which is located within simplelink/driver.c.

  • Hi Peter,


    Please refer ConfigureMode() function in wlan_ap example code. This function take SSID name from uart and set it.

    You may getting fault ISR for following reason:
    1. You are not calling NWP/simplelink APIs from task/thread in OS environment. In OS environment all NWP call should be called from task/thread. Can't be called directly in main().
    2. You are using network API before starting NWP. Please make sure sl_start get call very first before the any network/simplelink API


    Regards,
    Aashish
  • Hi Aashish,

    I've taken a look at wlan_ap example.This is a useful example thank you.

    1.) I copied the same code from wlan_ap into a task (which I have tested previously and know runs without any errors). I set the SSID to a constant rather than obtain it through UART. I still generate fault ISR.

    2.) I believe this means "VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);" should come after I have attempted to set my own SSID? Nevertheless I tried both orders, calling VStart in main, in the thread before SSID set, in the thread after SSID set. All generate fault ISR.
  • Hi Peter,

    PeterM4Home said:
    2.) I believe this means "VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);" should come after I have attempted to set my own SSID? Nevertheless I tried both orders, calling VStart in main, in the thread before SSID set, in the thread after SSID set. All generate fault ISR.

    No, you need to call VStartSimpleLinkSpawnTask() in main(). This task should be activated before any simplelink call. All simpelink call should be called from task. Please refer below code snippet.

    void mainTask()
    {
    
    //sl_start();
    //setSSID();
    
    //create more task to do something, if needed
    
    
    //while(1); or exit()
    
    }
    
    int main()
    {
    
    //driver initialization
    
    //VStartSimpleLinkSpawnTask()
    
    //osi_TaskCreate(mainTask);
    
    //osi_start() 
    
    }
    

    osi_start() will activate the scheduler. No task will run till osi_start() get call in main. Also do step-by-step debugging and let us know which call causing crash.

    Regards,

    Aashish

  • Hi Aashish,

    Confirm that this works - if you add a vTaskDelay to before sl_start. Appears there is an OS delay within simplelink task that allows other tasks to jump in, and that seems to prevent setSSID ever running.

    I found this as stepping through the code allowed me to change the SSID, but running without breakpoints did not.

    I power cycled and formatted the device to confirm that the code was able to change the SSID without breakpoints (once delay was included) and it can.

    I have a bit of difficulty now with setting the password. I believe the following code called after setSSID() should set the AP password to "aaaaaa":

    unsigned char  val = SL_SEC_TYPE_WPA;
        sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SECURITY_TYPE, 1, (unsigned char *)&val);
        Report("set Security called...");
        ASSERT_ON_ERROR(lRetVal);
    
        unsigned char  strpw[65];
        unsigned short  len = 6;
        memset(strpw, 0, 65);
        memcpy(strpw, "aaaaaa", len);
        sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_PASSWORD, len, (unsigned char *)strpw);

    I am unable to connect to the access point as the password is apparently incorrect?
  • My bad- password for WPA must be a minimum of 8 characters.

    I can now connect to my access point - cant load a web page from it, something about: err_connection_refused (chrome) and dns_server.
    I'll mark answer as verified and start a new thread if I still have issues

    Thank you for your help Aashish (and Glenn)