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