DFU won't work when `hub.mode` set to `minimum`

We are setting up Outboard Firmware Update. The hub.mode is set to minimum and sync is false , as we want to explicitly trigger a sync on our own schedule. card.dfu is set to on: {"req":"card.dfu","name":"stm32","on":true} , and dfu.status is also on: {"req":"dfu.status","on":true} . The symptoms are that notehub reports Firmware Update Status “Downloading (0%)” and firmware update request has the status “Device handling request”. This persists. We are triggering sync manually every hour with some of our own data that needs to be synchronized. But the notecard does not seem to progress at all with the download of the firmware.

The only solution that makes the update progress is switching hub.mode to continuous which is not desirable in our low power application.

Notecard 6.1.1 has this issue.

The only way out of it that we have found is to poll the backend to see if a DFU is available, and if DFU is available, we switch to periodic mode until the DFU is complete.

4 Likes

@daterdots Our low power application is somewhat similar to yours in that we are in minimum mode, take a reading every hour, sync, then put the esp32 to sleep until time for the next reading.

I was able to get Outboard Firmware Update to work staying in minimum mode, but it takes a long time to complete. I left it running overnight and in the morning, it had completed.

I didn’t like the uncertainty of the timing to complete, so I basically did what you did, i.e. I poll to see if a DFU is waiting, then I switch to continuous mode, complete the DFU. In our code, when the DFU is complete and reboots the hardware, hub.mode is set back to minimum.

It has not impacted our battery life. Outboard DFU is completing in around 20 minutes.

Karl

3 Likes

Hi all,

For context, I work with @daterdots on the project.

The way we worked around the problem was, switching to periodic mode, with a longer duty cycle than our own, manually triggered sync. (we have to manually trigger the sync as it has to happen at a specified time of day)

I hope that we are at the correct assumption, that a manual sync request, will reset the periodic timer. This means, that if we trigger a sync every hour, and the period of periodic sync is set to once a day, the periodic sync will not happen unless we stop manually triggering syncs for a day. Unfortunately I don’t seem to be able to find any firm statement about this, in the documentation.

We tried using minimal mode and wait for an update to occur. We were testing with firmware 4.1.1 at the time. We were triggering syncs every hour, but still after two days of running an update was still stuck at 0% download. In minimal mode it seems the update is being started but the download stalls at 0%. I retested this with notecard firmware 6.1.1, but it seems to also have the same problem.

We were considering to solve the issue, by detecting a dfu update and switching to continuous mode. As you suggested @Karl_iWell but, the periodic mode seems to solve the problem for now, without having to implement extra logic in our firmware.

All things considered, I still think there is something off with the minimal mode. I have also not found any notes, about how modes interact with the dfu update system, besides very general things involving continuous mode. Some more details about how it is supposed to work would be nice.

Cheers,
Piotr

Hi @esden,

I need to test the Outboard Firmware Update process in minimum mode, so let me get back to you on that.

Regarding your other question, the inbound and outbound periods are aligned to boot time of the Notecard. Even if you perform an explicit hub.sync request in between, the next sync due will be at the next aligned period.

Rob

Hi @esden and @daterdots,

Overnight I was able to confirm that Outboard Firmware Update does not work with the Notecard in minimum mode, even with regular hub.sync requests. At this point the official stance is this process is only supported if the Notecard is in continuous or periodic mode (which yes needs to be documented) and it’s TBD yet whether minimum mode is something we can support due to the nature of that mode.

Rob

3 Likes

Hi @RobLauer,

Thank you for testing. The results are a bit unfortunate. Our project requirements are:

  • sync at a specific time in day
  • save as much power as possible (aka sync only when we need to)

So the fact that Periodic is not “time since last sync” but rather ingnores the manual syncs and does it’s own thing is a bit unfortunate.

Minimal mode would be the correct thing for us if dfu would work in that mode.

Now we will likely have to add extra logic to our application to switch modes for dfu updates because notecard does not work right. :frowning:

In any case, thank you for clarifying.

Cheers,
Piotr

After thinking through this a bit more, I have a question. Is there a command or a combination of commands that would allow us to reset the Periodic timer? This way, if our firmware for some reason stops triggering the automatic syncs, the periodic timer would kick in and allow us to reset or update the firmware. This would be a good reliability fallback without wasting energy on the extra syncs.

Cheers,
Piotr

Hi @esden,

I believe when you send a new hub.set request, this will reset the timer. It’s worth testing just to make sure :slight_smile:

Rob

Hi @RobLauer,

Thanks for the tip, good to know. I will test it out and see what it exactly does.

Cheers,
Piotr