Power consumption (System ON Idle)
The Power consumption (System ON Idle) sample demonstrates how to evaluate the power consumption of the nRF7120 SoC during the System ON Idle state. The sample application is set to periodically sleep for a configurable duration, after which the device wakes up from sleep, printing the wake up count. In addition to that, the sample demonstrates the different RAM retention levels available through the RAM power-down library.
Requirements
The sample supports the following development kit:
Hardware platforms |
PCA |
Board name |
|
|---|---|---|---|
nRF7120 DK |
nrf7120dk |
|
The sample also requires a Power Profiler Kit II (PPK2), for measuring current consumption.
Overview
At boot, the sample performs the following operations:
Prints a reminder to switch the board’s power off and back on before taking a power measurement (see Measuring the power consumption).
Applies the user-configured RAM retention level.
Enters a periodic loop, where it:
Transits to sleep (System ON Idle) for a period of
CONFIG_SAMPLE_POWER_CONSUMPTION_IDLE_SECONDS(10 seconds by default).Wakes up from sleep.
Prints the wake-up counter value.
Transits to sleep again.
RAM retention levels
By default, all application RAM is retained during System ON Idle. The sample’s own Kconfig allows the user to configure the amount of RAM that is retained, exposing a choice of retention levels, each backed by the RAM power-down library:
Kconfig option |
Behavior |
|---|---|
|
All RAM stays retained. No RAM is powered down. |
|
Only the first 64 KiB of RAM stays retained; the rest is powered down. |
|
Only the first 128 KiB of RAM stays retained; the rest is powered down. |
|
Only the first 256 KiB of RAM stays retained; the rest is powered down. |
|
Only the first 512 KiB of RAM stays retained; the rest is powered down. |
|
Powers down all RAM that is left unused by the sample application image, using the library’s own automatic detection ( |
Building and running
This sample can be found under nrf/samples/benchmarks/power_consumption in the nRF Connect SDK folder structure.
To build the sample, follow the instructions in Building an application for your preferred building environment. See also Programming an application for programming steps and Testing and optimization for general information about testing and debugging in the nRF Connect SDK.
Note
When building repository applications in the SDK repositories, building with sysbuild is enabled by default.
If you work with out-of-tree freestanding applications, you need to manually pass the --sysbuild parameter to every build command or configure west to always use it.
The default configuration (all RAM retained) is built with:
west build -p always -b nrf7120dk/nrf7120/cpuapp nrf/samples/benchmarks/power_consumption
To build the sample with any other of the supported RAM retention levels, pass the matching Kconfig option on the command line, for example:
west build -p always -b nrf7120dk/nrf7120/cpuapp nrf/samples/benchmarks/power_consumption -- -DCONFIG_SAMPLE_POWER_CONSUMPTION_RAM_RETAIN_64K=y
The same supported six configurations are also given in the tests.yaml file (for example sample.benchmarks.power_consumption.ram_retain_64k), for use with west build -T <name> or Twister.
Testing
After programming the sample to your development kit, complete the following steps to test it:
Measuring the power consumption
Important
The debugger or SWD connection used during flashing draws additional current and can leave the target in a state that does not reflect its true standalone power consumption. Always power-cycle the target after flashing before taking a reading, as described in Step 8 below.
P601 is a 1x3 header (pin 1 P5V0, pin 2 VBAT_5V0, pin 3 GND), normally bridged by the JP601 shunt jumper so P5V0 feeds straight through to VBAT_5V0.
To measure current with a PPK2 in source meter mode, complete the following steps:
Remove the JP601 shunt jumper from P601.
Connect the PPK2’s Vout to P601 pin 2 (
VBAT_5V0).Connect the PPK2’s GND to P601 pin 3 (
GND).Connect the USB cable to the DK to flash the image (the DK’s interface MCU/debugger runs on its own USB-derived supply; with the JP601 shunt removed, the nRF7120 itself is powered only from P601 pin 2, i.e. the PPK2, throughout).
In the PPK2 app, select Source Meter mode and enable power output with 3.6 V as the supply voltage.
Run
west flashto flash the image.Toggle the PPK2’s Enable power output control off and back on. This power-cycles the target now that the debugger is disconnected, giving an accurate measurement.
Sample output
The sample shows the following output:
Power consumption demo ready.
Switch the board's power off and back on now to get correct power consumption readings.
Woken up 1 time(s)
Woken up 2 time(s)
Woken up 3 time(s)
Dependencies
This sample uses the following nRF Connect SDK library:
It uses the following Zephyr library:
In addition, the non-secure build uses the following secure firmware component: