[Solved] - Troubleshooting Kickstarter era Core's WiFi.getCredentials() [CC3000 can't read back creds.]]

Hi, long time no post.

Anyways, I’ve got an older CC3000 core that’s compiling with 0.5.0 firmware that I’m trying to run the following code snippet as part of my setup{}

if (WiFi.ready()) {
    Particle.process();
    Serial.print("Has Credentials:\t");
    Serial.println(WiFi.hasCredentials());
    Serial.println("Last 5 Cached WiFi networks:");
    WiFiAccessPoint ap[5];
    int found = WiFi.getCredentials(ap, 5);
    Serial.println(found);
    for (int i = 0; i < found; i++) {
        Serial.print("ssid: ");
        Serial.println(ap[i].ssid);
        // security is one of WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA, WLAN_SEC_WPA2
        Serial.print("security: ");
        Serial.println(ap[i].security);
        // cipher is one of WLAN_CIPHER_AES, WLAN_CIPHER_TKIP
        Serial.print("cipher: ");
        Serial.println(ap[i].cipher);
    }
} 

I mostly borrowed this code from the documentation and added a few lines to debug further: https://docs.particle.io/reference/firmware/photon/#getcredentials-

WiFi.hasCredentials() spits out “1”, but found = 0 in this example, so the loop doesn’t run.
I’ve manually set found = 5 to force the loop, but as you’d expect, there’s no meaningful output.

So, why do I appear to have credentials, but can’t iterate through them?

A few other notes; This core has been offline for many months, but appears to reach the cloud and update just fine. In it’s past use, it primarily only used a single SSID. I was looking to cache additional wireless credentials, but based on a few other posts concerning WiFi.setCredentials() I was leery about implementing this before I could use WiFi.getCredentials() to output successfully. I am able to use other WiFi.class functions in setup{} to output my core’s ip, etc.

I’m open to suggestions, including alternative means to cache additional SSIDs (via mobile app, CLI listen mode, etc).

Hi @BlueLou

The TI CC3000 WiFi module on the Core does not allow reading back any of the credential information, so this cannot work.

If you look at the doc page you mention, it is for Photon, but you can switch to Core or Electron by pulling down on the device type in the upper right corner. When you switch to Core, you can see that this limitation is doc’ed:

https://docs.particle.io/reference/firmware/core/#getcredentials-

I did not see the dropdown, thanks for the tip and for clearing that up.

1 Like