OS Power management demo

Overview

This sample demonstrates OS managed power saving mechanism through the sample application which will periodically go sleep there by invoking the idle thread which will call the sys_suspend() to enter into low power states. The Low Power state will be selected based on the next timeout event.

Requirements

This application uses nrf52 DK board for the demo.

Building, Flashing and Running

# On Linux/macOS
cd $ZEPHYR_BASE/samples/subsys/power/power_mgr
mkdir build && cd build
# On Windows
cd %ZEPHYR_BASE%\samples\subsys\power\power_mgr
mkdir build & cd build
cmake -GNinja -DBOARD=nrf52_pca10040 ..
ninja
ninja flash

Running:

  1. Open UART terminal.
  2. Power Cycle Device.
  3. Device will enter into Low Power Modes periodically.

Sample Output

nrf52 core output

***OS Power Management Demo on arm****
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 6000 msec -->
Entering Low Power state (0)
Entering Low Power state (0)
Entering Low Power state (0)
Entering Low Power state (0)

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

<-- App going to sleep for 11000 msec -->
Entering Low Power state (1)
Entering Low Power state (1)
Entering Low Power state (1)
Entering Low Power state (1)

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

<-- App going to sleep for 6000 msec -->
Entering Low Power state (0)
Entering Low Power state (0)
Entering Low Power state (0)
Entering Low Power state (0)

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

<-- App going to sleep for 11000 msec -->
Entering Low Power state (1)
Entering Low Power state (1)
Entering Low Power state (1)
Entering Low Power state (1)
OS managed Power Management Test completed