Nordic reset reason after deep sleep #10344
Merged
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.
nordic
doesn't really deep sleep: it light-sleeps with low current draw. There was some logic that tried to be careful about determining themicrcontroller.cpu.reset_reason
in such cases, but it didn't work whenmicrcontroller.reset()
was called. This clears some saved state to make sure the reset reason is correct.Found when helping @bradanlane with a BLE HID problem.
Tested on a CPB that this fix works, using the following test program, which was cobbled from @bradanlane's test program for something else. Before this fix, the program would get stuck in a reset loop, because the reset reason was stuck on
ResetReason.DEEP_SLEEP_ALARM
even aftermicrocontroller.reset()
. Now it properly goes toResetReason.SOFTWARE
.