Three "Hard" faults should cause the Photon to reboot into safe mode

It would be good to have some functionality on the Photon that boots it into safe mode so it can be flashed with replacement/fixed firmware once it has hard faulted 3 times within a set amount of time.

Has anyone done this?

Any ideas for how it could be done?

We would need to increment a counter stored in EEPROM/SRAM each time the Photon Hard faults but i’m not sure how this would be done? After this we can check the counter in code and reboot into the safe mode or clear the count if the Photon has been running for a set amount of time.

1 Like

I have suggested a similar mechanism, but using the cloud as the persistent storage and where the policy was controlled and implemented.

Yes that could work as well.

In the mean time is there any way to tell on restart whether the restart was caused by a Hard fault?

Sadly, I don’t think there is any way to currently figure out the restart syndrome.
Preserving and communicating this kind of info would most likely require the co-operation of the bootloader, which makes things more complicated.

OK.

I think this is something Particle should definitely think about adding as Hard faults and the resulting boot loop can be easily caused by external hardware that is damaged or flashing untested firmware.

I agree. Compound the situations you describe with devices deployed at remote locations.

exactly.

@AndyW, AFAIK there already was such a feature (at least in the Core) but it got removed (as it seems), but I can’t remember (understand) why.