Particle Electron: Load default firmware on hard fault, after failed OTA update?

Hi all,

Is it possible to automatically have some skeleton firmware (i.e. tinker, hello world etc) be loaded when a Particle Electron hits a hard fault (SOS) after a bad firmware update OTA? This way, the Particle would detect that it's in an SOS state, and then run up this firmware to allow it to connect to the cell, waiting dormant and ready for new (working) firmware?

We have many Electrons located nationally in the UK and we've had a few occasions where an OTA firmware update has caused an Electron to enter SOS mode. Currently, an Engineer has to drive to the location and enter the device into safe mode manually, fix firmware and then DFU update.

I guess I'm looking for a way to do the following steps remotely:

Out of heap memory (8 blinks between 2 SOS patterns)

If your Electron crashes repeatedly with an SOS code, first try recovering with Safe Mode and flashing Tinker with the CLI to see if it was something recently added in your user application.

particle flash tinker

If it's not possible to enter Safe Mode, your system firmware may be corrupted. Try putting your Electron into DFU Mode and flashing the system firmware locally over USB (and optionally flash the Tinker application) with:

particle update
particle flash --usb tinker

Don't forget that the community forum is always there to help.

I think this would be a really useful feature if not already present. Thanks!

@peekay123 I feel you’d be able to shed some light on this, or at least point me in the right direction. Thanks :slight_smile:

@joearkay, do you consistently get the same SOS pattern and if so, which?

I believe it’s the hard fault as that’s the one that an engineer reported, however it’s in a remote location and haven’t been able to go to site, so can’t say for certain.

Is there any way I can:

  1. Reset the Particle remotely, so I can connect OTA and update the firmware?
  2. Introduce some redundancy into the codebase/firmware in the future so it’s sit dormant in ‘safe mode’ after a fault, ready to accept new firmware OTA?

Thanks

@joearkay,

  1. Not at this time.
  2. I’m chatting with the Particle folks to see if there is a fail-safe fallback mode but I believe there is not.

If the hard fault occurs due to your code, there may be a way to catch the Reset Reason and programmatically enter safe mode. This assumes the Electron gets to setup() in your code which may not be the case.

Ideally, the system firmware would detect a reset loop (caused by hard fault for example) and enter safe mode after N resets to a) preserve battery and b) allow recovery. I’ll let you know what the Particle folks say about this.

1 Like

@peekay123 Hopefully I can work on something with that. Provided that setup() is still called before a hard_fault state?

Thanks

1 Like