zephyr/samples/boards/nrf52/power_mgr
Piotr Mienkowski f04a4c9deb power: rename CPU_LPS_n power states
CPU_LPS_n name used to indicate a low power state is cryptic and
incorrect. The low power states act on the whole SoC and not exclusively
on the CPU. This patch renames CPU_LPS_n states to LOW_POWER_n. Also
HAS_ pattern for Kconfig options is used in favor of a non standard
_SUPPORTED. Naming of deep sleep states was adjusted accordingly.

Following is a detailed list of string replacements used:
s/SYS_POWER_STATE_CPU_LPS_(\d)_SUPPORTED/HAS_STATE_LOW_POWER_$1/
s/SYS_POWER_STATE_CPU_LPS_(\d)/SYS_POWER_STATE_LOW_POWER_$1/
s/SYS_POWER_STATE_DEEP_SLEEP_(\d)_SUPPORTED/HAS_STATE_DEEP_SLEEP_$1/

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-02-26 02:30:13 +01:00
..
src power: rename CPU_LPS_n power states 2019-02-26 02:30:13 +01:00
CMakeLists.txt cmake: increase minimal required version to 3.13.1 2019-01-03 11:51:29 -05:00
Kconfig power: rename CPU_LPS_n power states 2019-02-26 02:30:13 +01:00
README.rst power: rename CPU_LPS_n power states 2019-02-26 02:30:13 +01:00
prj.conf power: policy_residency: Update Kconfig options description 2019-02-19 13:25:36 -05:00
prj_tickless.conf power: Fix naming of Kconfig options controlling deep sleep states 2019-02-12 07:46:32 -05:00
sample.yaml power: rename CPU_LPS_n power states 2019-02-26 02:30:13 +01:00

README.rst

.. _nrf5x-power-mgr-sample:

nRF5x Power management demo
###########################

Overview
********

This sample demonstrates a power manager app that uses the Zephyr
power management infrastructure to enter into Low Power state.

This app will cycle through the following power schemes each time the system
enters idle state:

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:

   A. LED1: [X], LED2: [X]: System is active, no low power state is selected.
   B. LED1: [X], LED2: [ ]: System is idle, and the SYS_POWER_STATE_LOW_POWER_2
      state is selected.
   C. LED1: [ ], LED2: [ ]: System is idle, and the SYS_POWER_STATE_LOW_POWER_3
      state is selected.

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.

The power mode selection is done automatically by residency-based policy
implemented by the Zephyr Power Management Subsystem.

Requirements
************

This application uses nRF51 DK or nRF52 DK board for the demo.

Building, Flashing and Running
******************************

.. zephyr-app-commands::
   :zephyr-app: samples/boards/nrf52/power_mgr
   :board: nrf52_pca10040
   :goals: build flash
   :compact:

Running:

1. Open UART terminal.
2. Power Cycle Device.
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.


Sample Output
=================
nRF52 core output
-----------------

.. code-block:: console

  *** 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.

  <-- App doing busy wait for 10 Sec -->

  <-- App going to sleep for 10 Sec -->
  --> Entering to SYS_POWER_STATE_LOW_POWER_2 state.
  --> Exited from SYS_POWER_STATE_LOW_POWER_2 state.

  <-- App doing busy wait for 10 Sec -->

  <-- App going to sleep for 30 Sec -->
  --> Entering to SYS_POWER_STATE_LOW_POWER_3 state.
  --> Exited from SYS_POWER_STATE_LOW_POWER_3 state.

  <-- Disabling SYS_POWER_STATE_LOW_POWER_3 state --->

  <-- App doing busy wait for 10 Sec -->

  <-- App going to sleep for 10 Sec -->
  --> Entering to SYS_POWER_STATE_LOW_POWER_2 state.
  --> Exited from SYS_POWER_STATE_LOW_POWER_2 state.

  <-- App doing busy wait for 10 Sec -->

  <-- App going to sleep for 30 Sec -->
  --> Entering to SYS_POWER_STATE_LOW_POWER_2 state.
  --> Exited from SYS_POWER_STATE_LOW_POWER_2 state.

  <-- Enabling SYS_POWER_STATE_LOW_POWER_3 state --->
  <-- Disabling SYS_POWER_STATE_LOW_POWER_2 state --->

  <-- 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 -->
  --> Entering to SYS_POWER_STATE_LOW_POWER_3 state.
  --> Exited from SYS_POWER_STATE_LOW_POWER_3 state.

  <-- Enabling SYS_POWER_STATE_LOW_POWER_2 state --->
  <-- Forcing SYS_POWER_STATE_LOW_POWER_3 state --->

  <-- App doing busy wait for 10 Sec -->

  <-- App going to sleep for 10 Sec -->