Over the past week, I’ve been spending time trying to work out how the Nordic nRF5 Series uses power. Specifically, I’m working on a side project at the moment that uses an nRF52832 chip.
Luckily, I have access to one of these:
tl;dr
I’ve uploaded the code used to test these scenarios to Github here:
https://github.com/nuket/mbed-power-profiling
Full Power
So the first thing I did was check how much mbed OS uses when it’s doing nothing but printing a message twice per second to the serial port, and blinking an LED, with no Bluetooth Low Energy stack:
Turns out the chip uses around 6mA just to do these things. This doesn’t factor in the current consumed by the blinking LED, as the Power Profiler Kit seems to only measure current supplied or consumed by the nRF52832 chip.
There are no special compiler flags used when building this firmware.
Enabling sleep()
mbed OS requires that it be built in release mode before the sleep()
function will work.
So the compile command will look like: mbed compile --profile release
.
In this case, the sleep()
mode is enabled, but because of a single printf()
in the main()
method, the UART circuitry is enabled and remains on forever.
The chip uses ~450uA forever, even though it is asleep.
Enabling sleep(), Eliminating printf()
By eliminating all calls to printf() in the program, the UART circuitry remains disabled, and the chip can exhibit proper low power behavior.
In this case, the chip uses roughly ~1.6 – 5uA while it is asleep, which is awesome.