Getting started¶
From nothing to a first capture in six steps: install, wire, check, capture, read, and open the capture in the app.
Step 1: installation¶
Install it from PyPI:
If you only want the command, uv installs it as a tool, in an environment of its own:
To run it once without installing anything, use
uvx --from ppk2-lib ppk2 list.
This gives you the ppk2 command and the ppk2 Python package. You
need Python 3.11 or newer. Two dependencies come with it,
pyserial and
typer; there is nothing to compile.
In a project of your own, add it as a dependency, here with uv:
What it has been tested on:
| Linux | macOS | Windows | |
|---|---|---|---|
| Unit tests, Python 3.11 and 3.13 | yes | yes | yes |
| Tests with a PPK2 on a bench | no | yes, macOS 26 | no |
The package is written for the three systems and uses nothing that is
specific to one of them: pyserial handles the serial port on each.
So far, the tests that need a PPK2 on a bench have run on a Mac only.
Step 2: wiring¶
Wire it as you would for the Power Profiler app. The PPK2 has two modes, named here as in the app, and the wiring decides which one you use. See Nordic's PPK2 user guide for both wirings on a dev kit, for the Ampere meter and for the Source meter.
Ampere meter mode¶
The device under test (DUT) has its own supply and the PPK2 sits in series with it. This is the default.
supply ──────► VIN ┐
│ PPK2 measures the current passing through
DUT VDD ◄────── VOUT ┘
DUT GND ─────── GND
--vddsets nothing in this mode, but the calibration uses it. Give the voltage the DUT really runs at. The default is 3.3. See the Principle page for how much a wrong value costs.- Nothing else may feed the DUT. Current that reaches it by a second path does not pass through the PPK2 and is not measured.
- Nordic's dev kits have a current-measurement header for this: remove
the jumper and put the PPK2 across it,
VINon the supply side.
Source meter mode¶
The PPK2 supplies the DUT. Add --source, and --vdd becomes the
supply voltage, from 0.8 to 5.0 V.
The PPK2 can supply up to 1 A. Above 400 mA the user guide recommends
a second USB supply, on the USB POWER ONLY socket.
A DUT powered this way is off until a command switches it on, and off again when the command ends: the PPK2 cuts power when its serial port closes.
Digital inputs (optional)¶
The logic port has eight digital inputs, D0 to D7, sampled together
with the current. They are optional. To use them, connect:
- the signals you want to see to
D0toD7; - the logic port's
GNDto the DUT's ground; - the logic port's
VCCto the DUT's VDD. The PPK2 uses it as the reference to tell high from low.
Step 3: connection check¶
Only one program can hold a PPK2, so quit the app first.
$ ppk2 list
PPK2 serial=A1B2C3D4E5F6
/dev/cu.usbmodemA1B2C3D4E5F62 [data port]
/dev/cu.usbmodemA1B2C3D4E5F64 [idle]
A PPK2 has two serial ports and only one carries data. ppk2 list
shows which, and marks a port busy when another program holds it.
With several PPK2s attached, add --serial A1B2C3D4E5F6 to any
command that opens one.
$ ppk2 metadata
Calibrated: false
HW: 46575
IA: 60
VDD: 3300 mV
mode: 2 (Source meter)
R : [ 1.002119e+03, 1.014783e+02, 1.033613e+01, 9.682840e-01, 5.643343e-02]
...
This is the calibration the PPK2 reports, plus the voltage and mode it was left in. Nordic's documentation gives the LED as breathing blue in Ampere meter mode and breathing red in Source meter mode.
Calibrated: false is normal
It does not mean the readings are wrong. See
the Calibrated flag.
Step 4: first capture¶
In Ampere meter mode, the default:
In Source meter mode, with the PPK2 powering the DUT at 3.3 V:
$ ppk2 capture --out first.csv --seconds 5 --source --vdd 3.3
opening session (Source meter mode, vdd=3300 mV)
capturing 5.00 s -> first.csv (Ctrl-C to stop early)
[ 1.0s] 100249 samples mean 945.69 µA
[ 2.0s] 199681 samples mean 826.16 µA
[ 3.0s] 300033 samples mean 783.65 µA
[ 4.0s] 400385 samples mean 761.46 µA
captured 500000 samples over 5.00 s (99936 Hz)
Progress goes to the terminal and the samples go to the file. Ctrl-C stops early and keeps what was recorded.
A capture switches the DUT on as it starts and off as it ends, so the boot is in the file. The current rises about 10 ms into it.
Step 5: reading the file¶
The CSV uses the 11 columns of the app's export, one row every 0.01 ms:
Timestamp(ms),Current(uA),D0-D7,D0,D1,D2,D3,D4,D5,D6,D7
0,0.000,00000000,0,0,0,0,0,0,0,0
0.01,0.000,00000000,0,0,0,0,0,0,0,0
0.02,0.000,00000000,0,0,0,0,0,0,0,0
A quick look with numpy:
import numpy as np
t_ms, ua = np.loadtxt("first.csv", delimiter=",", skiprows=1, usecols=(0, 1), unpack=True)
print(f"{len(ua)} samples over {t_ms[-1] / 1000:.2f} s")
print(f"mean {ua.mean():.2f} µA, max {ua.max():.0f} µA")
See File formats for the columns in detail.
Step 6: opening the capture in the app (optional)¶
A name ending in .ppk2 gives a session file in the format the app
saves and loads, and ppk2 convert makes one from a CSV:
Here the CSV is 20.1 MB and the session file 0.7 MB. See File formats for how far this format has been checked.
Recap¶
You have:
- installed the
ppk2command and the Python package; - wired the PPK2 in Ampere meter mode or in Source meter mode;
- checked the connection with
ppk2 listandppk2 metadata; - recorded a capture to a CSV file;
- read the file with numpy, and converted it for the app.
Platform notes¶
macOS¶
The two ports are /dev/cu.usbmodem*.
Linux¶
The ports are /dev/ttyACM*. Your user must be allowed to open them,
which usually means joining the dialout group:
Some distributions use uucp instead. ls -l /dev/ttyACM0 shows the
group.
Windows¶
The PPK2 shows up as two COM ports. Two things are not supported on Windows yet, because they use POSIX calls:
ppk2 power on --hold;- Ctrl-C during
ppk2 run.
Nordic development kits¶
- nRF52840 DK: set switch SW6 to "nRF only" to measure. Otherwise the interface chip stays on the measured supply, and its current hides that of the nRF52840.
- nRF54L15 DK and nRF54LM20 DK: put the PPK2 across the current-measurement header. With everything else left connected, the nRF54LM20 DK idles at 1.4 µA with the bench firmware of this repository, as the validation shows.
- After flashing, an nRF chip stays in debug mode and draws more until it is power-cycled. On the nRF54LM20 DK the same firmware idled at 330 µA after a flash and a reset. A capture power-cycles the DUT.
Next steps¶
- Command reference: every command and option.
- Recipes: flashing, the current of a marked region, long captures, comparing two builds.
- Principle: what the numbers are.