Working with the NRF9160 it is often important to make sure current / power consumption is at its absolute minimum. To understand power floor it makes sense to first take a look at basic Zephyr sample application such as blinky.
# assuming the nrf connect sdk is installed under ~/dev/nrf-1.7.1
cd ~/dev/nrf-1.7.1/zephyr/samples/basic/blinky
# pristine flag making sure no old build files are used
west build -b nrf9160dk_nrf9160_ns --pristine
west flash --erase
Above commands will build and flash the Blinky Example. Measuring current on P22 of the board with a multimeter quickly shows a power draw of about 521 uA which is unusually high.
The source of the issue lies in the Secure Partition Manager module which has a configuration Flag set (CONFIG_SERIAL=y
). Even setting CONFIG_SERIAL=n
in the local proj.conf
file will not disable the flag since it is still used by the spm
module.
Manually overriding the .config
file ~/nrf-1.7.1/zephyr/samples/basic/blinky/build/spm/zephyr/.config
would in this case solve the issue and rebuilding would result in measuring idle consumption of about 3uA. However, there is a more convenient and opinionated way of setting this value by changing the menuconfig for spm
using:
# start the menuconfig for spm
west build -b nrf9160dk_nrf9160_ns -t spm_menuconfig

/serial
in the menuconfig and find the config flag.
Rebuilding will then allow the current consumption to drop to the expected floor of about 3uA.
The prj.conf
used in the example:
CONFIG_GPIO=n
CONFIG_LOG=n
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n
CONFIG_RTT_CONSOLE=n
CONFIG_USE_SEGGER_RTT=n
CONFIG_LOG_BACKEND_RTT=n
CONFIG_SERIAL=n
CONFIG_AT_HOST_LIBRARY=n
CONFIG_STDOUT_CONSOLE=n
Another even more persistent way of configuring the spm config flags is to utilize the Project File structure:
child_image/
└── spm
└── prj.conf
And configure the flags in the file ./child_image/spm/prj.conf
# Configuration copied from the nRF Secure Partition Manager (SPM) sample:
CONFIG_IS_SPM=y
CONFIG_FW_INFO=y
CONFIG_GPIO=y
CONFIG_SERIAL=n
Hope this is helpful for figuring out power issues with the nrf9160 DK.