This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Excessive power consumption in bootloader_secure_ble?

Hi all,

I am developing an application for a product where power consumption is critical. The application is bundled with the Secure DFU bootloader. I noticed that the bootloader draws more current than I'd like -- between 8 and 11 mA for more than 600 ms before it boots the application. I am developing on Linux and gcc on the nRF52 development kit.

Below are steps for a minimal working example.

1. Build the BLE bootloader and save it in ~/dfu/

$ cd <sdk_root>/examples/dfu/bootloader_secure_ble/pca10040/armgcc
$ make -j
$ cp _build/nrf52832_xxaa_s132.hex ~/dfu/ble_bootloader.hex

2. Build the BLE app template and save it with the bootloader

$ cd <sdk_root>/examples/ble_peripheral/ble_app_template/pca10040/s132/armgcc
$ make -j
$ cp _build/nrf52832_xxaa.hex ~/dfu/template_application.hex

3. Merge and flash (run as a shell script)

#!/bin/bash

# generate bootloader settings
nrfutil settings generate \
	--family NRF52 \
	--application template_application.hex \
	--application-version 0 \
	--bootloader-version 0 \
	--bl-settings-version 1 \
	bootloader_settings.hex

# merge bootloader and bootloader settings
mergehex --merge \
	bootloader.hex \
	bootloader_settings.hex \
	--output bootloader_settings_merged.hex

# merge previous with softdevice
mergehex --merge \
	<sdk_root>/components/softdevice/s132/hex/s132_nrf52_5.0.0_softdevice.hex \
	bootloader_settings_merged.hex \
	--output softdevice_bootloader_merged.hex
	
# merge previous with ble_app_template
mergehex --merge \
	softdevice_bootloader_merged.hex \
	template_application.hex \
	--output combined.hex

# flash the combined hex
nrfjprog -f nrf52 --eraseall
nrfjprog -f nrf52 --program combined.hex
nrfjprog -f nrf52 --reset

A trace showing the current consumption of this hex is shown below. It was obtained using an OTII device by applying 3.3 V to the external supply pins of the nRF52 DK and observing the current draw. I do have a Power Profiler Kit as well, but I'm unable to get it to show up in nrfconnect -- but that's another discussion.

Disregard the initial large spike in current, it is an artifact of my measuring tool. At the beginning you can see the bootloader doing some magic before the application starts (LED blink and advertising spikes are obvious).

To flash only the application and softdevice, I run the following commands:

#!/bin/bash

# merge application with softdevice
mergehex --merge \
	template_application.hex \
	<sdk_root>/components/softdevice/s132/hex/s132_nrf52_5.0.0_softdevice.hex \
	--output softdevice_application_merged.hex
	
# flash the combined hex
nrfjprog -f nrf52 --eraseall
nrfjprog -f nrf52 --program softdevice_application_merged.hex
nrfjprog -f nrf52 --reset

This yields the below power trace.

Is this behavior expected, or am I doing something wrong? Any help is greatly appreciated.

Best,

Fredrik

  • Hi Fredrik, 

    Which SDK version are you using? Judging from the SoftDevice version, S132 v5.0.0 it would seem that its SDK v14.x.x. I did a quick power profiling of the bootloader alone with the SoftDevice using the Nordic PPK and the result is an average current consumption of 5mA. The Secure Bootloader projects from SDK v12.x.x through SDK v14.x.x were never power optimized as they only ran on the device for a very limited time , which explains the high average currents. 

      

    The Secure Bootloader from SDK 15 on the other hand has been optimized both for power efficiancy as well as throughput( thats another story). The average current used by the SDK v15.0.0 BL is about 114uA, which is a a vast improvement from SDK v14.0.0

    I also compiled the ble_app_template project from SDK 15 and generated the settings page and flashed both to the nRF52 DK with the SDK 15 Bootloader

    The first spike coincides with the power being applied and the second is the application starting up. What kind of average currents are you seeing in your measurements? I would anyway recommend moving to the latest SDK version. 

    Best regards

    Bjørn 

     

  • Hi Bjørn,

    Thanks for your detailed answer. I am indeed using SDK 14.2.0. It's good to hear that the bootloader has been power optimized in SDK 15, and I think we will migrate. 

Related