When does OTA update a device?

I’m getting ready to release a new version of software. When does the OTA update actually happen on the device? What mode does the device have to be in? What happens if the device is running it’s current version of software? Finally, do I need to modify my software to listen for the firmware_update_pending and then shut the app down gracefully?

If there is documentation on this topic please point me in it’s direction - Thanks!

Are you flashing via the Particle Product feature for fleets?
Are you flashing a single developer device?
Are you running SYSTEM_THREAD(ENABLED) or not?
How does your currently running code behave in regards to connectivity (including sleep modes)`?

Without all of these infos answering your questions would just produce a load of cases and eventualities which only cost a lot of time on our side where your use-case probably only requires a fraction of the possible answers.

1 Like

Thank you for your reply. My ultimate goal is to locate the documentation that would essentially lay out the requirements, and then help me to to properly design my application. Is there documentation that will assist?

Otherwise,

  1. Yes - flashing via Particle Product feature
  2. No - I would like to flash the fleet of vehicles - currently standing at 15 in total
  3. No - I am not using SYTEM_THREAD(enabled)
  4. Current code utilizes several functions and variables - all function as expected.

I have released a new version of software the Product Feature section shows that some devices have updated and some have not. So I’d like to know what to expect and how to better control when the updates happen.

I have located the OTA Update section of the documentation and I see there are disable and enable update functions. Am I able to utilize those within my code to tell particle when it’s ok and not ok to perform the update? If so, I would probably start with a disable, then transition based on detecting idle conditions for our operating environment, and during the idle condition issue the enable. Does that sound like the right strategy? If not, could anyone suggest a better one?

The issue is that at this time, a product firmware update occurs only on full cloud handshake. With Electron devices, this doesn’t happen that frequently, because doing so requires about 5K of data. Thus it can take around a week for all Electron/E-series devices to get a product firmware update at this time.

There are two workarounds that can be used now:

At some time, perhaps once a day, your device can end the session to force a new session handshake by running this code on the device.

Particle.publish("spark/device/session/end", "", PRIVATE);

This will cause a firmware update if there is one available after it reconnects.

Another option is to force the update from the cloud-side using lock and flash. This is usually only practical for devices that are always on. Since it’s possible to control lock and flash from the cloud API, you could also automate this process.

A more reasonable solution to this problem will be provided in the future, but I don’t have a schedule for when it will be available.

3 Likes

A more reasonable solution to this problem will be provided in the future, but I don’t have a schedule for when it will be available.

Hi Rickkas7,
It's the future calling. Do you know if a different solution (besides Intelligent OTA) has been introduced?

Thank you,
Nick

Perry sure that's what intelligent OTA is for, what's wrong with that?

We’re doing a small field PoC and aren’t ready to pay for that feature yet. We plan to, I just need to make sure I can OTA for this PoC on any update from sleep. I got it working with this solution from Rickkas7 and will deal with the extra data costs incurred; just curious if there’s a new solution.

Intelligent OTA is the solution as far as I'm aware, so I think those two are the current options.

There are two parts to intelligent OTA.

Previously, you would only get a firmware update after a session authentication. This could take a week on cellular devices.

Now, all devices, even those not an an enterprise account, will also get an update after session resume. You do need to stay awake for about 10 seconds to be sure, and make sure you don’t power down while an update is currently in progress. But that part is free.

Intelligent OTA makes it possible to have finer control over deployments, and that’s the enterprise feature.

2 Likes

That sounds pretty awesome. It would have definitely helped to have this feature earlier, but it's great that we have it now.