Electron RST pin versus System.reset()

I am observing different behaviour depending on whether I reboot my Electron using the RST pin or by invoking the System.reset() function. Specifically, my Particle functions are “not found” after a reboot by grounding the RST pin. The functions do come back on line after a System.reset(). Can anyone explain to me why there is this difference? Is it by design, or am I doing something wrong?

In general both should behave pretty much the same.
Although, by invoking the reset by software allows for the Device OS to issue an event which your application code could subscribe to in order to execute some finishing tasks. This can’t be done when resetting via the RST pin.
Another difference that might contribute to what you are seeing is the difference in timing. Generally you’d hold the µC longer in “reset state” with the pin than the command would.

But none of that would explain the failed registration of Particle.function() and I personally have never seen that behaviour either.

So what Device OS version are you running?
What SIM are you using?
3G or 2G?
What extra circuitry have you connected?
Could you provide some stripped down code that demonstrates that behaviour?

I was running OS version 0.6.2
Offline at present as I struggle with the upgrade to 0.7.0
I will provide further info once I get that sorted out.

I’d suggest you make sure you have CLI 1.30.0 installed and then update via USB

particle flash --usb tinker
paticle update

Ok, will do. Thanks for the suggestion ScruffR.

OK, i updated Node (to 8.11.2), CLI (to 1.23.0) and Electron firmware (to 0.7.0).
I am no longer getting the consistent behaviour that I observed yesterday. Instead I find - working from the Particle Console https://console.particle.io/devices/xxxxxxxxxx - the following erratic behaviour:
Ping is almost always successful (6 of 7 attempts).
Functions are found 3 of 7 attempts, and not found the remaining times.
I reset the device several times - sometimes with remote reset using a Particle.function call to System.rest(), and sometimes by pulling the Electron’s RST low.
I always waited until the Electron was breathing cyan before each of the above tests was made.

Here is the stripped down bare bones code I used for the tests:

// General purpose stuff
int resetWatchmate(String command);                     // This Particle.function applies a system reset when called.
bool resetFlag       =  false;

// Reporting parameters
bool transmittingData = false;                          // transmittingData = true will Particle.publish. Change this remotely using the Particle.function "tmode"
int transmitMode(String command);
int lastReportTime;                                     // The last time we reported data (in seconds since 1970).

void setup() 
    Serial.begin(9600);                                 // Opens a Serial port so you can listen over USB.
	delay(2500);                                        // This delay is needed to allow next print command to work. 
    Serial.printlnf("  ");
    Serial.printlnf("  Setup begins at "+Time.timeStr());
    lastReportTime = Time.now();                        // Present time in seconds since 1970, but only valid if Electron is connected by cellular.
    Particle.function("tmode", transmitMode);
    Particle.function("Reset", resetWatchmate);
    delay(5000);                                                // Give everything a chance to warm up.
    }                                                           // End of setup

void loop()         // Each pass through this loop takes approx 10s
    if(resetFlag) System.reset();           // Reset WatchMate.
    }                                                           // End of main loop.

int transmitMode(String command)                                    // Remotely change whether publishing to the cloud or only reporting data over Serial.
    transmittingData = atoi(command);
    if(transmittingData) Serial.printlnf("WatchMate is now publishing reports to the Internet.");
    else Serial.printlnf("WatchMate is now NOT publishing reports to the Internet.");
    return 1;

int resetWatchmate(String command)                                  // Reboot.
    resetFlag = true;
    Serial.printlnf("WatchMate reset requested remotely by user.");
    return 1;

I have concluded that I simply have a marginal cellular network connection. Is there a way - other than the go/nogo Electron LED indication - to determine the quality of the cellular network connection?

Hmm, how about


I’m pretty sure particle update wich 1.23.0 won’t update to 0.7.0

However you should register Particle.function() as early as possible, but definetly before this delay(2500).

Well, if I could figure out how to send you a screen shot I would show you. I confirmed those version numbers before I posted, and I just reconfirmed them again.
Device OS: 0.7.0
C:\Users\Phred\AppData\Local\particle>particle --version

