NF-1336: Fix some sideload bugs.#48
Merged
haydenroche5 merged 1 commit intomasterfrom Jun 18, 2025
Merged
Conversation
Contributor
Author
|
Testing ODFU now... |
Contributor
Author
|
Swan ODFU successful. |
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.
7d7cc76 to
aabe6e1
Compare
rayozzie
approved these changes
Jun 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.