Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

CC3200 Issues while trying to connect to a past WiFi profile

$
0
0

Hi,

 

I'm using a cc3200 Launchpad. On my first run, I provided the SSID and Passphrase to connect to my router as shown below:

char ssid[] = "testrouter";
char passphrase[] = "testpassphrase";
WiFi.begin(ssid, passphrase);

I've noticed that there was a recent addition into the WiFi.begin(ssid, pass) method in the WiFi.cpp file which seems to add the SSID and Passphrase into its own profile.

 if (iRet == 0) {
        sl_WlanProfileAdd(ssid, NameLen, 0, &SecParams, 0, 6, 0);
        _connecting = true;
        return status();
    } else {
        return WL_CONNECT_FAILED;
    }

I'm having issues when I'm trying to retrieve the profile using the "int sl_WlanProfileGet()" method. I'm able to retrieve the SSID but unable to retrieve the Passphrase correctly. Following is the code I'm using to retrieve the SSID and Passphrase:

char pName[32];
int pNameLen;
unsigned char pMacAddr[8];
SlSecParams_t *pSecParams;
SlGetSecParamsExt_t *pSecExtParams;
unsigned long pPriority;
  
sl_WlanProfileGet(0, pName, &pNameLen, pMacAddr, pSecParams, pSecExtParams, &pPriority);  // index 0

pName[pNameLen] = '\0';
pSecParams->Key[pSecParams->KeyLen] = '\0';

Serial.println(pName);              // prints "testrouter"    -CORRECT
Serial.println(pSecParams->Type);   // prints 2               -CORRECT (SL_SEC_TYPE_WPA)
Serial.println(pSecParams->Key);    // prints "" -WRONG

WiFi.begin(pName, pSecParams->Key); // doesn't connect successfully


Please let me know if I'm doing something wrong or if there is another way to connect to a past profile? Thanks!

 

Edit: My actual problem is that, if I do Smartconfig and I successfully send the SSID and Passphrase to the CC3200 and it connects to WiFi router but the CC3200 powers OFF and then powers ON again, how do I make it connect to the last known SSID and passphrase without having to do Smartconfig again?

 

Viewing all articles
Browse latest Browse all 2077

Trending Articles