Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 1.69 KB

README.md

File metadata and controls

17 lines (11 loc) · 1.69 KB

Powertest

A embedded power benchmarking tool, based on ppk2-rs.

Uses the Nordic Power Profiler Kit II to measure current usage during tests run by defmt-test. See fw-example for an example of its use.

How it works

Powertest uses the Nordic Power Profiler Kit II (PPK2) to control device power and to measure its current usage. To get the most accurate results, powertest doesn't rely on info that is output by the debugger to determine what it should measure. Instead, the device can pull a pin low to signal that it is running a test, and push it high to signal that no test is currently running.

powertest is used as a Cargo runner, and takes the ELF that contains the test binary as an argument. It analyzes the ELF file to find out how many tests are going to be run by the device. Then, it loads the binary onto the chip using probe-rs and starts fetching measurements from the PPK2. These measurements contain data about current usage as well as on levels of the pins in the logic port. To determine when a test starts running, powertest listens for a high-to-low transition on pin D0 of the PPK2. It collects current usage data until it detects a low-to-high transition, at which point it outputs the average current use. It does this until as many high-to-low and low-to-high transitions are detected as there are tests defined in the ELF.