Network hangs with slow cyan blink

photon
Tags: #<Tag:0x00007fe21faaccc0>

#21

It does sound very similar, but not exactly the same issue. If I remove the internet while awake, the devices eventually go back to the slower cyan blink of trying to connect to the cloud - as if they know they lost the connection. And if the internet comes back relatively quickly (before entering sleep) they get back online.

In my network hung case, it seems as if they don’t stop trying to connect, even when Particle.disconnect() is called. They are stuck in this trying to connect mode and even when the internet comes back they can’t get connected.


#22

And another pertinent piece of information here; the devices have two sets of WiFi credentials. A primary one where I remove the internet connection and a secondary one that is accessible and has an internet connection. I have seen no indication that the devices give up on the primary and attempt connection to the secondary. I’m not sure this is relevant to the network hang, and it is particular to our lab and not a field setting.


#23

Using the test code above, but switching out while (Particle.connected() == false) with if (waitFor(Particle.connected, MAX_WAIT_FOR_CLOUD)) and using my bCloudConnected variable just before sleep at if (Particle.connected()) to avoid that function call seems to solve the network hung problem as the the Photon will recover on the next wake-up cycle and connect to the cloud.

But oddly, with no cloud connection possible, when falling out of the waitFor,

      Particle.disconnect();  // stop trying to connect
      delay(20);
      WiFi.off();             // abort this attempt and save power

does NOT terminate the attempt at connection and does NOT turn the WiFi off. Those calls seem to have no affect. This is true, just before sleep as well with no cloud connection. It goes to sleep in the looking for cloud state. It wakes up in that state also but the code changes noted do something that allows the device to break out of network hung and connect to the cloud. I also stretched out the delay after cloud disconnect (or in our case: stop trying to connect) to 3s to make sure to allow time for disconnect to no avail.

Then I tried not calling Particle.disconnect() at all and just calling WiFi.off(). This also does not abort the cloud connect attempt and does not turn the WiFi off.

So I will need some extended testing to make sure network hung is gone for good. But now there is a secondary issue that raises it’s head - how do we really abort the cloud connect attempt?