[Solved] Frequent photon offline-online-patch cycles

I've got my Photon hooked to the Core Shield Shield and USB powered. Observing Photon event logs, I see the device frequently reporting offline-online-cc3000-patch-version events. Here's the latest logs(with 'coreid' removed):

event: spark/status
data: {"data":"offline","ttl":"60","published_at":"2015-08-30T19:13:18.364Z","coreid":"<my_core_id>"}
event: spark/status
data: {"data":"online","ttl":"60","published_at":"2015-08-30T19:13:18.362Z","coreid":"<my_core_id>"}
event: spark/cc3000-patch-version
data: {"data":"wl0: Nov 7 2014 16:03:45 version 5.90.230.12 FWID 01-68dd52ec","ttl":"60","published_at":"2015-08-30T19:13:18.399Z","coreid":"<my_core_id>"}

event: spark/status
data: {"data":"offline","ttl":"60","published_at":"2015-08-30T21:09:53.408Z","coreid":"<my_core_id>"}
event: spark/status
data: {"data":"online","ttl":"60","published_at":"2015-08-30T21:09:53.404Z","coreid":"<my_core_id>"}
event: spark/cc3000-patch-version
data: {"data":"wl0: Nov 7 2014 16:03:45 version 5.90.230.12 FWID 01-68dd52ec","ttl":"60","published_at":"2015-08-30T21:09:53.440Z","coreid":"<my_core_id>"}

event: spark/status
data: {"data":"offline","ttl":"60","published_at":"2015-08-31T00:12:04.381Z","coreid":"<my_core_id>"}
event: spark/status
data: {"data":"online","ttl":"60","published_at":"2015-08-31T00:12:23.803Z","coreid":"<my_core_id>"}
event: spark/cc3000-patch-version
data: {"data":"wl0: Nov 7 2014 16:03:45 version 5.90.230.12 FWID 01-e87d72ac","ttl":"60","published_at":"2015-08-31T00:12:24.386Z","coreid":"<my_core_id>"}
event: spark/status
data: {"data":"offline","ttl":"60","published_at":"2015-08-31T03:54:22.176Z","coreid":"<my_core_id>"}
event: spark/status
data: {"data":"online","ttl":"60","published_at":"2015-08-31T03:54:25.556Z","coreid":"<my_core_id>"}
event: spark/cc3000-patch-version
data: {"data":"wl0: Nov 7 2014 16:03:45 version 5.90.230.12 FWID 01-e87d72ac","ttl":"60","published_at":"2015-08-31T03:54:25.595Z","coreid":"<my_core_id>"}
event: spark/status
data: {"data":"offline","ttl":"60","published_at":"2015-08-31T04:16:53.550Z","coreid":"<my_core_id>"}
event: spark/status
data: {"data":"online","ttl":"60","published_at":"2015-08-31T04:16:53.777Z","coreid":"<my_core_id>"}
event: spark/cc3000-patch-version
data: {"data":"wl0: Nov 7 2014 16:03:45 version 5.90.230.12 FWID 01-e87d72ac","ttl":"60","published_at":"2015-08-31T04:16:53.811Z","coreid":"<my_core_id>"}
event: spark/status
data: {"data":"offline","ttl":"60","published_at":"2015-08-31T04:20:50.992Z","coreid":"<my_core_id>"}
event: spark/status
data: {"data":"online","ttl":"60","published_at":"2015-08-31T04:20:50.992Z","coreid":"<my_core_id>"}
event: spark/cc3000-patch-version
data: {"data":"wl0: Nov 7 2014 16:03:45 version 5.90.230.12 FWID 01-e87d72ac","ttl":"60","published_at":"2015-08-31T04:20:51.035Z","coreid":"<my_core_id>"}
event: spark/status
data: {"data":"offline","ttl":"60","published_at":"2015-08-31T04:30:57.968Z","coreid":"<my_core_id>"}
event: spark/status
data: {"data":"online","ttl":"60","published_at":"2015-08-31T04:31:03.036Z","coreid":"<my_core_id>"}
event: spark/cc3000-patch-version
data: {"data":"wl0: Nov 7 2014 16:03:45 version 5.90.230.12 FWID 01-e87d72ac","ttl":"60","published_at":"2015-08-31T04:31:03.073Z","coreid":"<my_core_id>"}

What's this cc3000-patch-version status? Anyone else observing similar behavior? For now, I issue System.reset() if Spark.connected() returns false for 20 seconds. Any better ideas to avoid these frequent disconnects?

@mohnish82 does the Photon blink magenta when you observe those log messages?

Hi @mohnish82,

That’s the device telling you it’s online, and providing some radio version info (the cc3000 publish is a throwback to the core). Your device frequently coming online / offline indicates to me there is either a problem with your wifi network, or your firmware that is causing the device to disconnect or reconnect frequently. Can you try attaching an antenna to your photon, or trying a WiFi channel with less interference?

Thanks!
David

@kennethlimcp I didn’t notice the colors as it’s difficult to predict when it would cycle.

@Dave Wifi range is good. Why should I need to worry about Firmware in a cloud managed device ? :smile:

Anyhow, now it disconnects infrequently after I made the following code change:

  • Earlier, I had Spark.connected() in the main loop, included to
    immediately detect cloud disconnection and do system reset after
    10 seconds. I modified it to not check cloud status in every loop,
    but instead, every 3 minutes.

Seems, to be much stable with this change (only 1 disconnection in past 12 hours). I wonder what’s being done inside that function. Is the code open sourced/available?

Hi @mohnish82,

Good question! Right now the firmware lets you get very low-level, so it’s possible to write firmware that can get in the way of maintaining the cloud connection. We’re working on firmware multi-threading support which should make it easier to develop firmware without impacting the cloud connection. :slight_smile:

Thanks,
David