Photon Not Connecting to Cloud [SOLVED]

It started with this particular Photon, where it was working just fine. Then one time after Flashing it via the Web IDE, it almost connected and then started flashing blue. After this, no matter what I did, it would go into listen mode on boot.

So I then set up the Wi-Fi SSID and credentials etc. using the CLI. Now it flashes green and then flashes cyan, but never connects to the cloud. I have another Photon right next to it and it connects to the cloud instantly. Next, I flashed the Blink and LED program using the CLI but the behavior is still the same. That is remains in flashing cyan and never connects to the cloud. I then flashed an empty program and its still the same.

Now, when it first boots, and flashes cyan, it also rapidly switches to flashing red and then back to cyan. It does this for a bit, and then just flashes cyan endlessly. The video here shows what I mean. The video is not long enough to show that it eventually just flashes cyan.
Video showing the behavior

Since I don't need Wi-Fi in this particular case. I tried setting

SYSTEM_MODE(MANUAL);

before the steup() method, and flashed the Photo with my original code. I'm not sure what the LED is supposed to do in this mode, but it still does the same thing and my code doesn't execute I thought it would.

I'm not sure what to do/try next.

Try this

particle keys doctor <yourDeviceID>
particle keys server
1 Like

Also, making sure your CLI is up-to-date and doing “particle update” while in DFU mode never hurts :smile:

Ok, for some reason, even though openssl is in the system path, it can’t find it. So generated the .pem file manually. Now I’m not sure where the next step expects to find this file, but I did it nonetheless.

I then did the
particle keys server

I got this in the output

Found DFU device 2b04:d006
checking file C:\Users\Shiv\AppData\Roaming\npm\node_modules\particle-cli\keys\rsa.pub.der
spawning dfu-util -d 2b04:d006 -a 1 -i 0 -s 2082 -D C:\Users\Shiv\AppData\Roaming\npm\node_modules\particle-cli\keys\rsa.pub.der
dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

Deducing device DFU version from functional descriptor length
Deducing device DFU version from functional descriptor length
Opening DFU capable USB device...
ID 2b04:d006
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #1 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "DCT Flash   "
Downloading to address = 0x00000822, size = 512
Download        [=========================] 100%          512 bytes
Download done.
File downloaded successfully
Invalid DFU suffix signature
A valid DFU suffix will be required in a future dfu-util release!!!
Okay!  New keys in place, your device will not restart.

The device didn’t re-start, it was still in DFU mode. So I re-started it. No change, still the same.

"particle update"

Won't that update the firmware on the device?

Ok, my issues with the openssl path was that I didn't use a new command windows after adding openssl to my system path. So I did that and then did the

particle keys doctor

This time it worked! The device booted a few times and it seem like my code is executing (I see a breathing white LED), since I'm in MANUAL mode (no Wi-Fi and no Particle Cloud) either. I'll hook this device up and let you know if it's working

1 Like

Yep, my Photon is working! @ScruffR, thank you.

However, all this begs the question…what happen? Why did I have to re-generate the keys in the first place? What if this happens when these devices are in the field?

1 Like

I updated the particle CLI using

npm update -g particle-cli

Didn’t look like I needed it, but, yes, it was worth it to ensure the CLI is up to date.

That will update the system firmware on the device, not the user firmware. Having the latest system firmware should do nothing but good, and you can always revert back it it doesn’t :smile:

A CLI update is required when new system firmware gets released in order to have particle update do the right thing.

If you remove your current CLI installation and reinstall it via the new CLI installer for Windows, you should get auto-updates whenever a newer version arrives.

1 Like

Yes, I thought you were saying “update the CLI”. Yes my photon already has the latest system firmware.

Thank you. I wasn't aware there was a windows installer for the CLI (at least that's not how I remember getting the CLI installed in the first place.

I was saying both for the reasons mentioned by @ScruffR above :wink:

Thank you both @ScruffR and @Moors7 for your input and help. I appreciate the help tremendously. CLI and Firmware updates aside, the glaring question remains…

What happened and why?

1 Like

There are some possible reasons.

  • Device brown-out can damage the keys on your device
  • Particle keys get renewed from time to time for security reasons (with a fade-out of old ones) but if your device was offline for too long, it didn’t get the new keys while the old ones were faded out
  • and others I can’t think of at the mo’ :blush:

The same Photon has lost the keys I’m guessing again. This time I was Flashing it via the CLI (DFU mode) and if finished flashing and went straight into listen mode (resetting does the same). I set up the WiFi and now if flashes cyan.

Doing these two steps (again)

particle keys doctor <yourDeviceID>
particle keys server

fixed the issue (whew!). So apparently flashing the device using DFU can clear WiFi settings and the keys ;). In addition to the other possibilities @ScruffR mentioned. This has happened to be twice in literally as many times of flashing.

1 Like

I’d like to mention that this particular Photon takes an inordinately long time to connect to the cloud (as compared to the other photons I have, with all other environment variables WiFi access point, signal strength etc. being the same). I’m talking 1-3 minutes most times.

How do you do the DFU flashing?

I’ve also got one Photon that takes ages to reconnect.
On first connect after power gets supplied it connects OK, but subsequently it literally takes minutes. No clue why :weary:

Not sure what you're asking really :). I put the Photon in DFU mode and then using the CLI, I do particle flash --usb firmware.bin Is that what you're asking or something else?

Because of that.
Usually flashing the way you (and I) do it, should not clear the WiFi credentials, hence the question.

On the other hand, flashing with dfu-util directly with other target addresses might be able to clear the creds.