Jump to content
Sign in to follow this  
nitred

CC3200 Issues while trying to connect to a past WiFi profile

Recommended Posts

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?

 

Share this post


Link to post
Share on other sites

I think there is a security protection where the application can not read the passphrase using sl_WlanProfileGet(). Eitherway, I think you brought up a good to have feature where after a successful Smartconfig(), the Sketch should be able to choose if it want's to connect using the previously successful Smartconfig information or start fresh. I will look into adding this feature.

Share this post


Link to post
Share on other sites

I think this is the same thing I've been looking for - a way of connecting to the WiFi without having to code any connection information. Surely this is essential for a viable IoT application.

 

I'd assumed there would be a WiFi.begin() that would connect using info previously configured by SmartConfig, but there doesn't seem to be one.

Share this post


Link to post
Share on other sites

Has there been any progress on being able to connect/reconnect using the profiles stored vi smart config. (from energia)  This was why I was evaluating moving to the TI boards.  As suggested above wifi.begin  that simply uses the profiles without sharing them with me would be fine.  Or alternatively I could loop through them.   If  so do you have some examples of doing this correctly?

Share this post


Link to post
Share on other sites

I believe my issue posted here

http://forum.43oh.com/topic/8426-cc3200-mod-bricked-with-static-ip/

 

is directly linked to this too. As soon as there's a static IP configuration that doesn't lead to a successful connection (in my case at least one UDP packet sent), the module will stall during wifi.init.

 

I've traced it down to the profile deletion in the init function. I tried to remove profile storage (in all wifi.begin methods) along with the profile deletion in wifi.init, no dice.

If I stick to DHCP, it seems to work

 

indeed, no profiles were used in energia 0013 from what I see in the sources, it was introduced with 0014. Still, it's a big issue for me as those profiles issues crash the chip, I need to further format it with uniflash.

 

any hints on what is causing this ?

Share this post


Link to post
Share on other sites

I keep narrowing down this issue with the profiles, it's really weird.

If I use DHCP only, it works from scratch, most of the time to always. I sometimes have to reset the chip seven times to get it to work then it's going well afterwards, like if the 7 profiles were NOT there and had to be created by successive connections (that's after the chip has been formatted with uniflash).

 

I'm at my wit ends with this thing. I've tried creating the files the CC3200 expects, using uniflash 3.2 and the configuration groups, it didn't change anything. With a static IP, it will first boot, connect and stream. On the next reboot, if the SSID of the wifi is found (router is turned on), it will stall during wifi.init (even with additional delays) during the profile deletion routine. Like if a matching profile is found for the ssid. I've tried rebooting 20+ times no goal.

 

if the wifi is off when the module boots, it will pass the init stage as, from what I assume, no matching profiles are found. In the begin process, a new profile is added (maybe incorrectly) and further reboot will lock during init if the wifi is found during the boot.

 

I've been in situations for which even DHCP will lockup up, but after 7 reboots, it's like the profiles are finally formatted in the flash and can be correctly filled. From there either DHCP or static IP will work.

 

otherwise, sticking with DHCP always works it seems. I couldn't find any obvious differences in the wifi.cpp API between using static and DHCP aside of the call of netcfg but I'm not familiar enough with the TI sdk to follow that down in the rabbit hole... :huh:

 

Side / additional question : what would be the process to have those smart config profiles properly installed in the chip so that energia only has to deal with uploading mcuimg.bin ? from what I understand, the profiles are stored in /sys/ in the file system of the chip (?) but I couldn't find the proper way to generate them with uniflash. If at least I could have the right process to pre format my chip properly then I can further use energia.

 

I've tried formatting the chip in 1MB and 8MB (using the CC3200 *mod*). I've tried including the service pack 10 but while it says it uploaded fine, the process was totally different from the launch pad which mentions upgrading the flash with a slow process, while the MOD version just uploads things in a blitz. I've checked "upgrade" in all the configuration files (config groups) but I'm not even sure the profiles are properly install in the chip. I've tried uploading both the configuration files and the mcuimg from uniflash, the behavior is the same as described above, first boot ok, further boot locks up if the SSID to connect to matches one stored in the profiles. I really can't have the wifi router turned off each time I want to boot my module.

 

on the launchpad (with the latest service pack too), the behavior is slitghtly different : it will stall every 2 reboot. Module starts, it passes wifi.init and streams. Next reboot it will stall. Next reboot will work etc.

 

I can't recall having those issues in 0013 but at that time, there was no profiles used in ccuniflash and they were not used in the wifi class and the service pack was maybe different. I also don't know if there are some important differences between the IC version and the mod version of the CC3200.

 

please help. I can progress while using DHCP but we definitely need static IP to work very soon. Thanks a lot.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...