Updating system firmware from 0.6.1 to 0.6.2

While OTA flashing new firmware to a Photon in Particle Dev, my Photon was placed in safe mode automatically upon restart. The photon had my custom firmware loaded onto it, and it was running 0.6.1 before attempting to update to 0.6.2. I was able to successfully update the firmware to 0.6.2 by placing the Photon in DFU mode and using “particle update” in the CLI.
My question is: without local access to a Photon, how could I have updated the system firmware to 0.6.2? The Photon was automatically placed into safe mode, I’m guessing because it was unable to update the firmware successfully and reached some sort of exit code in the process. I encountered this same behavior when I tried to update a Photon to 0.6.0 without updating it to 0.5.3 first. Am I missing something?

Is this custom system firmware or custom application firmware?

If it is system, then it is up to you to keep building your application firmware compatible to your custom system firmware.
If it is application firmware you would not be able to update that via DFU Mode without having access to the device anyway and an OTA update would trigger Safe Mode Healer which would flash the needed stock system firmware automatically.

Hey @ScruffR,
It’s custom application firmware. The Safe Mode Healer did not automatically upgrade the device’s system firmware. That’s the issue I encountered. I tried flashing a couple different apps to the Photon with no success: tried my custom application first within Particle Dev and Tinker from Particle Build. Both were targeted to compile with 0.6.2 and both were unable to successfully engage the Safe Mode Healer. The Photon would enter safe mode after it restarted after a new flash, but it would not update the system firmware. In fact, it would just hang in Safe Mode with no prompts being sent into the Particle Console.
I just confirmed this failed upgrading behavior with a 2nd Photon that had 0.6.1 loaded onto it already with the same application firmware as well. Upon flashing the custom application firmware with 0.6.2 targeted as the system firmware, the Photon simply hangs in Safe Mode upon restart. :confounded:
If I use 0.6.1 as the target and flash the Photon, the Photon flashes fine and my custom application starts running normally.
If users are unable to upgrade the system firmware remotely from 0.6.1 to 0.6.2, that’s a big issue for even a small fleet of devices.

Did you try flashing OTA?

Yes. Flashing was OTA.

I have updated four Photons via SMH in the last couple of days without issues, so that’s a strange observation you made there.
I wonder whether we will see other reports of that :confused:

I’ll have to dig up some more devices to double check again.
I could also downgrade some of my already updated ones to try again.

Have you got a not yet updated device to video the process and post here?

Were your Photons running 0.6.1 prior to the system firmware update?

Yes, 0.6.1, 0.6.2-rc.1 and 2x 0.6.2-rc.2

Did your running app do anything with Particle.connect, WiFi.connect() or System.sleep()?
Do you see the same problem with Tinker running prior the update?
What happens when your device is in Safe Mode and you try the same flash again?

My app runs SYSTEM_MODE(MANUAL) so I do call Particle.connect within setup(). System threading is also disabled because much of my code needs to run in a serial fashion without interruption. I don’t use System.sleep() in the app.
I just reflashed Tinker to the Photon from the Android Particle app to one of the Photons with 0.6.1 still on it. Doing this did not update the Photon to 0.6.2. After restarting, the Photon breathed cyan and loaded Tinker successfully. However, I tried reflashing the device with a blank app from within Particle Build with 0.6.2 as the target. The photon then entered the Safe Mode Healer successfully and updated to 0.6.2.
Could SYSTEM_MODE and SYSTEM_THREAD options be responsible for this issue? Does Safe Mode Healer require that the Photon be in SYSTEM_MODE(AUTOMATIC)?
To answer your earlier question, when the Photon was placed in safe mode after my custom application was flashed to it, the Photon still did not enter SMH when flashing again.

If your SYSTEM_MODE(MANUAL) application is somewhat lazy in calling Particle.process() then this might be an explanation why SMH is not properly working.
To have OTA - and in particular SMH - work properly, you should call Particle.process() as often as possible, but as a rough guideline every at least every 10~100ms.

I didn’t mean the Tinker flash should trigger the update, but to check whether a subsequent 0.6.2 OTA of your code while Tinker 0.6.1 was running on the device would have SMH kick in - I’d expect this way would work.

As above, I meant you should put your 0.6.1 device in SM and then flash a 0.6.2 app OTA - this also should cause SMH to kick in.

I can confirm that Particle DEV defaulted to firmware 0.6.2 the other day so when I flashed an updated version of some test code running SYSTEM_MODE(MANUAL) I had to put the Photon into the Safe Mode Healer and then flash the new code.

The Photon automatically updated from the 0.6.1 firmware to the 0.6.2 firmware without any issues.

1 Like

@ScruffR
I did initially try to place my photon in safe mode, then reflash another app OTA with 0.6.2 selected, but it didn’t initially work. The photon just restarted and was hung in safe mode.
It was only when I flashed a blank app with 0.6.1 selected, then flashed another blank app with 0.6.2 selected did the update work.
I think you’re correct in the Particle.process() question you raised. My custom app does call Particle.process() very often, but upon startup, there is a period of time where some SINGLE_THREADED_BLOCKS get executed, and I’m guessing that these are interfering with the SMH.
Does Particle have any documentation regarding safe mode healer? I was unable to find any detailed literature outlining its needs/specifications to avoid issues like I experienced.
Thank you so much for helping me walk through this :heart_eyes:

1 Like

I had a similar (if not the exact same issue) with 4 Photons I have in the field. All had custom application firmware and were running 0.6.1. I made a small tweak to the application FW, built against 0.6.2, and when I went to perform the OTA flash the Photon went into safe mode. The only way to get it back was to flash Tinker and then reflash the FW via OTA. I had to perform the exact procedure on all 4 Photons.

1 Like