Electron not responding to Particle.connect() after disconnect, requires System.reset() to reconnect

electron
Tags: #<Tag:0x00007fe21f0271d8>

#1

Our devices will disconnect from the cloud occasionally and will not reconnect with Particle.connect(). We will attempt to connect for 2 minutes using connect() and preform a system reset if this fails. Upon reset the device will reconnect immediately.

Here is an abridged version of our reconnect process:

// Particle.connect is called max once a minute
if (!Particle.connected() && Time.minute() != connectMinute){ 
        this->fadeOrange->setActive(true);
        Particle.connect();
        failedConnect++;

        switch(failedConnect){
            case 1: fadeOrange->setSpeed(LED_SPEED_SLOW);
                break;
            case 2: fadeOrange->setSpeed(LED_SPEED_FAST);
                break;
            case 3: case 4: case 5: System.reset();
        }
        connectMinute = Time.minute();
    } else if (Particle.connected()) {
        failedConnect = 0;
    } 

The disconnects are happening randomly across several devices and run-time to disconnect is not consistent.
Could there be a issue elsewhere in the code preventing the electron from reconnecting normally?
Is there a way to for the electron to reconnect to the cloud without requiring a reset?


#2

What SYSTEM_MODE() are you using?
Are you using SYSTEM_THREAD(ENABLED)?


#3

Yes, SYSTEM_THREAD(ENABLED) and SYSTEM_MODE(MANUAL)


#4

Particle.connect simply sets a flag instructing Device-OS to maintain a connection with the cloud. You don’t need to call it more than one time. On disconnect it will automatically try to recover in various ways up to and including a reset on the cellular modem.

What version of the Electron and Device-OS are you using?

How long does it take to fail? Are you able to gather a trace with cellular AT logs enabled? You can load a DEBUG build variant for your release from https://github.com/particle-iot/device-os/releases to enable the AT logs. Reproducing the issue while capturing those logs can help a lot in narrowing down what the issue might be.