Hi,
I am developing a custom board which a based on the CircuitDojo designs. I try to get it in a low power state.
Step 1:
If I upload my application I have a average power consumption of 2,85 mA
Step 2:
Now I program the 1452.sysoff.hex from this page: Getting started with current measurements on the nRF9160 using Segger programmer and NRF Programmer application. Now I measure around 990 uA, much better. 
Step 3:
Now I reprogram exactly the same application as in step 1. And I measure 25 uA, which is perfect! I tested if the application is still running using the blinky sketch to blink the LED, this is working so all is good.

If I disconnect the board from the power source the power consumption is back at the power consumption of step 1. If I reset the device it has still the low power consumption of step 3.
Is this a known issue? Does the 1452.sysoff.hex set some registers I don't know of?
This is my application main.c
/*
* Copyright (c) 2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/pm/device.h>
#include <zephyr/logging/log.h>
#include <zephyr/logging/log_ctrl.h>
#include <modem/lte_lc.h>
#include <zephyr/drivers/flash.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/regulator.h>
#define SLEEP_TIME_MS 11000
#define LED0_NODE DT_ALIAS(led0)
const struct device *gpio_dev = DEVICE_DT_GET(DT_NODELABEL(gpio0));
const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
const struct device *reg_dev = DEVICE_DT_GET(DT_NODELABEL(reg_5v));
int pins[] = {1, 2, 3, 4, 5, 6, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
int num_pins = sizeof(pins) / sizeof(pins[0]);
void setPowerLow()
{
const struct device *flash_dev = DEVICE_DT_GET(DT_ALIAS(spi_flash0));
static const struct device *const console_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
NRF_CLOCK->TASKS_HFCLKSTOP = 1;
pm_device_action_run(flash_dev, PM_DEVICE_ACTION_SUSPEND);
pm_device_action_run(console_dev, PM_DEVICE_ACTION_SUSPEND);
}
int main(void)
{
setPowerLow();
lte_lc_power_off();
for (int i = 0; i < num_pins; i++)
{
gpio_pin_configure(gpio_dev, pins[i], GPIO_INPUT | GPIO_PULL_UP);
}
gpio_pin_configure(gpio_dev, 9, GPIO_INPUT | GPIO_PULL_UP);
gpio_pin_configure(gpio_dev, 10, GPIO_INPUT | GPIO_PULL_UP);
gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
while (1)
{
k_msleep(SLEEP_TIME_MS);
}
return 0;
}
This is my prj.conf
CONFIG_MAIN_STACK_SIZE=4096 CONFIG_GPIO=y CONFIG_PM_DEVICE=y CONFIG_LOG=y CONFIG_LTE_LINK_CONTROL=y CONFIG_FLASH=y CONFIG_SPI=y CONFIG_I2C=y CONFIG_DEBUG=n CONFIG_SPI=y CONFIG_SPI_NOR=y CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 CONFIG_SPI_NOR_IDLE_IN_DPD=y CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_PM_DEVICE=y CONFIG_LTE_LINK_CONTROL=y
Devicetree
/*
* Copyright (c) 2018-2020 Nordic Semiconductor ASA
* Copyright (c) 2020 Circuit Dojo LLC
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "circuitdojo_feather_nrf9160_common-pinctrl.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>
/ {
model = "Circuit Dojo nRF9160 Feather";
compatible = "circuitdojo,feather-nrf9160";
chosen {
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,uart-mcumgr = &uart0;
};
leds {
compatible = "gpio-leds";
red_led: led_0 {
gpios = <&gpio0 27 GPIO_ACTIVE_LOW>;
label = "Red LED";
};
};
buttons {
compatible = "gpio-keys";
button0: button_0 {
gpios = <&gpio0 26 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Switch 1";
zephyr,code = <INPUT_KEY_0>;
};
};
reg_5v: reg-5v {
compatible = "regulator-fixed";
regulator-name = "reg-5v";
enable-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
};
aliases {
led0 = &red_led;
bootloader-led0 = &red_led;
sw0 = &button0;
mcuboot-button0 = &button0;
mcuboot-led0 = &red_led;
watchdog0 = &wdt0;
spi-flash0 = &w25q32jv;
};
};
&adc {
status = "disabled";
};
&gpiote {
status = "okay";
};
&gpio0 {
status = "okay";
};
&uart0 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";
};
&spi3 {
compatible = "nordic,nrf-spim";
status = "okay";
cs-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
pinctrl-0 = <&spi3_default>;
pinctrl-1 = <&spi3_sleep>;
pinctrl-names = "default", "sleep";
w25q32jv: w25q32jv@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <40000000>;
wp-gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
hold-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
size = <0x2000000>;
has-dpd;
t-enter-dpd = <3000>;
t-exit-dpd = <30000>;
jedec-id = [ ef 40 16 ];
};
};
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x10000>;
};
slot0_partition: partition@10000 {
label = "image-0";
};
slot0_ns_partition: partition@40000 {
label = "image-0-nonsecure";
};
slot1_partition: partition@80000 {
label = "image-1";
};
slot1_ns_partition: partition@b0000 {
label = "image-1-nonsecure";
};
scratch_partition: partition@f0000 {
label = "image-scratch";
reg = <0x000f0000 0xa000>;
};
storage_partition: partition@fa000 {
label = "storage";
reg = <0x000fa000 0x00006000>;
};
};
};
/ {
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
sram0_s: image_s@20000000 {
/* Secure image memory */
};
sram0_bsd: image_bsd@20010000 {
/* BSD (shared) memory */
};
sram0_ns: image_ns@20020000 {
/* Non-Secure image memory */
};
};
};
/* Include partition configuration file */
#include "circuitdojo_feather_nrf9160_partition_conf.dtsi"
Pinctrl file
/*
* Copyright (c) 2022 Nordic Semiconductor
* SPDX-License-Identifier: Apache-2.0
*/
&pinctrl {
uart0_default: uart0_default {
group1 {
psels = <NRF_PSEL(UART_TX, 0, 6)>,
<NRF_PSEL(UART_RX, 0, 5)>;
};
};
uart0_sleep: uart0_sleep {
group1 {
psels = <NRF_PSEL(UART_TX, 0, 6)>,
<NRF_PSEL(UART_RX, 0, 5)>;
low-power-enable;
};
};
spi3_default: spi3_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 11)>,
<NRF_PSEL(SPIM_MOSI, 0, 12)>,
<NRF_PSEL(SPIM_MISO, 0, 8)>;
};
};
spi3_sleep: spi3_sleep {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 11)>,
<NRF_PSEL(SPIM_MOSI, 0, 12)>,
<NRF_PSEL(SPIM_MISO, 0, 8)>;
low-power-enable;
};
};
};
Thanks!