Skip to content

NF-1336: Fix some sideload bugs.#48

Merged
haydenroche5 merged 1 commit intomasterfrom
hayden/nf-1336
Jun 18, 2025
Merged

NF-1336: Fix some sideload bugs.#48
haydenroche5 merged 1 commit intomasterfrom
hayden/nf-1336

Conversation

@haydenroche5
Copy link
Copy Markdown
Contributor

@haydenroche5 haydenroche5 commented Jun 16, 2025

Prior to this commit, when sideloading, we were only putting the Notecard into
"DFU op mode" for host DFU and not Notecard DFU. When you do {"req":"hub.set",
"mode":"dfu"}, the Notecard resets a 15 minute timer during which the sideload
is allowed to take place. So, the bug I was seeing was that I had sideloaded
Notecard firmware once, and more than 15 minutes later I tried again, but I
was blocked because this timer had expired from the first DFU, and the CLI was
not doing the hub.set to reset the timer. This commit fixes this problem so
that we always do a hub.set mode:dfu at the start of a sideload and a hub.set
mode:dfu-completed at the end. BUT, LORA doesn't support this op mode, so we
don't do it for LORA.

The other bug was in loadBin. There, at the end of each iteration of the main
sideloading loop, we were waiting for dfu.put to return pending:false, which
indicates that the migration of the chunk from internal to external storage has
completed. However, for Notecard firmware sideload, there is no migration. The
data either flows from the binary storage region or from the payload in the
dfu.put directly into the Notecard MCU's flash. So there is no need to wait for
pending:false. I had somehow gotten a Notecard into a state where it thought it
had migration work to do, and that caught me in an infinite loop when I tried
to sideload because pending was always coming back true.

I tested this on ESP, LORA, r5, and u5 SKUs. Also tested ODFU with Swan.

@haydenroche5 haydenroche5 requested a review from rayozzie June 16, 2025 12:38
@haydenroche5 haydenroche5 self-assigned this Jun 16, 2025
@haydenroche5 haydenroche5 added the do not merge Leave, perhaps review, but don't merge (yet) label Jun 16, 2025
@haydenroche5
Copy link
Copy Markdown
Contributor Author

Testing ODFU now...

@haydenroche5
Copy link
Copy Markdown
Contributor Author

Swan ODFU successful.

@haydenroche5 haydenroche5 removed the do not merge Leave, perhaps review, but don't merge (yet) label Jun 16, 2025
Prior to this commit, when sideloading, we were only putting the Notecard into
"DFU op mode" for host DFU and not Notecard DFU. When you do {"req":"hub.set",
"mode":"dfu"}, the Notecard resets a 15 minute timer during which the sideload
 is allowed to take place. So, the bug I was seeing was that I had sideloaded
 Notecard firmware once, and more than 15 minutes later I tried again, but I
 was blocked because this timer had expired from the first DFU, and the CLI was
 not doing the hub.set to reset the timer. This commit fixes this problem so
 that we always do a hub.set mode:dfu at the start of a sideload and a hub.set
 mode:dfu-completed at the end. BUT, LORA doesn't support this op mode, so we
 don't do it for LORA.

The other bug was in loadBin. There, at the end of each iteration of the main
sideloading loop, we were waiting for dfu.put to return pending:false, which
indicates that the migration of the chunk from internal to external storage has
completed. However, for Notecard firmware sideload, there is no migration. The
data either flows from the binary storage region or from the payload in the
dfu.put directly into the Notecard MCU's flash. So there is no need to wait for
pending:false. I had somehow gotten a Notecard into a state where it thought it
had migration work to do, and that caught me in an infinite loop when I tried
to sideload because pending was always coming back true.

I tested this on ESP, LORA, r5, and u5 SKUs. Also tested ODFU with Swan.
@haydenroche5 haydenroche5 merged commit 799ccf0 into master Jun 18, 2025
1 check passed
@haydenroche5 haydenroche5 deleted the hayden/nf-1336 branch June 18, 2025 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants