# Issues with FW OTA update

**URL:** <https://community.particle.io/t/issues-with-fw-ota-update/56788>\
**Category:** Cloud\
**Tags:** boron\
**Created:** [June 26, 2020, 12:33am UTC](https://community.particle.io/t/issues-with-fw-ota-update/56788 "2020-06-26T00:33:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andre](https://avatars.discourse-cdn.com/v4/letter/a/6de8d8/32.png) [@Andre](https://community.particle.io/u/Andre)\
**Post date:** [June 26, 2020, 12:33am UTC](https://community.particle.io/t/issues-with-fw-ota-update/56788/1 "2020-06-26T00:33:41Z")

</div>

Hi guys,

I am trying to update my firmware using the Particle console.

I upload my new FW on the console, and when my devices wakes up, it calls this API:

```auto
void otaHandler()
{
 if(System.updatesPending());
 {
     // add a flag
     FWupdate=true; 
     Log.trace("updates pending");
 }

```

I verified that indeed upon system wakeup from sleep, the FWupdate flag becomes true. However, I don’t see that my firmware gets update.

As soon as the this flag is set I call the below APIs:

```auto
System.enableUpdates()
delay(120000);
System.reset();

```

Could anybody comment what I might be missing that makes my system fails updating upon system wakeup.

Thank you all in advance.

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [June 26, 2020, 1:37am UTC](https://community.particle.io/t/issues-with-fw-ota-update/56788/2 "2020-06-26T01:37:18Z")

</div>

@Andre, you may want to try to use a non-blocking delay to replace `delay(120000)` with:

```auto
for(uint32_t t = millis(); millis() - t < 120000L; Particle.process());

```

This will allow the DeviceOS to get serviced during the pause.

---

<div class="post-metadata">

**Author:** ![Andre](https://avatars.discourse-cdn.com/v4/letter/a/6de8d8/32.png) [@Andre](https://community.particle.io/u/Andre)\
**Post date:** [July 7, 2020, 5:22pm UTC](https://community.particle.io/t/issues-with-fw-ota-update/56788/3 "2020-07-07T17:22:08Z")

</div>

Thank you for your comment!

I actually tried what you suggest by adding the for loop for delay but I have not seen any updates taking place:

```cpp
function()
{
    Log.trace("This OTA state before updates are enabled");

    System.enableUpdates();

    Log.trace("This OTA state after updates are enabled");

    for(uint32_t t = millis(); millis() - t < 120000L; Particle.process())

    Log.trace("This OTA state after delay FW-Ver4");
}

```

The above code gets executed when a new firmware update is detected, but I don’t see any updates happen at all.

I just noticed my code keep looping for 2 minutes in this function displaying “This OTA state after delay FW-Ver4”.

Do I need to increase the delay? is this happening because there is not a good handshake between the device and the cloud?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/6/4/64635adccc35238caa19e9b553ec3e98b163d026.png) [@system](https://community.particle.io/u/system)\
**Post date:** [January 6, 2021, 5:34am UTC](https://community.particle.io/t/issues-with-fw-ota-update/56788/4 "2021-01-06T05:34:15Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
