2019-11-19 08:08:08 +08:00
|
|
|
.. _nrf-system-off-sample:
|
|
|
|
|
|
|
|
nRF5x System Off demo
|
|
|
|
#####################
|
|
|
|
|
|
|
|
Overview
|
|
|
|
********
|
|
|
|
|
|
|
|
This sample can be used for basic power measurement and as an example of
|
|
|
|
deep sleep on Nordic platforms. The functional behavior is:
|
|
|
|
|
|
|
|
* Busy-wait for 2 seconds
|
2020-05-21 00:11:53 +08:00
|
|
|
* Sleep for 2 seconds without device power control
|
|
|
|
* Sleep for 2 seconds after turning UART off, which reduces current draw
|
|
|
|
by a couple hundred uA
|
2019-11-19 08:08:08 +08:00
|
|
|
* Turn the system off after enabling wakeup through a button press
|
|
|
|
|
|
|
|
A power monitor will be able to distinguish among these states.
|
|
|
|
|
2020-07-01 22:46:32 +08:00
|
|
|
This sample also demonstrates the use of a :c:func:`SYS_INIT()` call to
|
|
|
|
disable the deep sleep functionality before the kernel starts, which
|
|
|
|
prevents the board from powering down during initialization of drivers
|
|
|
|
that use unbounded delays to wait for startup.
|
|
|
|
|
2021-02-02 06:42:52 +08:00
|
|
|
RAM Retention
|
|
|
|
=============
|
|
|
|
|
|
|
|
On nRF52 platforms this also can demonstrate RAM retention. By selecting
|
|
|
|
``CONFIG_APP_RETENTION=y`` state related to number of boots, number of times
|
|
|
|
system off was entered, and total uptime since initial power-on are retained
|
|
|
|
in a checksummed data structure. The POWER peripheral is configured to keep
|
|
|
|
the containing RAM section powered while in system-off mode.
|
|
|
|
|
2019-11-19 08:08:08 +08:00
|
|
|
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/system_off
|
2020-04-03 00:24:56 +08:00
|
|
|
:board: nrf52dk_nrf52832
|
2019-11-19 08:08:08 +08:00
|
|
|
:goals: build flash
|
|
|
|
:compact:
|
|
|
|
|
|
|
|
Running:
|
|
|
|
|
|
|
|
1. Open UART terminal.
|
|
|
|
2. Power Cycle Device.
|
|
|
|
3. Device will demonstrate two activity levels which can be measured.
|
|
|
|
4. Device will demonstrate long sleep at minimal non-off power.
|
|
|
|
5. Device will turn itself off using deep sleep state 1. Press Button 1
|
|
|
|
to wake the device and restart the application as if it had been
|
|
|
|
powered back on.
|
|
|
|
|
|
|
|
Sample Output
|
|
|
|
=================
|
|
|
|
nRF52 core output
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
2020-05-21 00:11:53 +08:00
|
|
|
*** Booting Zephyr OS build v2.3.0-rc1-204-g5f2eb85f728d ***
|
2019-11-19 08:08:08 +08:00
|
|
|
|
2020-04-03 00:24:56 +08:00
|
|
|
nrf52dk_nrf52832 system off demo
|
2019-11-19 08:08:08 +08:00
|
|
|
Busy-wait 2 s
|
2020-05-21 00:11:53 +08:00
|
|
|
Busy-wait 2 s with UART off
|
2019-11-19 08:08:08 +08:00
|
|
|
Sleep 2 s
|
2020-05-21 00:11:53 +08:00
|
|
|
Sleep 2 s with UART off
|
2019-11-19 08:08:08 +08:00
|
|
|
Entering system off; press BUTTON1 to restart
|