Photon blinks blue after every flash, needs "particle setup wifi" every time

Device type: Photon (0.6.0)
Firmware version installed on the device: Tinker
Firmware flashed from: Build, CLI (1.19.4), Android App

I have a Photon that seems to lose Wifi credentials after every firmware flash. After troubleshooting, this is what I have:

  • The Photon is blinking blue
  • The Photon has no jumpers attached to it – just the USB cable, on a breadboard
  • It has just been re-flashed with 0.6.0, using the Particle Device Updater
  • I run particle setup wifi from the CLI (1.19.4), and it successfully joins my network
  • The Photon connects to the cloud, and breathes cyan. I can confirm Tinker works correctly with the Android app
  • I re-flash Tinker using either the Android App, Build, or CLI (same result either way)
  • The Photon resets, and quickly starts to blink blue again.

I haven’t seen this before. It was working as normal earlier today, while I was starting to set up an Adafruit ADS1015 ADC. The Photon was connected to that ADC over I2C, as well as to an analog sensor, and a few Neopixels. At some point the blue “listening mode” just started happening after every firmware flash.

Does it look like something was damaged? It is able to successfully connect the the cloud, and works fine after the wifi setup, it just needs the wifi setup every time. I would appreciate any help you can offer.

Thanks!

James

While it is possible to fry or wear out the flash area where WiFi credentials are stored, it’s not that likely tho’ (unless you kept calling WiFi.setCredentials() or WiFi.clearCredentials() excessively).
In order to check if there is something wrong with that area, you could flash this code (with your personal WiFi data)

SYSTEM_MODE(SEMI_AUTOMATIC)
SYSTEM_THREAD(ENABLED)

void startUp()
{
  WiFi.on();
  delay(5000); // you've got 5 sec to open a serial terminal to see the output
  Serial.begin(115200);
  pinMode(D7, OUTPUT);
  if (WiFi.hasCredentials())
  {
    digitalWrite(D7, LOW); 
    WiFiAccessPoint ap[5];
    int found = WiFi.getCredentials(ap, 5);
    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);
    }  
  }
  else
  {
    digitalWrite(D7, HIGH); // signal there were no credentials, so we need to set them anew
    Serial.println("need to apply default creds");
    WiFi.setCredentials("yourSSID", "yourPWD", [ WPA2 | WPA | WEP ], [ WLAN_CIPHER_AES | WLAN_CIPHER_TKIP | WLAN_CIPHER_AES_TKIP ]);
  }
  WiFi.connect();
  waitUntil(WiFi.ready);
}
STARTUP(startUp())

void setup()
{
  Particle.connect();
}

void loop()
{

}

The D7 LED should stay off after the first run of that code.

Thanks for your help, ScruffR! I flashed the code you provided to my Photon (and an additional one, to test), and it worked smoothly on both.

I’m now in the unfortunate/fortunate circumstance where I can’t replicate the initial behaviour - it seemed to go away over night. I flashed Tinker immediately after your code, then flashed my project code, and neither produced the blinking blue light. I didn’t change anything meaningful (that I’m aware of), so I guess I’ll be happy the issue is addressed for now.

If I do manage to replicate it, I’ll come back to this thread. Thanks again for your quick reply, and your help!

James

2 Likes