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.

CC3220SF-LAUNCHXL: Unable to add SSID and password

Part Number: CC3220SF-LAUNCHXL

Hi Experts,

I'm trying to get data from HTTP server and I succedded in that but after getting the data when I try to use following statement I'm getting configASSERT.

ret = sl_NetCfgGet(SL_NETCFG_MAC_ADDRESS_GET, 0, &macAddressLen, &macAddress[0]);
  //SlSecParams_t secParams;
  SlWlanSecParams_t secParams;      // added by Manish
  secParams.Key = (signed char *)pstWiFi->Sta_Profile.Key;
  secParams.KeyLen = pstWiFi->Sta_Profile.Key_Length;
  secParams.Type = pstWiFi->Sta_Profile.Sec_Type;
  sl_WlanProfileAdd((_i8*)pstWiFi->Sta_Profile.SSID,
                    pstWiFi->Sta_Profile.SSID_Length,
                    macAddress,&secParams,0,7/*WiFi priority*/,0);

configASSERT error is from port.c file.

void vPortEnterCritical( void )
{
    portDISABLE_INTERRUPTS();
    uxCriticalNesting++;

    /* This is not the interrupt safe version of the enter critical function so
    assert() if it is being called from an interrupt context.  Only API
    functions that end in "FromISR" can be used in an interrupt.  Only assert if
    the critical nesting count is 1 to protect against recursive calls if the
    assert function also uses a critical section. */
    if( uxCriticalNesting == 1 )
    {
        configASSERT( ( portNVIC_INT_CTRL_REG & portVECTACTIVE_MASK ) == 0 );   // Gets stuck here
    }
}

Can anyone please let me know what is error in that. I have verified this with network_terminal demo code it works fine there but not in my application. Please help me in this matter.

  • Are you calling this from a Simplelink event handler?

    What SDK version are you using?

    Please try to run the code from a separated thread and not from the event handler.

    BTW. I'm not sure what are you doing with the MAC address. This is the mac address of the device itself, it shouldn't be sent as BSSID of the AP you want to connect to (you can leave this parameter as NULL).

    Br,

    Kobi

  • Hi Kobi,

    answers to all your queries are:

    1) SDK Version used by me is simplelink_cc32xx_sdk_4_20_00_07.

    2) I'm calling sl_Wlanprofileadd() from a seperated thread (basically I have created a seperated wifi thread for that) only not from the event handler

    3) I have also tried not to pass MAC address of the device in place of that I left that parameter as NULL.

    So, what can be the issue?

  • Hi Manish,

    The macaddr you provide (in the sl_WlanProfileAdd) should be the BSSID of the access point (in case you have it,e.g. having scan results using sl_WlanGetNetworkList). Don't use the device mac address.

    How did you connect to the http server? are you based on the HTTPGet example?

    Have you changed anything in the porting layer?

    which role (station or AP?) is being used? assuming the device is in station role, how did you connect to the local network (before you got the info from the server)?

    The code you've provided is a basic one that shouldn't cause any problem. look for the issue in other place.  

    br,

    Kobi

  • Hi Kobi,

    Based on your questions here follows my answers:

    1) As on the first post you have said not to use MacAddress so I passed that parameter as a NULL.

    2) HTTP is based on OOB demo code I have used that portion but my HTTP server is running well without giving any cause to my application. so from HTTP page if I enter SSID and password for the wifi I'm able to read from the Simplelink app event handler. No my code is not based on the HTTPGet example.

    3) No, I haven't changed anything in the porting layer.

    4) While in AP mode I'm running a HTTP server when I get data from the HTTP page I'm switching back to STA mode and trying to add profiles using sl_wlanAddProfile() in this only I'm getting assert in port.c file line no 312.

    Statement
    
    if( uxCriticalNesting == 1 )
    {
        configASSERT( ( portNVIC_INT_CTRL_REG & portVECTACTIVE_MASK ) == 0 );
    }

    I need to ask here question when we change the change from AP to STA mode do I need to stop HTTP server (I'm using Internal HTTP Server where pages are flashed on the device using Uniflashin /www folder).
    Even I have stopped HTTP web server and tried to change the role of the device to STA mode there also I got same assert.

  • The issue is related to an SL command (Sl_WlanProfileAdd) invoked from an interrupt context.

    Please verify that your code is really running from an application thread.

    I'm not familiar with similar issue and don't know how to reproduce this.

    Br,

    Kobi

  • Hi Kobi,

    I have verified my code that is running from FreeRTOS task. When I'm calling sl_Command for adding sl_wlanProfileAdd this I'm calling from a task named wifi task. So, I think this error I should not get.Because as per you said that aseert is coming from an interrupt

  • Hi Kobi,

    I figured it out what was the issue....... Thanks for your support

  • what was the issue?

  • I have just increased task size and it worked perfectly.