While Nordic's wireless devices are designed to offer high performance while maximizing battery life, the actual performance of the end-product is determined by the developer's hardware and software design.
Finding out how and where the end design is using power can be tricky. For example, a multimeter might provide an overview of average power consumption. But it doesn't reveal the instantaneous power consumption details needed to help diagnose power anomalies. At the other end of the instrumentation scale, instruments such as power analyzers reveal more detail, but are heavy and expensive, limiting accessibility. Nordic's Power Profiler Kit II (PPK2) is an inexpensive, portable and standalone alternative to a power analyzer, yet capable of comprehensive power profiling. The PPK2 can be used throughout the entire engineering cycle and can always be available on the developer's desk.
By using the PPK2 to make power consumption measurements at all stages of software and hardware development, power problems are identified early, making it easier to avoid time-consuming code and component revisions later.
The merits of good coding
While the PPK2 can help resolve power anomalies, some key design guidelines can help the developer avoid problems in the first place. Example scenario: The code might send the SoC into a waiting loop instead of entering a low-power sleep state. The low-power sleep state saves power, but the waiting loop does not. As a result, the processor is burning power when the designer intended it to do nothing at all.
That makes it important to create software that ensures the device wakes up and goes to sleep exactly when intended. It's also a good idea to structure the code to make it easily readable to humans. That makes it easier to spot unnecessary or necessary changes. For example, where parameters need to be changed to avoid peripherals remaining active when they're not needed.
Beware of the power pitfalls
Another problem occurs when the SoC goes to sleep as intended, but wakes up more often than necessary. A timer might wake up the processor to read some sensor data, even if the application doesn't need the information. For example, a design that only needs to respond when turned upside-down could use a slower sampling rate than an application that regularly reports its 3D position.
A further issue that burns power is event logging. Logging is convenient during the development and debugging stage of the application design, but it uses peripherals that consume power. Often this logging is not required for production devices, but developers often forget to disable it - to the detriment of battery life.
Simple power profiling
Embedded wireless devices continuously change between low power- and active modes. And short duty cycles are common to low-power wireless designs. This can make it a challenge to determine a comprehensive power profile.
But now—once a developer has done their best to optimize their software and hardware for extended battery life—it's easy to use the PPK2 to check out the design's actual performance. No debugger is required, just a USB connection to a PC or Mac and a power profiling software package downloaded from inside Nordic's nRF Connect for Desktop application.
The PPK2 then enables accurate instantaneous and average power consumption measurements across a range of single microamperes up to one Ampere. The resolution varies between 100 nanoamps and one milliamp depending on the measurement range. Which is suitable to detect the small power spikes typical of low-power optimized systems.
Checking the actual design against a theoretical model
The first thing to do when checking a wireless design, is to use the PPK2 to check the power consumption when the processor is supposed to be in a power-saving mode. Anything other than modest power consumption could indicate a processor that's working instead of sleeping.
To guide your expectations, it can be useful to compare your measurements to a theoretical estimate. The Online Power Profiler in the DevZone lets you do this. It will calculate and summarize the expected current consumption in the application phases where you are using the radio - provided that you enter the configuration parameters that match your code. Cross-referencing these estimates to what you measured might help you highlight possible anomalies for closer inspection.
A low-end logic analyzer
The PPK2 supports nRF51, nRF52, and nRF53 SoCs and the nRF91 SiP. It also supports all of Nordic's development kits (DKs) as well as external hardware.
The device is powered from a standard 5V USB port. The external device under test (DUT) can either be powered from an external source or optionally from the 1 Ampere (1 A) capable power supply built into the PPK2. This allows the PPK2 to both measure and optionally supply current for your custom designs without requiring an external power source.
The PPK2 also has eight digital inputs that makes it useful as a low-end logic analyzer. By connecting up to eight digital outs from your DUT to the PPK2, you can analyze those outputs in synchronization with code execution. The outputs can be an actual 8-bit output register, like an SPI module, or pure debug output implemented by you.
This article was first published on Nordic's Get Connected Blog.