System.Reset does not restart Photon

In my application, after some Particle variables are changed in the cloud, I need to restart my Photon. For this I am using System.reset.

When my code was short and simple, things worked well. But now, when System.reset is executed, the Photon seems to restart but never connects back to the cloud until I either recycle power or press the reset button.

What could be causing that? Is there a more reliable was to restart the Photon?

I also noticed that every time after I flash new code, the Photon keeps flashing green after re-flash success. It does not connect to the network until I either recycle power or press the reset button.

I would appreciate the community’s help.

There is an issue about WiFi.off() without explicitly calling Particle.disconnect() beforehand, which may well be connected.

1 Like

Thanks @ScruffR.

Do you mean before I issue

System.reset()

, I need to execute:

Particle.disconnect;
Wifi.off;

==============================

Update:

I tried the code below. After executing it, the Photon just starts flashing white and nothing happens.

void resetALL()
//Resets ALL
{
Particle.disconnect();

#if (PLATFORM_ID == 0)
// Core code here
#elif (PLATFORM_ID == 6)
// Photon code here
WiFi.off();
#elif (PLATFORM_ID == 10)
//Electron code here
Cellular.off();
#endif

delay(2000);
System.reset();
delay(2000);
}

No, this should not be necessary. That's the reason why this is filed as issue, but it'd be worth trying whether or not this helps solve the problem.

But naturally, when you switch disconnect and switch off the WiFi, you will need to switch it back on and reconnect after wake.

Thank you @ScruffR.

Is there a “bullet-proof” way to restart the Photon by simulating a “reset” button press? I realize that an additional processor can be used along with a relay but is there a simpler way?

Once the issues are addressed System.reset() should be just as bullet-proof as one should want.
BTW, the RESET button doesn’t always cure all problems either, that’s something that will also needs to be addressed in the bootup sequence.

I tried to restart system by setting RST pin to LOW. I used:

digitalWrite(RST, LOW);

also tried

digitalWrite(rst, LOW);

But the compiler did not recognize the RST pin. How does one refer to that pin in code?

Thanks in advance,

This won’t work, as RST is not a GPIO pin but a dedicated pin with its sole purpose to reset the µC.

2 Likes