I have had my Photon running my firmware (for logging wireless sensor data) for a few days now. It has been working fine. This morning it was still up and breathing cyan just fine, and it seemed to be running my firmware OK. However, the Particle cloud reported it to be offline and I could not access it from my javascript client. I reset it (using the reset buttoon) and it came back up OK. But I am concerned about what happened? Any ideas as to why the cloud did not know it was online and how to make sure this does not happen in the future? Resetting the device wipes out the internal log of sensor data that the Photon is keeping.
My firmware has been stable for months and running fine on Cores for weeks on end. However, the Photon has exhibited occasional connection stability issues such as this ever since I started testing with it. I am running version 044 (release) in automatic mode. I am doing a Spark.syncTime() once per day and I have 2 functions and 4 variables exposed to the Cloud.
Is anyone else experiencing similar problems? Should I be doing something else in loop() (such as calling Spark.process() ) to help keep the cloud connection up? This is supposed to happen automatically in automatic mode.
Does your application rely on external sensors/circuitry to work ? If not and you’re willing to share your app with me, I can offer to run it while snooping the network traffic to see what’s going on. Send me a private message if you’d rather not post it.
I have plenty of long-running apps on photons, and as of 0.4.4 things have become orders of magnitude more stable in my testing. If you’re seeing problems under 0.4.4, then I want to help identify the problems and fix them.
@kennethlimcp: how do I bump up to 045? I don’t see it released on GitHub. Can I recompile my firmware with the web IDE and have it update to 045 automatically? I agree with @AndyW that 044 is much more stable than previously and has important bug fixes to boot, and 045 promises additional bug fixes that I could use (I have been working around some issues in the meantime).
It requires an I2CEEPROM to get past setup(), but you could comment this out in the code. The device responds to wireless sensor signals which require RF receivers that interrupt on pins D3 and D4 in order for the Photon to decode and process the sensor trips. However, this issue arose overnight, while no sensor signals were being sent. loop() appears to be running (see below for how I know this) and the Photon is breathing cyan but the cloud reports that it is offline. So you don’t need the RF receivers - unless the interrupt processing did something to the RTOS to stop the device from communicating with the cloud.
Two ISR’s respond to the two interrupts and perform decoding of the signals to determine if a registered sensor has sent out a signal. A flag is set (along with the sensor code) so that loop() picks up the fact that a new sensor trip has been received. The processing, filtering and logging of sensor related data is performed in loop(). For visual debugging purposes, the D7 LED is blinked twice (via a non-blocking blink function) whenever a valid code from a registered sensor is received and processed. This is how I know that loop() is running - I can trip sensors and see the double blink, but I cannot access the device via my javascript client because the cloud reports that it is offline. You won’t be able to duplicate this behavior without wireless sensor devices, the RF receivers and detailed instructions about how to register sensors (via Spark.function()). However, the system was working online the night before and I found it offline in the morning (when I tried to readout the internal log again via the cloud), with no sensors being tripped overnight - just looping around awaiting new sensor data and/or cloud request to readout logged entries. I’m not sure how to duplicate the problem, however – it just happened last night and never happened before.
@Moors7: I used the web IDE to recompile with firmware v0.4.5. Since I do not have a means to reproduce the problem, I will just watch it for a few days and see what happens. I’ll report back here if I encounter the problem again.
However, I did observe that if I power down and then power up my Photon (waiting 5 seconds between power down and up), the Photon sometimes shows offline in the cloud, even though it has powered back up and has completed setup() and is into loop(). Power cycling again, or pressing the reset button seems to get the device online. The problem seems to occur randomly; at least, I have not found a deterministic way to reproduce it. This MAY be related to what I previously reported. However, when the Photon had gone offline during the night, it was powered by USB from a laptop, so it is quite unlikely that the cause of it going offline was a power cycle (since the laptop battery provides a very good UPS).
An update: the problem has not reoccurred over the past few days. Furthermore, cycling power a few times today does not cause the device to come up offline, as it did, about 50% of the time, a few days ago. Likewise, the system time now always seems to initialize correctly, unlike a few days ago when it would sometimes initialize to a valid but incorrect time. I have not reflashed any firmware during this time period. The problems seem to have simply disappeared. of course, I was not previously able to determine a procedure to reliably reproduce these problems, so I cannot be sure. I did notice, however, several other threads have been started along these lines. Somehow, it appears that there must have been some RTOS-system firmware to cloud connectivity issues that appear to have now been resolved (hopefully, permanently).
Since I cannot reproduce these problem over the past few days, I propose to close this thread and create a new one (or respond to another similar one) if any of these problems show up again.
Particle folks – if you did something to the Cloud that may have helped to resolve these issues, please let us know, and THANK YOU.