2019-01-02 22:05:52 +08:00
|
|
|
.. _nrf5x-power-mgr-sample:
|
2017-10-05 20:42:34 +08:00
|
|
|
|
2019-01-02 22:05:52 +08:00
|
|
|
nRF5x Power management demo
|
2018-02-13 04:11:41 +08:00
|
|
|
###########################
|
2017-10-05 20:42:34 +08:00
|
|
|
|
|
|
|
Overview
|
|
|
|
********
|
|
|
|
|
|
|
|
This sample demonstrates a power manager app that uses the Zephyr
|
|
|
|
power management infrastructure to enter into Low Power state.
|
|
|
|
|
2019-01-02 21:53:39 +08:00
|
|
|
This app will cycle through the following power schemes each time the system
|
|
|
|
enters idle state:
|
2017-10-05 20:42:34 +08:00
|
|
|
|
2019-01-02 21:53:39 +08:00
|
|
|
1. Low Power State: Low Power State could be SoC, board and/or application
|
|
|
|
specific. Being in this state is transparent to devices. SOC and devices
|
|
|
|
do not lose context in this Mode. This example implements two Low Power
|
|
|
|
states, which are signaled using LEDs on the development kit:
|
2017-10-05 20:42:34 +08:00
|
|
|
|
2019-01-02 21:53:39 +08:00
|
|
|
A. LED1: [X], LED2: [X]: System is active, no low power state is selected.
|
2019-02-28 14:20:24 +08:00
|
|
|
B. LED1: [X], LED2: [ ]: System is idle, and the SYS_POWER_STATE_SLEEP_2
|
2019-01-02 21:53:39 +08:00
|
|
|
state is selected.
|
2019-02-28 14:20:24 +08:00
|
|
|
C. LED1: [ ], LED2: [ ]: System is idle, and the SYS_POWER_STATE_SLEEP_3
|
2019-01-02 21:53:39 +08:00
|
|
|
state is selected.
|
2017-10-05 20:42:34 +08:00
|
|
|
|
|
|
|
2. Deep Sleep: This Power State is mapped to SYSTEM OFF state. In this mode
|
|
|
|
all devices on board get suspended. All devices and SOC lose context on
|
|
|
|
wake up.
|
|
|
|
|
2019-01-02 21:53:39 +08:00
|
|
|
The power mode selection is done automatically by residency-based policy
|
|
|
|
implemented by the Zephyr Power Management Subsystem.
|
2017-10-05 20:42:34 +08:00
|
|
|
|
|
|
|
Requirements
|
|
|
|
************
|
|
|
|
|
2019-01-02 22:05:52 +08:00
|
|
|
This application uses nRF51 DK or nRF52 DK board for the demo.
|
2017-10-05 20:42:34 +08:00
|
|
|
|
|
|
|
Building, Flashing and Running
|
|
|
|
******************************
|
|
|
|
|
2017-11-12 17:13:07 +08:00
|
|
|
.. zephyr-app-commands::
|
|
|
|
:zephyr-app: samples/boards/nrf52/power_mgr
|
|
|
|
:board: nrf52_pca10040
|
|
|
|
:goals: build flash
|
|
|
|
:compact:
|
2017-10-05 20:42:34 +08:00
|
|
|
|
|
|
|
Running:
|
|
|
|
|
|
|
|
1. Open UART terminal.
|
|
|
|
2. Power Cycle Device.
|
2018-06-28 13:07:21 +08:00
|
|
|
3. Device will enter into Low Power Modes.
|
|
|
|
4. Press Button 1 on device to enter deep sleep state.
|
|
|
|
5. Press Button 2 on device to wake up from deep sleep state.
|
2017-10-05 20:42:34 +08:00
|
|
|
|
|
|
|
|
|
|
|
Sample Output
|
|
|
|
=================
|
2019-01-02 22:05:52 +08:00
|
|
|
nRF52 core output
|
2017-10-05 20:42:34 +08:00
|
|
|
-----------------
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
2019-01-11 18:36:49 +08:00
|
|
|
*** Power Management Demo on nrf52_pca10040 ***
|
|
|
|
Demo Description
|
|
|
|
Application creates idleness, due to which System Idle Thread is
|
|
|
|
scheduled and it enters into various Low Power States.
|
2018-06-28 13:07:21 +08:00
|
|
|
|
2019-01-11 18:36:49 +08:00
|
|
|
<-- App doing busy wait for 10 Sec -->
|
2018-06-28 13:07:21 +08:00
|
|
|
|
2019-01-11 18:36:49 +08:00
|
|
|
<-- App going to sleep for 10 Sec -->
|
2019-02-28 14:20:24 +08:00
|
|
|
--> Entering to SYS_POWER_STATE_SLEEP_2 state.
|
|
|
|
--> Exited from SYS_POWER_STATE_SLEEP_2 state.
|
2018-06-28 13:07:21 +08:00
|
|
|
|
2019-01-11 18:36:49 +08:00
|
|
|
<-- App doing busy wait for 10 Sec -->
|
2018-06-28 13:07:21 +08:00
|
|
|
|
2019-01-11 18:36:49 +08:00
|
|
|
<-- App going to sleep for 30 Sec -->
|
2019-02-28 14:20:24 +08:00
|
|
|
--> Entering to SYS_POWER_STATE_SLEEP_3 state.
|
|
|
|
--> Exited from SYS_POWER_STATE_SLEEP_3 state.
|
2018-06-28 13:07:21 +08:00
|
|
|
|
2019-02-28 14:20:24 +08:00
|
|
|
<-- Disabling SYS_POWER_STATE_SLEEP_3 state --->
|
2018-06-28 13:07:21 +08:00
|
|
|
|
2019-01-11 18:36:49 +08:00
|
|
|
<-- App doing busy wait for 10 Sec -->
|
2018-06-28 13:07:21 +08:00
|
|
|
|
2019-01-11 18:36:49 +08:00
|
|
|
<-- App going to sleep for 10 Sec -->
|
2019-02-28 14:20:24 +08:00
|
|
|
--> Entering to SYS_POWER_STATE_SLEEP_2 state.
|
|
|
|
--> Exited from SYS_POWER_STATE_SLEEP_2 state.
|
2018-06-28 13:07:21 +08:00
|
|
|
|
2019-01-11 18:36:49 +08:00
|
|
|
<-- App doing busy wait for 10 Sec -->
|
2018-06-28 13:07:21 +08:00
|
|
|
|
2019-01-11 18:36:49 +08:00
|
|
|
<-- App going to sleep for 30 Sec -->
|
2019-02-28 14:20:24 +08:00
|
|
|
--> Entering to SYS_POWER_STATE_SLEEP_2 state.
|
|
|
|
--> Exited from SYS_POWER_STATE_SLEEP_2 state.
|
2019-01-11 18:36:49 +08:00
|
|
|
|
2019-02-28 14:20:24 +08:00
|
|
|
<-- Enabling SYS_POWER_STATE_SLEEP_3 state --->
|
|
|
|
<-- Disabling SYS_POWER_STATE_SLEEP_2 state --->
|
2019-01-11 18:36:49 +08:00
|
|
|
|
|
|
|
<-- App doing busy wait for 10 Sec -->
|
|
|
|
|
|
|
|
<-- App going to sleep for 10 Sec -->
|
|
|
|
|
|
|
|
<-- App doing busy wait for 10 Sec -->
|
|
|
|
|
|
|
|
<-- App going to sleep for 30 Sec -->
|
2019-02-28 14:20:24 +08:00
|
|
|
--> Entering to SYS_POWER_STATE_SLEEP_3 state.
|
|
|
|
--> Exited from SYS_POWER_STATE_SLEEP_3 state.
|
2019-01-11 18:36:49 +08:00
|
|
|
|
2019-02-28 14:20:24 +08:00
|
|
|
<-- Enabling SYS_POWER_STATE_SLEEP_2 state --->
|
|
|
|
<-- Forcing SYS_POWER_STATE_SLEEP_3 state --->
|
2019-01-17 20:44:27 +08:00
|
|
|
|
|
|
|
<-- App doing busy wait for 10 Sec -->
|
|
|
|
|
|
|
|
<-- App going to sleep for 10 Sec -->
|