Current draw on nrf9160

Hi,

I have a custom board running with the nrf9160.  It also has the npm1300.

I have it set up so that it is configuring the pmic and then turns off the cell and goes to sleep.

But when it is sleeping it is only getting down to about 1 mA, and has spikes up to 25mA.


Here is some of my code / configuration.  I have some pins configured for peripherals that aren't being used, but the intention is that they are in sleep mode.

main.c

int main(void){

    pmic_init();

    nrf_modem_lib_init();
    while (1) {
        lte_lc_offline();
        k_sleep(K_FOREVER);
    }
    return 0;
}

void pmic_init(){
    if (!device_is_ready(pmic)) {
        LOG_DBG("Pmic device not ready.\n");
        return;
    }

    if (!device_is_ready(regulators)) {
        LOG_DBG("Regulator device not ready.\n");
        return;
    }

    if (!device_is_ready(ldsw)) {
        LOG_DBG("Load switch device not ready.\n");
        return;
    }

    if (!device_is_ready(charger)) {
        LOG_DBG("Charger device not ready.\n");
        return;
    }

    static struct gpio_callback event_cb;

    int events_to_watch =
        (BIT(NPM1300_EVENT_CHG_COMPLETED) | BIT(NPM1300_EVENT_CHG_ERROR) | BIT(NPM1300_EVENT_BATTERY_DETECTED)
         | BIT(NPM1300_EVENT_BATTERY_REMOVED) | BIT(NPM1300_EVENT_WATCHDOG_WARN) | BIT(NPM1300_EVENT_VBUS_DETECTED)
         | BIT(NPM1300_EVENT_VBUS_REMOVED));

    LOG_DBG("Watching events %08x", events_to_watch);

    gpio_init_callback(&event_cb, event_callback, events_to_watch);

    mfd_npm1300_add_callback(pmic, &event_cb);

    /* Initialise vbus detection status */
    struct sensor_value val;
    int ret = sensor_attr_get(charger, SENSOR_CHAN_CURRENT, SENSOR_ATTR_UPPER_THRESH, &val);

    if (ret < 0) {
        return;
    }

    vbus_connected = (val.val1 != 0) || (val.val2 != 0);

    return;


#Enable logger module
CONFIG_LOG=y

#Enable logging through UART
CONFIG_SERIAL=y
CONFIG_SHELL_LOG_BACKEND=y

#Enable shell
CONFIG_SHELL=y
#CONFIG_SHELL_MINIMAL=y
CONFIG_CBPRINTF_FP_SUPPORT=y

CONFIG_ASSERT=y
CONFIG_EVENTS=y

# Generic
CONFIG_GPIO=y
CONFIG_I2C=y
CONFIG_SENSOR=y
CONFIG_TFM_SECURE_UART=n
CONFIG_TFM_LOG_LEVEL_SILENCE=y

# Enable PMIC
CONFIG_I2C_NRFX=y
CONFIG_NRFX_TWIM2=y
CONFIG_REGULATOR=y
CONFIG_NPM1300_CHARGER=y
CONFIG_LED=y
CONFIG_LOG_CMDS=y

# Cell
CONFIG_LTE_LINK_CONTROL=y

&pinctrl {
	uart3_default: uart3_default {
		group1 {
			psels = <NRF_PSEL(UART_TX, 0, 5)>,
				<NRF_PSEL(UART_RTS, 0, 7)>;
		};
		group2 {
			psels = <NRF_PSEL(UART_RX, 0, 6)>,
				<NRF_PSEL(UART_CTS, 0, 8)>;
			bias-pull-up;
		};
	};

	uart3_sleep: uart3_sleep {
		group1 {
			psels = <NRF_PSEL(UART_TX, 0, 5)>,
				<NRF_PSEL(UART_RX, 0, 6)>,
				<NRF_PSEL(UART_RTS, 0, 7)>,
				<NRF_PSEL(UART_CTS, 0, 8)>;
			low-power-enable;
		};
	};

	uart1_default: uart1_default {
		group1 {
			psels = <NRF_PSEL(UART_TX, 0, 1)>,
				<NRF_PSEL(UART_RTS, 0, 14)>;
		};
		group2 {
			psels = <NRF_PSEL(UART_RX, 0, 0)>,
				<NRF_PSEL(UART_CTS, 0, 15)>;
			bias-pull-up;
		};
	};

	uart1_sleep: uart1_sleep {
		group1 {
			psels = <NRF_PSEL(UART_TX, 0, 1)>,
				<NRF_PSEL(UART_RX, 0, 0)>,
				<NRF_PSEL(UART_RTS, 0, 14)>,
				<NRF_PSEL(UART_CTS, 0, 15)>;
			low-power-enable;
		};
	};

	uart2_default: uart2_default {
		group1 {
			psels = <NRF_PSEL(UART_TX, 0, 24)>,
				<NRF_PSEL(UART_RX, 0, 23)>;
		};
	};

	uart2_sleep: uart2_sleep {
		group1 {
			psels = <NRF_PSEL(UART_TX, 0, 24)>,
				<NRF_PSEL(UART_RX, 0, 23)>;
			low-power-enable;
		};
	};

	i2c2_default: i2c2_default {
		group1 {
			psels = <NRF_PSEL(TWIM_SDA, 0, 30)>,
				<NRF_PSEL(TWIM_SCL, 0, 31)>;
		};
	};

	i2c2_sleep: i2c2_sleep {
		group1 {
			psels = <NRF_PSEL(TWIM_SDA, 0, 30)>,
				<NRF_PSEL(TWIM_SCL, 0, 31)>;
				low-power-enable;
		};
	};

	i2c0_default: i2c0_default {
		group1 {
			psels = <NRF_PSEL(TWIM_SDA, 0, 12)>,
				<NRF_PSEL(TWIM_SCL, 0, 11)>;
		};
	};

	i2c0_sleep: i2c0_sleep {
		group1 {
			psels = <NRF_PSEL(TWIM_SDA, 0, 12)>,
				<NRF_PSEL(TWIM_SCL, 0, 11)>;
			low-power-enable;
		};
	};

	pwm0_default: pwm0_default {
		group1 {
			psels = <NRF_PSEL(PWM_OUT0, 0, 2)>;
		};
	};

	pwm0_sleep: pwm0_sleep {
		group1 {
			psels = <NRF_PSEL(PWM_OUT0, 0, 2)>;
			low-power-enable;
		};
	};

	spi1_default: spi1_default {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 0, 30)>,
				<NRF_PSEL(SPIM_MISO, 0, 28)>,
				<NRF_PSEL(SPIM_MOSI, 0, 31)>;
			nordic,drive-mode = <NRF_DRIVE_H0H1>;
		};
	};

	spi1_sleep: spi1_sleep {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 0, 30)>,
				<NRF_PSEL(SPIM_MISO, 0, 28)>,
				<NRF_PSEL(SPIM_MOSI, 0, 31)>;
			low-power-enable;
		};
	};

	spi2_default: spi2_default {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 0, 0)>,
				<NRF_PSEL(SPIM_MISO, 0, 4)>,
				<NRF_PSEL(SPIM_MOSI, 0, 3)>;
			nordic,drive-mode = <NRF_DRIVE_H0H1>;
		};
	};

	spi2_sleep: spi2_sleep {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 0, 0)>,
				<NRF_PSEL(SPIM_MISO, 0, 4)>,
				<NRF_PSEL(SPIM_MOSI, 0, 3)>;
			low-power-enable;
		};
	};
};

  • Hello, 

    Difficult to tell what is going on. Where are you measuring? Are there other components on this custom board? 

    I have it set up so that it is configuring the pmic and then turns off the cell and goes to sleep.

    Could you please elaborate more on these steps? 

    With CONFIG_SERIAL=y, do you have logs from your device as well?

    Thanks.


    Kind regards,
    Øyvind

  • I have the PPK2 in series between the battery and the board

    The main components on this board are the nrf9160, the nmp1300 and an external flash chip (that isn't being written or read to currently, it's the same flash IC as on the nrf9160 dk)

    I am getting logs over serial, since the program doesn't do much right now I just get the starting message for nrf connect and zephyr versions

    *** Booting nRF Connect SDK v2.7.99-547aaab19c52 ***
    *** Using Zephyr OS v3.6.99-8005d4e87b9b ***
    


    Right now the pmic is just doing the configuration that I posted in the pmic_init function.  Once init is complete it is not sending data on the bus

  • Are you able to collect more logs from your device e.g. modem trace and save/export Power Profiler logs? What settings are you using in Power Profiler? How does the PPK2 log look from start to cellular connection?

    How long do these spikes go? From the provided screenshot I see that the window time frame is set to ~43,5ms. The nPM1300 does have some sort of pulsing to the battery in order to check battery state. nPM1300 - Automatic measurements

    Kind regards,
    Øyvind

Related