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; }; }; };