Fix NRF52 memory corruption on low battery levels #8793
+16
−2
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.
Draft - PR during testing
This PR fixes memory corruption issues on ProMicro/NiceNano2 boards (and possibly other NRF52 boards) where battery voltage hovers around 2.5-2.7V.
Depending on components used - some LDO regulators shut down around 3V but with some regulators or different board designs (like LDO bypass into VDDH) it's perfectly fine to work down to 2.5V and utilize most of the battery capacity (auto shutdown feature at 3.1V aside right now).
Bug being fixed:
NRF52840 uses power fail comparator that prevents flash memory write if voltage is below safety threshold. While this comparator is enabled in meshtastic firmware - it was set to 2.4V threshold which is below power failure mode of VDDH REG0 regulator (specified min voltage is 2.5V) and li-ion battery protectors (also around 2.5V) which means power will be randomly cut to the device before this protection can trigger.
Due to other bugs and issues: #8789 in some cases device will not go into deep sleep when voltage drops below 3V.
This results in memory corruption (device boots with clear config) when voltage is at 2.5-2.7V and heavier operation is being executed (BLE setting changed, meshtastic frame received, etc).