I gather you are using Windows. In that case you should use the CLI Installer to get the most recent version and for future updates you’d do particle update-cli.

But before remove the existing CLI via npm uninstall -g particle-cli and make sure there are no other instances of CLI installed.

1 Like

As instructed:
C:\Users\Phred\AppData\Local\particle>npm uninstall -g particle-cli
removed 542 packages in 139.918s
Now how do I “make sure there are no other instances of CLI installed”? I have several folders with “particle” in their names. I don’t won’t to break anything that I may need later.

If you haven’t got your personal projects stored in any of them or installed anything else Particle related than CLI, these folders should not hold anything essential.
But if you can’t run particle anymore, you should be good to go with the installer

1 Like

Windows reports two Particle apps:
Particle Toolchain Installer
Particle USB Drivers (by Particle Indistries [sic])

Rip 'em out?

If you are on Win10 you won’t need the drivers anymore.
If you have the local toolchain installed, I’d leave that there.

Particle USB drivers and toolchain uninstalled.
Rebooted Win10 for good measure.
’particle’ is not recognized as an internal or external command,
operable program or batch file.
Downloaded ParticleCLISetup.exe and ran it.

As instructed by the installer I ran:
C:\Users\Phred\AppData\Local\particle>particle setup
’particle’ is not recognized as an internal or external command,
operable program or batch file.

Looks as if the install did not complete correctly, but there were no error messages. Run it again?

OK, wrong path. I tried again:

C:\Users\Phred\AppData\Local\particle\bin>particle setup
 _ __             _   _      _
| '_ \  __ _ _ __| |_(_) ___| | ___
| |_) |/ _` | '__| __| |/ __| |/ _ \
|  __/| (_| | |  | |_| | (__| |  __/
|_|    \__,_|_|   \__|_|\___|_|\___|
 Setup is easy! Let's get started...
> It appears as though you are already logged in as phred@live.ca
? Would you like to use this account? Yes

! PROTIP: Hold the MODE/SETUP button on your device until it blinks blue!
! PROTIP: Please make sure you are connected to the internet.

> I have detected a Electron connected via USB.
? Would you like to continue with this one? Yes

! Electron(s) cannot be setup via the CLI.

! We need to collect billing information, which we cannot do securely via the command line.
! Please visit https://setup.particle.io to setup your Electron.

So I cannot setup my Electron using CLI?

I don’t think I need to setup my Electron; it already shows in the console https://console.particle.io/devices/xxxxxxxxxxxx running OS version 0.7.0

Also Particle CLI now reports version 1.30.0

Used the newly installed CLI to flash my sketch to my Electron.
Now both Ping and Particle Functions seem to respond as they should every time. Amazing!

Thanks ScruffR. I never would have found this bug without you.

I guess you Electron was already claimed to your account, so no need to run particle setup with it.

But glad you got the stubborn thing finally tamed :wink: :+1:

On the other hand, with the CLI Installer it should not matter from where you are running particle.
Maybe the installer didn’t set the PATH variable correct - had you checked the respective checkbox in the installer dialog?

I’m sure you are correct that it is simply a PATH question. I don’t recall being given a PATH option by the CLI installer, but i’m pretty sure I accepted all the default options.

However, my Particle.function registration issue remains. Even with my bare bones test code, I frequently get “no functions found” and a failed ping - all while the Electron is breathing cyan.

I’m assuming for now that it is a marginal cellular coverage issue. My iPad shows 2-3 bars on the local cellular data connection. The Electron frequently drops into slow or rapid flashing cyan mode, also indicating marginal signal strength. I would put the Electron outdoors, but it would be awkward doing development work given the Canadian climate!

I have ordered an external antenna to see if I can boost the RF signal.

Have you considered this point?


My apologies ScruffR. That suggestion got lost in the CLI shuffle. Your suggested change has been implemented.

Has it changed anything?