Skip to content

nRF52840 Power Management Stage 1 v2.1 - Boot lockout fix#2088

Open
entr0p1 wants to merge 1 commit intomeshcore-dev:devfrom
entr0p1:nrf52840-pwrmgt-stage1-v2_1
Open

nRF52840 Power Management Stage 1 v2.1 - Boot lockout fix#2088
entr0p1 wants to merge 1 commit intomeshcore-dev:devfrom
entr0p1:nrf52840-pwrmgt-stage1-v2_1

Conversation

@entr0p1
Copy link
Copy Markdown
Contributor

@entr0p1 entr0p1 commented Mar 19, 2026

Improvements:

  • Add configurable battery chemistry
  • Add per-chemistry LPCOMP wake threshold and boot lockout voltage
  • Add configurable enabled/disabled state for boot lockout
  • Reduce Li-ion/Li-Po lockout threshold to 3.0V from 3.3V
  • Initialise FS earlier in the startup process to allow reading configured settings for boot lock

Fixes:

  • Add additional shutdown reason "None" for instances where the reason isn't set
  • Boot lockout disabled by default

@MGJ520
Copy link
Copy Markdown
Contributor

MGJ520 commented Mar 19, 2026

Good job

Improvements:
- Add configurable battery chemistry
- Add per-chemistry LPCOMP wake threshold and boot lockout voltage
- Add configurable enabled/disabled state for boot lockout
- Reduce Li-ion/Li-Po lockout threshold to 3.0V from 3.3V
- Initialise FS earlier in the startup process to allow reading configured settings for boot lock

Fixes:
- Add additional shutdown reason "None" for instances where the reason isn't set
- Boot lockout disabled by default
@entr0p1 entr0p1 force-pushed the nrf52840-pwrmgt-stage1-v2_1 branch from d5f6c76 to e32e30b Compare March 22, 2026 01:37
@entr0p1 entr0p1 marked this pull request as ready for review March 23, 2026 01:29
@entr0p1
Copy link
Copy Markdown
Contributor Author

entr0p1 commented Mar 23, 2026

Tested on a couple of boards now without issues so far. Ready to be reviewed.

@Pacjunk
Copy link
Copy Markdown

Pacjunk commented Mar 27, 2026

Does setting pwrmgt.bootlock to off also prevent the low voltage shutdown? or is it only for boot?

@recrof
Copy link
Copy Markdown
Member

recrof commented Apr 18, 2026

I truly understand what @entr0p1 wanted to do here and I respect it, however: I feel this became tad too over-engineered and we need to regroup and make it really simple:
ability to configure shutdown voltage and make it 0V as default. adding chemistries raises complexity and resources - we need to get rid of that. make the feature opt-in and not opt-out is also important.

@entr0p1
Copy link
Copy Markdown
Contributor Author

entr0p1 commented Apr 18, 2026

@recrof appreciate the respectful approach you've taken, I'm not fussed if it has to be pared right back or removed entirely. The fix is here if desired, but if you'd rather a different approach I won't be offended if you want to close it and do that.

@fschrempf
Copy link
Copy Markdown
Contributor

I truly understand what @entr0p1 wanted to do here and I respect it, however: I feel this became tad too over-engineered and we need to regroup and make it really simple:
ability to configure shutdown voltage and make it 0V as default. adding chemistries raises complexity and resources - we need to get rid of that.

100% agree.

make the feature opt-in and not opt-out is also important.

This is the most crucial point. #1413 was not ready for merging and still got merged for v1.12. It broke a lot of setups and now three months and three releases later things are still broken. People need to modify their firmware manually and climb on roofs because of this.

Can we please either:

  1. leave the current code as is, but add a configuration option that enables/disables the undervoltage bootlock and have this option disabled by default or
  2. just disable NRF52_POWER_MANAGEMENT for all boards.

Thanks!

@ssozonoff
Copy link
Copy Markdown

When the final decision has been made and code merged and released it will be important to communicate about this in any case. I personally believe we will be seeing more and more LTO and Sodium-ion based repeaters in the future.

@fschrempf
Copy link
Copy Markdown
Contributor

just disable NRF52_POWER_MANAGEMENT for all boards.

I've implemented this as a quick fix in #2377. After deciding on and implementing a proper solution this can be reenabled.

@entr0p1
Copy link
Copy Markdown
Contributor Author

entr0p1 commented Apr 23, 2026

I've been thinking about this more and based on what @recrof said I remembered we already have an auto shutdown voltage in the companion firmware (I think its in others now too?). Couldn't we basically drop this entire feature out of the codebase and just build on that to make the voltage configurable via the CLI?

No chemistries, wake, or lockouts to worry about and the code basically exists and just needs a pref added.

Thoughts?

@1nerdherder
Copy link
Copy Markdown

My thoughts after being on the 2088 adventure:
In a world where people are getting busier and reading less, I agree simpler is better.
The majority of users will not be concerned with this feature because they are using standard boards, generally with the one chemistry allowed. If they do go "custom" with an external solar battery charge controller, or some other adaptation, it will be too difficult for the firmware to know all the permutations (it would be a rather large table chasing innovation). So, those of us who are using advanced configurations, should be knowledgeable enough to change the defaults.
Simplifying to one parameter (the low voltage shutdown level - using zero to disable it completely) is a good start.
The only downside I can think of is that we lose the ability to tell the iOS/Android app what battery type it is so it can calculate percentage. However I have full confidence that someone smart will figure that one out at some point.

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.

7 participants