Hi,
SDK version : NCS 2.1.0
Hardware : nRF52840 DK (External supply)
I am trying to put the nrf52840 to idle mode based on the system_off example.
D:\NCS_2.1.0\v2.1.0\zephyr\samples\boards\nrf\system_off
prj,config setting
CONFIG_PM=y # Required to disable default behavior of deep sleep on timeout CONFIG_PM_DEVICE=y CONFIG_GPIO=y # Optional select RAM retention (nRF52 only) #CONFIG_APP_RETENTION=y CONFIG_THREAD_NAME=y # enable DC.DC CONFIG_BOARD_ENABLE_DCDC=y
I use pm_state_force(0u, &(struct pm_state_info){PM_STATE_STANDBY, 0, 0}); to put system to idle mode and find the idle current is stuck at 500uA .
void main(void) { int rc; const struct device *cons = DEVICE_DT_GET(DT_CHOSEN(zephyr_console)); if (!device_is_ready(cons)) { printk("%s: device not ready.\n", cons->name); return; } printk("\n%s system off demo\n", CONFIG_BOARD); if (IS_ENABLED(CONFIG_APP_RETENTION)) { bool retained_ok = retained_validate(); /* Increment for this boot attempt and update. */ retained.boots += 1; retained_update(); printk("Retained data: %s\n", retained_ok ? "valid" : "INVALID"); printk("Boot count: %u\n", retained.boots); printk("Off count: %u\n", retained.off_count); printk("Active Ticks: %" PRIu64 "\n", retained.uptime_sum); } else { printk("Retained data not supported\n"); } /* Configure to generate PORT event (wakeup) on button 1 press. */ nrf_gpio_cfg_input(NRF_DT_GPIOS_TO_PSEL(DT_ALIAS(sw0), gpios), NRF_GPIO_PIN_PULLUP); nrf_gpio_cfg_sense_set(NRF_DT_GPIOS_TO_PSEL(DT_ALIAS(sw0), gpios), NRF_GPIO_PIN_SENSE_LOW); printk("Busy-wait %u s\n", BUSY_WAIT_S); k_busy_wait(BUSY_WAIT_S * USEC_PER_SEC); printk("Busy-wait %u s with UART off\n", BUSY_WAIT_S); rc = pm_device_action_run(cons, PM_DEVICE_ACTION_SUSPEND); k_busy_wait(BUSY_WAIT_S * USEC_PER_SEC); rc = pm_device_action_run(cons, PM_DEVICE_ACTION_RESUME); printk("Sleep %u s\n", SLEEP_S); k_sleep(K_SECONDS(SLEEP_S)); printk("Sleep %u s with UART off\n", SLEEP_S); rc = pm_device_action_run(cons, PM_DEVICE_ACTION_SUSPEND); k_sleep(K_SECONDS(SLEEP_S)); rc = pm_device_action_run(cons, PM_DEVICE_ACTION_RESUME); printk("Entering system off; press BUTTON1 to restart\n"); if (IS_ENABLED(CONFIG_APP_RETENTION)) { /* Update the retained state */ retained.off_count += 1; retained_update(); } /* Above we disabled entry to deep sleep based on duration of * controlled delay. Here we need to override that, then * force entry to deep sleep on any delay. */ pm_state_force(0u, &(struct pm_state_info){PM_STATE_STANDBY, 0, 0}); /* Now we need to go sleep. This will let the idle thread runs and * the pm subsystem will use the forced state. To confirm that the * forced state is used, lets set the same timeout used previously. */ k_sleep(K_SECONDS(SLEEP_S)); printk("ERROR: System off failed\n"); while (true) { return; } }

As my understanding, once there is no other thread running, system will enter the idle thread.
I also use thread analyzer to make sure there is no any other thread alive.
About the high current condition, do you have any advice on it?