So I have a Core and Photon in my house both acting as temperature sensors. They have both worked reliably for months. Recently, I upgraded both to the latest firmware (0.4.7) and the Photon now refuses to connect. Upon power up, it breathes blue normally, but when I retrieve data from the cloud, the Photon immediately starts blinking green and becomes inaccessible.
I was wondering if this was a firmware issue and so I tried downgrading the firmware to 0.4.5 while it was breathing blue after a reboot. Curiously, the upgrade went smoothly and now it is working as expected. Am I experiencing some kind of bug?
To be clear, I have been running this code for months without an issue and all of this seemed to crop up when I upgraded to 0.4.7. Any comments or suggestions are appreciated.
If your application blocks the system for more than 10 seconds the device will disconnect from the cloud, which is shown by breathing green. As soon as the loop() executes again, the device will attempt to reconnect.
The fix is to find where your code is blocking the system and remove that blockage! While it may appear to work on earlier firmware versions (the device breathes cyan) the cloud has been disconnected. You can verify if your device is still online by attempting to call a function or read a variable - I’m guessing that it won’t work.
Just some thoughts on new Photons if it helps anyone,
I bought 4 photons, 3 different experiences all working now.
1st photon: connected usb, slow blue blink, to com port to get #ID and set wifi, the process self rebooted to slow cyan blink (after other colours) after ~1 min. I went online and registered/claimed using the #ID. I push a blank sample application to force firmware update.
(I believe this is the normal expected process)
2nd photon: connected to com, set wifi got stuck ‘saving data…’ and would not self reboot (no reboot after 10 min). had to hold setup to clear the wifi, no other ‘safe mode or rebooting fixed it’ the second time setting the wifi worked as above.
3rd photon: connected to com, set wifi got stuck again (no auto reboot), but this time on reboot it would stay green flashing, thinking it would connect i left it for 30 min with no change in led??? ( I typed the wrong wifi password ) but there was no change in led colour so, i didn’t know??? Reset the wifi by holding setup and worked as above.
4th photon: same as 1st.
Also all the photon are new out of the box, the ‘v’ for version information did not work, and ‘m’ for mac address hung the photon? after firmware updated they all now work identically.
Thank you for the feedback. This situation is particularly interesting. Here are some responses to at MDMA’s note.
The code is completely non-blocking. sleep() is not used anywhere. (The same base code is used in my Core and it has none of these issues.)
While the cloud disconnects, it never reconnects and sits in flashing green forever
Since rolling back to 0.4.5, I have never seen this issue with the exact same code
Something still feels odd with 0.4.7 with it disconnecting and never reconnecting while 0.4.5 runs flawlessly. It is hard to pinpoint what exactly is going on.
Blocking code can be due to more than simply calling sleep() - a loop that doesn’t terminate for example.
If you haven’t updated your core to 0.4.6 or newer then it won’t exhibit this behaivor - the LED will still show breathing cyan even though the device has dropped off the cloud.
The fact that it never reconnects is further evidence that your application code is stuck somewhere so the system cannot run it’s housekeeping checks, which would reconnect the device to the cloud.
Rolling back to 0.4.5 won’t show this issue, since the code to detect a stalled app was added in 0.4.6. The device may look to be online, but you should then try fetching a variable or calling a function - you’ll find the device is not reachable.
Okay so what seemed to work for me was holding down the RESET button until it flashed purple. Then I flashed the device from the particle.io/build page.
My computer wasn’t able to run particle setup correctly or flash tinker so I connected it via the particle app on my iphone. I wasn’t able to flash tinker from my iphone, but it allowed me to connect it to the IDE. The IOS app been my fall back when all other things fail.
Yes, that would have put your device in safe mode - your application isn’t run and so any code in the application that is blocking the cloud would be skipped, allowing the device to stay on the cloud.