OTA Updates not flashing to devices

I have done this with other products too, but I have a new firmware (version 2) selected to lock and flash on next reset.

However, my devices have not downloaded the firmware (even after trying it 3 or 4 times). I need to be able to remotely update the firmware and send new versions to my devices in the very near future without manually doing anything.

Does anyone know why this is not working?

Any suggestions would be great!

And finally after trying a few times, I see this in the logs. Not sure why it’s failing.

How long do your devices stay online?

They stay online for about 30 seconds. But if it shakes hands with the cloud at initial startup, shouldn’t it overwrite that and keep it on until it loads the code?

Unfortunately not - especially not if you happen to use SYSTEM_THREAD(ENABLED)

There should be System.updatesPending() to check and hang around longer once a pending update is detected, but unfortunately that doesn’t work as intended yet.

Hence these two issues
https://github.com/spark/firmware/issues/1285
https://github.com/spark/firmware/issues/1166

How long does it need to be connected to the cloud to get the update correctly downloaded?

Unfortunately that’s hard to tell, but with a good connection it should be about 30sec after the OTA download has started (which is not easy to detect with the issues above).
Once the download has finished the system takes over control and your own code can’t harm the update anymore.

IMO this is a major obstacle for secure product updates but I’ve no idea how and when this will be addressed.
I’ve got other customers struggling with this too. One workaround I usually use is to have one wake cycle (e.g. once per day) staying online for about 5min (after Particle.connected()) , which usually works first time but sometimes needs a couple of days to actually succeede.

2 Likes

Great! Thank you. I’ll try out the 5 minute thing.

Could I also program it with this to avoid having it on 5 minutes everyday when there are no updates?

if(System.updatesPending()==TRUE) { Particle.process(); delay(300000); // delay it for 5 minutes so it updates Particle.process(); }

Unfortunately not since System.updatesPending() currently only goes true very shortly after OTA actually has kicked in already :pensive:

Okay. That feature would be amazing to have! How can we hear about when updates like that come out?

Also, I was able to get an OTA flash to happen by having a 5 second extra delay. It recognized and started the update and then I was able to call my function like this to ensure the update completes.

checkForFirmwareUpdates() { if(System.updatesPending()==TRUE) { Particle.process(); delay(300000); // delay it for 5 minutes so it updates Particle.process(); } }

I don’t know how reliable it is out in the field, but I had it working 5/5 times. Thanks for the help!

You can hit the Tracking button at this thread to get a mail notification when a new release comes out
Particle Device OS Updates Thread

A similar feature is also available for GitHub on the issues I linked above.