Increased current consumption moving from SDK2.3 to SDK2.6

Hi

I'm running the blinky sample (modified) on a custom board based on nrf9160. When compiling with SDK2.3 and toolchain 2.3 the current consumption is about 84uA (LED off).  But when changing to SDK 2.6 and toolchain 2.6 the current consumption increase to 3.81mA after a power cycle. It is the same (84uA) after flashing but before power cycle. The code is identical in both cases:

/*
 * 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>

/* 1000 msec = 1 sec */
#define SLEEP_TIME_MS   1000

/* The devicetree node identifier for the "led0" alias. */
#define LED0_NODE DT_ALIAS(led0)

/*
 * A build error on this line means your board is unsupported.
 * See the sample documentation for information on how to fix this.
 */
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
static const struct device *const uart =  DEVICE_DT_GET(DT_NODELABEL(uart0));

int main(void)
{
	int ret;

	if (!gpio_is_ready_dt(&led)) {
		return 0;
	}

	ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
	if (ret < 0) {
		return 0;
	}

	pm_device_action_run(uart, PM_DEVICE_ACTION_SUSPEND);

	while (1) {
		ret = gpio_pin_toggle_dt(&led);
		if (ret < 0) {
			return 0;
		}
		k_msleep(SLEEP_TIME_MS);
	}
	return 0;
}

Current consumption SDK2.3:

and with SDK2.6 after power cycling:

What is changed from SDK2.3 to SDK2.6, and how can I solve this?

  • The modem has to be turned off in SDK2.6 (but not in SDK2.3). This solves the problem.

    /*
     * 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/kernel.h>
    #include <modem/lte_lc.h>
    
    /* 1000 msec = 1 sec */
    #define SLEEP_TIME_MS   1000
    
    /* The devicetree node identifier for the "led0" alias. */
    #define LED0_NODE DT_ALIAS(led0)
    
    /*
     * A build error on this line means your board is unsupported.
     * See the sample documentation for information on how to fix this.
     */
    static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
    static const struct device *const uart =  DEVICE_DT_GET(DT_NODELABEL(uart0));
    
    int main(void)
    {
    	int ret;
    
    	if (!gpio_is_ready_dt(&led)) {
    		return 0;
    	}
    
    	ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
    	if (ret < 0) {
    		return 0;
    	}
    
    	pm_device_action_run(uart, PM_DEVICE_ACTION_SUSPEND);
    
    	nrf_modem_lib_init();
    	lte_lc_power_off();
    
    	while (1) {
    		ret = gpio_pin_toggle_dt(&led);
    		if (ret < 0) {
    			return 0;
    		}
    		k_msleep(SLEEP_TIME_MS);
    	}
    	return 0;
    }
    

    in prj.conf:

    CONFIG_GPIO=y
    CONFIG_PM_DEVICE=y
    
    CONFIG_LTE_LINK_CONTROL=y
    CONFIG_NRF_MODEM_LIB=y

    With this code the current consumption is back at 84uA.

Related