OTA Update Failed (Electron)

In the Particle console, we see OTA update failed in the event watcher and the OTA update is not pushed into devices. We can confirm the device is waiting for OTA during booting, and we see the LED blinking purple (indicating OTA update is in progress). But somehow, the OTA cannot be finished and OTA update failed event is reported in the console.

Our setup:

  • System setting: SYSTEM_MODE(MANUAL), SYSTEM_THREAD(ENABLED).

  • We have set up PRODUCT_ID and PRODUCT_VERSION in the code properly. Also in the console, we have set up the corresponding product, and have flashed one Electron with the firmware we want to OTA. We have already released this firmware, it just somehow cannot be pushed into devices.

  • In setup(), we have a piece of code to waiting OTA for 90s:

for (int delayed = 0; delayed < 90000; delayed += 100) {
Particle.process();
delay(100);
}

Other troubleshoots we’ve tried:

We have tried forcibly recreate the session with Particle:

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

Which didnt work either. Thanks for any help!

This delay(100) is counter productive.
A better approach would be something like this

  for (uint32_t ms = millis(); millis() - ms < 90000; Particle.process());

This will also wait 90 seconds but will spin Particle.process() at maximum speed.

However, what is your code doing after the 90 second period?
Have you got an idea how long into that period the OTA download actually kicks in?
Have you tried increasing the time?
Depending on your device OS version you can try adding SerialLogHandler tracer(LOG_LEVEL_ALL) and monitor the USB Serial output.

This delay(100) is counter productive.
A better approach would be something like this for (uint32_t ms = millis(); millis() - ms < 90000; Particle.process()); This will also wait 90 seconds but will spin Particle.process() at maximum speed.

Will this high speed use a lot of power? We are trying to be very cautious with our power consumption.

However, what is your code doing after the 90 second period?

After we disconnect from the cloud and read data from external sensor.

Have you got an idea how long into that period the OTA download actually kicks in?

Normally it should take less than 30 seconds, so 90 seconds seems pretty safe. The OTA update WAS working before, but somehow it starts to fail recently.

Have you tried increasing the time?

Yes. We have tried 5 minutes and still failed. We saw that the issue was not about the interval of wait time. The device did started doing the OTA update (with LED blinking purple) and it still failed and the failure event was published.

Depending on your device OS version you can try adding SerialLogHandler tracer(LOG_LEVEL_ALL) and monitor the USB Serial output.

We’ll give that a try. Thanks for the advice!