Files
MeshCore-Solo/nrf52_power_management/index.html
2026-07-18 08:11:35 +00:00

2235 lines
44 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="Documentation for the open source MeshCore firmware">
<link rel="canonical" href="https://meshcore-dev.github.io/meshcore/nrf52_power_management/">
<link rel="prev" href="../kiss_modem_protocol/">
<link rel="next" href="../number_allocations/">
<link rel="icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.7.7">
<title>nRF52 Power Management - MeshCore Docs</title>
<link rel="stylesheet" href="../assets/stylesheets/main.ec1eaa64.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
<style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
<link rel="stylesheet" href="../_stylesheets/extra.css">
<script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
</head>
<body dir="ltr">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#nrf52-power-management" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header md-header--shadow" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href=".." title="MeshCore Docs" class="md-header__button md-logo" aria-label="MeshCore Docs" data-md-component="logo">
<img src="../_assets/meshcore.svg" alt="logo">
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
MeshCore Docs
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
nRF52 Power Management
</span>
</div>
</div>
</div>
<script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent")}for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script>
<label class="md-header__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
</label>
<nav class="md-search__options" aria-label="Search">
<button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
</button>
</nav>
<div class="md-search__suggest" data-md-component="search-suggest"></div>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" tabindex="0" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list" role="presentation"></ol>
</div>
</div>
</div>
</div>
</div>
<div class="md-header__source">
<a href="https://github.com/meshcore-dev/meshcore/" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2025 Fonticons, Inc.--><path d="M439.6 236.1 244 40.5c-5.4-5.5-12.8-8.5-20.4-8.5s-15 3-20.4 8.4L162.5 81l51.5 51.5c27.1-9.1 52.7 16.8 43.4 43.7l49.7 49.7c34.2-11.8 61.2 31 35.5 56.7-26.5 26.5-70.2-2.9-56-37.3L240.3 199v121.9c25.3 12.5 22.3 41.8 9.1 55-6.4 6.4-15.2 10.1-24.3 10.1s-17.8-3.6-24.3-10.1c-17.6-17.6-11.1-46.9 11.2-56v-123c-20.8-8.5-24.6-30.7-18.6-45L142.6 101 8.5 235.1C3 240.6 0 247.9 0 255.5s3 15 8.5 20.4l195.6 195.7c5.4 5.4 12.7 8.4 20.4 8.4s15-3 20.4-8.4l194.7-194.7c5.4-5.4 8.4-12.8 8.4-20.4s-3-15-8.4-20.4"/></svg>
</div>
<div class="md-source__repository">
meshcore-dev/meshcore
</div>
</a>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href=".." title="MeshCore Docs" class="md-nav__button md-logo" aria-label="MeshCore Docs" data-md-component="logo">
<img src="../_assets/meshcore.svg" alt="logo">
</a>
MeshCore Docs
</label>
<div class="md-nav__source">
<a href="https://github.com/meshcore-dev/meshcore/" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2025 Fonticons, Inc.--><path d="M439.6 236.1 244 40.5c-5.4-5.5-12.8-8.5-20.4-8.5s-15 3-20.4 8.4L162.5 81l51.5 51.5c27.1-9.1 52.7 16.8 43.4 43.7l49.7 49.7c34.2-11.8 61.2 31 35.5 56.7-26.5 26.5-70.2-2.9-56-37.3L240.3 199v121.9c25.3 12.5 22.3 41.8 9.1 55-6.4 6.4-15.2 10.1-24.3 10.1s-17.8-3.6-24.3-10.1c-17.6-17.6-11.1-46.9 11.2-56v-123c-20.8-8.5-24.6-30.7-18.6-45L142.6 101 8.5 235.1C3 240.6 0 247.9 0 255.5s3 15 8.5 20.4l195.6 195.7c5.4 5.4 12.7 8.4 20.4 8.4s15-3 20.4-8.4l194.7-194.7c5.4-5.4 8.4-12.8 8.4-20.4s-3-15-8.4-20.4"/></svg>
</div>
<div class="md-source__repository">
meshcore-dev/meshcore
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href=".." class="md-nav__link">
<span class="md-ellipsis">
Introduction
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../cli_commands/" class="md-nav__link">
<span class="md-ellipsis">
CLI Commands
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../companion_protocol/" class="md-nav__link">
<span class="md-ellipsis">
Companion Protocol
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../docs/" class="md-nav__link">
<span class="md-ellipsis">
Local Documentation
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../faq/" class="md-nav__link">
<span class="md-ellipsis">
Frequently Asked Questions
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../kiss_modem_protocol/" class="md-nav__link">
<span class="md-ellipsis">
MeshCore KISS Modem Protocol
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
<span class="md-ellipsis">
nRF52 Power Management
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
<span class="md-ellipsis">
nRF52 Power Management
</span>
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#overview" class="md-nav__link">
<span class="md-ellipsis">
Overview
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#features" class="md-nav__link">
<span class="md-ellipsis">
Features
</span>
</a>
<nav class="md-nav" aria-label="Features">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#boot-voltage-protection" class="md-nav__link">
<span class="md-ellipsis">
Boot Voltage Protection
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#voltage-wake-lpcomp-vbus" class="md-nav__link">
<span class="md-ellipsis">
Voltage Wake (LPCOMP + VBUS)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#early-boot-register-capture" class="md-nav__link">
<span class="md-ellipsis">
Early Boot Register Capture
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#shutdown-reason-tracking" class="md-nav__link">
<span class="md-ellipsis">
Shutdown Reason Tracking
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#supported-boards" class="md-nav__link">
<span class="md-ellipsis">
Supported Boards
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#technical-details" class="md-nav__link">
<span class="md-ellipsis">
Technical Details
</span>
</a>
<nav class="md-nav" aria-label="Technical Details">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#architecture" class="md-nav__link">
<span class="md-ellipsis">
Architecture
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#early-boot-capture" class="md-nav__link">
<span class="md-ellipsis">
Early Boot Capture
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#board-implementation" class="md-nav__link">
<span class="md-ellipsis">
Board Implementation
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#voltage-wake-configuration" class="md-nav__link">
<span class="md-ellipsis">
Voltage Wake Configuration
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#softdevice-compatibility" class="md-nav__link">
<span class="md-ellipsis">
SoftDevice Compatibility
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#cli-commands" class="md-nav__link">
<span class="md-ellipsis">
CLI Commands
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#debug-output" class="md-nav__link">
<span class="md-ellipsis">
Debug Output
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#phase-2-planned" class="md-nav__link">
<span class="md-ellipsis">
Phase 2 (Planned)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#references" class="md-nav__link">
<span class="md-ellipsis">
References
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../number_allocations/" class="md-nav__link">
<span class="md-ellipsis">
Number Allocations
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../packet_format/" class="md-nav__link">
<span class="md-ellipsis">
Packet Format
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../payloads/" class="md-nav__link">
<span class="md-ellipsis">
Payload Format
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../qr_codes/" class="md-nav__link">
<span class="md-ellipsis">
QR Codes
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../stats_binary_frames/" class="md-nav__link">
<span class="md-ellipsis">
Stats Binary Frame Structures
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../terminal_chat_cli/" class="md-nav__link">
<span class="md-ellipsis">
Terminal Chat CLI
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_14" >
<label class="md-nav__link" for="__nav_14" id="__nav_14_label" tabindex="0">
<span class="md-ellipsis">
Design
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_14_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_14">
<span class="md-nav__icon md-icon"></span>
Design
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../design/nearby_redesign/" class="md-nav__link">
<span class="md-ellipsis">
Nearby Nodes — analiza i propozycja uporządkowania
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../design/solo_ui_framework/" class="md-nav__link">
<span class="md-ellipsis">
Solo UI framework — a guide for adding features
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../design/trail_redesign/" class="md-nav__link">
<span class="md-ellipsis">
Trail (Tools Trail) — analiza i propozycja uporządkowania
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_15" >
<label class="md-nav__link" for="__nav_15" id="__nav_15_label" tabindex="0">
<span class="md-ellipsis">
Solo features
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_15_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_15">
<span class="md-nav__icon md-icon"></span>
Solo features
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_15_1" >
<label class="md-nav__link" for="__nav_15_1" id="__nav_15_1_label" tabindex="0">
<span class="md-ellipsis">
Clock screen
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_15_1_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_15_1">
<span class="md-nav__icon md-icon"></span>
Clock screen
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../solo_features/clock_screen/clock_screen/" class="md-nav__link">
<span class="md-ellipsis">
Clock screen
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_15_2" >
<label class="md-nav__link" for="__nav_15_2" id="__nav_15_2_label" tabindex="0">
<span class="md-ellipsis">
Favourites dial
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_15_2_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_15_2">
<span class="md-nav__icon md-icon"></span>
Favourites dial
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../solo_features/favourites_dial/favourites_dial/" class="md-nav__link">
<span class="md-ellipsis">
Favourites dial
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_15_3" >
<label class="md-nav__link" for="__nav_15_3" id="__nav_15_3_label" tabindex="0">
<span class="md-ellipsis">
Message screen
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_15_3_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_15_3">
<span class="md-nav__icon md-icon"></span>
Message screen
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../solo_features/message_screen/message_screen/" class="md-nav__link">
<span class="md-ellipsis">
Message screen
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_15_4" >
<label class="md-nav__link" for="__nav_15_4" id="__nav_15_4_label" tabindex="0">
<span class="md-ellipsis">
Screen lock
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_15_4_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_15_4">
<span class="md-nav__icon md-icon"></span>
Screen lock
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../solo_features/screen_lock/screen_lock/" class="md-nav__link">
<span class="md-ellipsis">
Screen lock
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_15_5" >
<label class="md-nav__link" for="__nav_15_5" id="__nav_15_5_label" tabindex="0">
<span class="md-ellipsis">
Settings screen
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_15_5_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_15_5">
<span class="md-nav__icon md-icon"></span>
Settings screen
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../solo_features/settings_screen/settings_screen/" class="md-nav__link">
<span class="md-ellipsis">
Settings screen
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_15_6" >
<label class="md-nav__link" for="__nav_15_6" id="__nav_15_6_label" tabindex="0">
<span class="md-ellipsis">
Tools screen
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_15_6_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_15_6">
<span class="md-nav__icon md-icon"></span>
Tools screen
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../solo_features/tools_screen/tools_screen/" class="md-nav__link">
<span class="md-ellipsis">
Tools screen
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#overview" class="md-nav__link">
<span class="md-ellipsis">
Overview
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#features" class="md-nav__link">
<span class="md-ellipsis">
Features
</span>
</a>
<nav class="md-nav" aria-label="Features">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#boot-voltage-protection" class="md-nav__link">
<span class="md-ellipsis">
Boot Voltage Protection
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#voltage-wake-lpcomp-vbus" class="md-nav__link">
<span class="md-ellipsis">
Voltage Wake (LPCOMP + VBUS)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#early-boot-register-capture" class="md-nav__link">
<span class="md-ellipsis">
Early Boot Register Capture
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#shutdown-reason-tracking" class="md-nav__link">
<span class="md-ellipsis">
Shutdown Reason Tracking
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#supported-boards" class="md-nav__link">
<span class="md-ellipsis">
Supported Boards
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#technical-details" class="md-nav__link">
<span class="md-ellipsis">
Technical Details
</span>
</a>
<nav class="md-nav" aria-label="Technical Details">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#architecture" class="md-nav__link">
<span class="md-ellipsis">
Architecture
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#early-boot-capture" class="md-nav__link">
<span class="md-ellipsis">
Early Boot Capture
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#board-implementation" class="md-nav__link">
<span class="md-ellipsis">
Board Implementation
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#voltage-wake-configuration" class="md-nav__link">
<span class="md-ellipsis">
Voltage Wake Configuration
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#softdevice-compatibility" class="md-nav__link">
<span class="md-ellipsis">
SoftDevice Compatibility
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#cli-commands" class="md-nav__link">
<span class="md-ellipsis">
CLI Commands
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#debug-output" class="md-nav__link">
<span class="md-ellipsis">
Debug Output
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#phase-2-planned" class="md-nav__link">
<span class="md-ellipsis">
Phase 2 (Planned)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#references" class="md-nav__link">
<span class="md-ellipsis">
References
</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<a href="https://github.com/meshcore-dev/meshcore/edit/main/docs/nrf52_power_management.md" title="Edit this page" class="md-content__button md-icon" rel="edit">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 20H6V4h7v5h5v3.1l2-2V8l-6-6H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h4zm10.2-7c.1 0 .3.1.4.2l1.3 1.3c.2.2.2.6 0 .8l-1 1-2.1-2.1 1-1c.1-.1.2-.2.4-.2m0 3.9L14.1 23H12v-2.1l6.1-6.1z"/></svg>
</a>
<h1 id="nrf52-power-management">nRF52 Power Management</h1>
<h2 id="overview">Overview</h2>
<p>The nRF52 Power Management module provides battery protection features to prevent over-discharge, minimise likelihood of brownout and flash corruption conditions existing, and enable safe voltage-based recovery.</p>
<h2 id="features">Features</h2>
<h3 id="boot-voltage-protection">Boot Voltage Protection</h3>
<ul>
<li>Checks battery voltage immediately after boot and before mesh operations commence</li>
<li>If voltage is below a configurable threshold (e.g., 3300mV), the device configures voltage wake (LPCOMP + VBUS) and enters protective shutdown (SYSTEMOFF)</li>
<li>Prevents boot loops when battery is critically low</li>
<li>Skipped when external power (USB VBUS) is detected</li>
</ul>
<h3 id="voltage-wake-lpcomp-vbus">Voltage Wake (LPCOMP + VBUS)</h3>
<ul>
<li>Configures the nRF52's Low Power Comparator (LPCOMP) before entering SYSTEMOFF</li>
<li>Enables USB VBUS detection so external power can wake the device</li>
<li>Device automatically wakes when battery voltage rises above recovery threshold or when VBUS is detected</li>
</ul>
<h3 id="early-boot-register-capture">Early Boot Register Capture</h3>
<ul>
<li>Captures RESETREAS (reset reason) and GPREGRET2 (shutdown reason) before SystemInit() clears them</li>
<li>Allows firmware to determine why it booted (cold boot, watchdog, LPCOMP wake, etc.)</li>
<li>Allows firmware to determine why it last shut down (user request, low voltage, boot protection)</li>
</ul>
<h3 id="shutdown-reason-tracking">Shutdown Reason Tracking</h3>
<p>Shutdown reason codes (stored in GPREGRET2):</p>
<table>
<thead>
<tr>
<th>Code</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>0x00</td>
<td>NONE</td>
<td>Normal boot / no previous shutdown</td>
</tr>
<tr>
<td>0x4C</td>
<td>LOW_VOLTAGE</td>
<td>Runtime low voltage threshold reached</td>
</tr>
<tr>
<td>0x55</td>
<td>USER</td>
<td>User requested powerOff()</td>
</tr>
<tr>
<td>0x42</td>
<td>BOOT_PROTECT</td>
<td>Boot voltage protection triggered</td>
</tr>
</tbody>
</table>
<h2 id="supported-boards">Supported Boards</h2>
<table>
<thead>
<tr>
<th>Board</th>
<th>Implemented</th>
<th>LPCOMP wake</th>
<th>VBUS wake</th>
</tr>
</thead>
<tbody>
<tr>
<td>Seeed Studio XIAO nRF52840 (<code>xiao_nrf52</code>)</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>RAK4631 (<code>rak4631</code>)</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>Heltec T114 (<code>heltec_t114</code>)</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>GAT562 Mesh Watch13</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>Promicro nRF52840</td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>RAK WisMesh Tag</td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>Heltec Mesh Solar</td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>LilyGo T-Echo / T-Echo Lite</td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>SenseCAP Solar</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>WIO Tracker L1 / L1 E-Ink</td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>WIO WM1110</td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>Mesh Pocket</td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>Nano G2 Ultra</td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>ThinkNode M1/M3/M6</td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>T1000-E</td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>Ikoka Nano/Stick/Handheld (nRF)</td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>Keepteen LT1</td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>Minewsemi ME25LS01</td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
</tbody>
</table>
<p>Notes:
- "Implemented" reflects Phase 1 (boot lockout + shutdown reason capture).
- User power-off on Heltec T114 does not enable LPCOMP wake.
- VBUS detection is used to skip boot lockout on external power, and VBUS wake is configured alongside LPCOMP when supported hardware exposes VBUS to the nRF52.</p>
<h2 id="technical-details">Technical Details</h2>
<h3 id="architecture">Architecture</h3>
<p>The power management functionality is integrated into the <code>NRF52Board</code> base class in <code>src/helpers/NRF52Board.cpp</code>. Board variants provide hardware-specific configuration via a <code>PowerMgtConfig</code> struct and override <code>initiateShutdown(uint8_t reason)</code> to perform board-specific power-down work and conditionally enable voltage wake (LPCOMP + VBUS).</p>
<h3 id="early-boot-capture">Early Boot Capture</h3>
<p>A static constructor with priority 101 in <code>NRF52Board.cpp</code> captures the RESETREAS and GPREGRET2 registers before:
- SystemInit() (priority 102) - which clears RESETREAS
- Static C++ constructors (default priority 65535)</p>
<p>This ensures we capture the true reset reason before any initialisation code runs.</p>
<h3 id="board-implementation">Board Implementation</h3>
<p>To enable power management on a board variant:</p>
<ol>
<li>
<p><strong>Enable in platformio.ini</strong>:
<code>ini
-D NRF52_POWER_MANAGEMENT</code></p>
</li>
<li>
<p><strong>Define configuration in variant.h</strong>:
<code>c
#define PWRMGT_VOLTAGE_BOOTLOCK 3300 // Won't boot below this voltage (mV)
#define PWRMGT_LPCOMP_AIN 7 // AIN channel for voltage sensing
#define PWRMGT_LPCOMP_REFSEL 2 // REFSEL (0-6=1/8..7/8, 7=ARef, 8-15=1/16..15/16)</code></p>
</li>
<li>
<p><strong>Implement in board .cpp file</strong>:
```cpp
#ifdef NRF52_POWER_MANAGEMENT
const PowerMgtConfig power_config = {
.lpcomp_ain_channel = PWRMGT_LPCOMP_AIN,
.lpcomp_refsel = PWRMGT_LPCOMP_REFSEL,
.voltage_bootlock = PWRMGT_VOLTAGE_BOOTLOCK
};</p>
</li>
</ol>
<p>void MyBoard::initiateShutdown(uint8_t reason) {
// Board-specific shutdown preparation (e.g., disable peripherals)
bool enable_lpcomp = (reason == SHUTDOWN_REASON_LOW_VOLTAGE ||
reason == SHUTDOWN_REASON_BOOT_PROTECT);</p>
<pre><code> if (enable_lpcomp) {
configureVoltageWake(power_config.lpcomp_ain_channel, power_config.lpcomp_refsel);
}
enterSystemOff(reason);
</code></pre>
<p>}
#endif</p>
<p>void MyBoard::begin() {
NRF52Board::begin(); // or NRF52BoardDCDC::begin()
// ... board setup ...</p>
<p>#ifdef NRF52_POWER_MANAGEMENT
checkBootVoltage(&amp;power_config);
#endif
}
```</p>
<p>For user-initiated shutdowns, <code>powerOff()</code> remains board-specific. Power management only arms LPCOMP for automated shutdown reasons (boot protection/low voltage).</p>
<ol>
<li><strong>Declare override in board .h file</strong>:
<code>cpp
#ifdef NRF52_POWER_MANAGEMENT
void initiateShutdown(uint8_t reason) override;
#endif</code></li>
</ol>
<h3 id="voltage-wake-configuration">Voltage Wake Configuration</h3>
<p>The LPCOMP (Low Power Comparator) is configured to:
- Monitor the specified AIN channel (0-7 corresponding to P0.02-P0.05, P0.28-P0.31)
- Compare against VDD fraction reference (REFSEL: 0-6=1/8..7/8, 7=ARef, 8-15=1/16..15/16)
- Detect UP events (voltage rising above threshold)
- Use 50mV hysteresis for noise immunity
- Wake the device from SYSTEMOFF when triggered</p>
<p>VBUS wake is enabled via the POWER peripheral USBDETECTED event whenever <code>configureVoltageWake()</code> is used. This requires USB VBUS to be routed to the nRF52 (typical on nRF52840 boards with native USB).</p>
<p><strong>LPCOMP Reference Selection (PWRMGT_LPCOMP_REFSEL)</strong>:</p>
<table>
<thead>
<tr>
<th>REFSEL</th>
<th>Fraction</th>
<th>VBAT @ 1M/1M divider (VDD=3.0-3.3)</th>
<th>VBAT @ 1.5M/1M divider (VDD=3.0-3.3)</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>1/8</td>
<td>0.75-0.82 V</td>
<td>0.94-1.03 V</td>
</tr>
<tr>
<td>1</td>
<td>2/8</td>
<td>1.50-1.65 V</td>
<td>1.88-2.06 V</td>
</tr>
<tr>
<td>2</td>
<td>3/8</td>
<td>2.25-2.47 V</td>
<td>2.81-3.09 V</td>
</tr>
<tr>
<td>3</td>
<td>4/8</td>
<td>3.00-3.30 V</td>
<td>3.75-4.12 V</td>
</tr>
<tr>
<td>4</td>
<td>5/8</td>
<td>3.75-4.12 V</td>
<td>4.69-5.16 V</td>
</tr>
<tr>
<td>5</td>
<td>6/8</td>
<td>4.50-4.95 V</td>
<td>5.62-6.19 V</td>
</tr>
<tr>
<td>6</td>
<td>7/8</td>
<td>5.25-5.77 V</td>
<td>6.56-7.22 V</td>
</tr>
<tr>
<td>7</td>
<td>ARef</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td>8</td>
<td>1/16</td>
<td>0.38-0.41 V</td>
<td>0.47-0.52 V</td>
</tr>
<tr>
<td>9</td>
<td>3/16</td>
<td>1.12-1.24 V</td>
<td>1.41-1.55 V</td>
</tr>
<tr>
<td>10</td>
<td>5/16</td>
<td>1.88-2.06 V</td>
<td>2.34-2.58 V</td>
</tr>
<tr>
<td>11</td>
<td>7/16</td>
<td>2.62-2.89 V</td>
<td>3.28-3.61 V</td>
</tr>
<tr>
<td>12</td>
<td>9/16</td>
<td>3.38-3.71 V</td>
<td>4.22-4.64 V</td>
</tr>
<tr>
<td>13</td>
<td>11/16</td>
<td>4.12-4.54 V</td>
<td>5.16-5.67 V</td>
</tr>
<tr>
<td>14</td>
<td>13/16</td>
<td>4.88-5.36 V</td>
<td>6.09-6.70 V</td>
</tr>
<tr>
<td>15</td>
<td>15/16</td>
<td>5.62-6.19 V</td>
<td>7.03-7.73 V</td>
</tr>
</tbody>
</table>
<p><strong>Important</strong>: For boards with a voltage divider on the battery sense pin, LPCOMP measures the divided voltage. Use:
<code>VBAT_threshold ≈ (VDD * fraction) * divider_scale</code>, where <code>divider_scale = (Rtop + Rbottom) / Rbottom</code> (e.g., 2.0 for 1M/1M, 2.5 for 1.5M/1M, 3.0 for XIAO).</p>
<h3 id="softdevice-compatibility">SoftDevice Compatibility</h3>
<p>The power management code checks whether SoftDevice is enabled and uses the appropriate API:
- When SD enabled: <code>sd_power_*</code> functions
- When SD disabled: Direct register access (NRF_POWER-&gt;*)</p>
<p>This ensures compatibility regardless of BLE stack state.</p>
<h2 id="cli-commands">CLI Commands</h2>
<p>Power management status can be queried via the CLI:</p>
<table>
<thead>
<tr>
<th>Command</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>get pwrmgt.support</code></td>
<td>Returns "supported" or "unsupported"</td>
</tr>
<tr>
<td><code>get pwrmgt.source</code></td>
<td>Returns current power source - "battery" or "external" (5V/USB power)</td>
</tr>
<tr>
<td><code>get pwrmgt.bootreason</code></td>
<td>Returns reset and shutdown reason strings</td>
</tr>
<tr>
<td><code>get pwrmgt.bootmv</code></td>
<td>Returns boot voltage in millivolts</td>
</tr>
</tbody>
</table>
<p>On boards without power management enabled, all commands except <code>get pwrmgt.support</code> return:</p>
<pre><code>ERROR: Power management not supported
</code></pre>
<h2 id="debug-output">Debug Output</h2>
<p>When <code>MESH_DEBUG=1</code> is enabled, the power management module outputs:</p>
<pre><code>DEBUG: PWRMGT: Reset = Wake from LPCOMP (0x20000); Shutdown = Low Voltage (0x4C)
DEBUG: PWRMGT: Boot voltage = 3450 mV (threshold = 3300 mV)
DEBUG: PWRMGT: LPCOMP wake configured (AIN7, ref=3/8 VDD)
</code></pre>
<h2 id="phase-2-planned">Phase 2 (Planned)</h2>
<ul>
<li>Runtime voltage monitoring</li>
<li>Voltage state machine (Normal -&gt; Warning -&gt; Critical -&gt; Shutdown)</li>
<li>Configurable thresholds</li>
<li>Load shedding callbacks for power reduction</li>
<li>Deep sleep integration</li>
<li>Scheduled wake-up</li>
<li>Extended sleep with periodic monitoring</li>
</ul>
<h2 id="references">References</h2>
<ul>
<li><a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/power.html">nRF52840 Product Specification - POWER</a></li>
<li><a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/lpcomp.html">nRF52840 Product Specification - LPCOMP</a></li>
<li><a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/group__nrf__sdm__api.html">SoftDevice S140 API - Power Management</a></li>
</ul>
</article>
</div>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"annotate": null, "base": "..", "features": ["content.action.edit", "content.code.copy", "search.highlight", "search.suggest"], "search": "../assets/javascripts/workers/search.2c215733.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
<script src="../assets/javascripts/bundle.d7400e89.min.js"></script>
</body>
</html>