High current consumption in system off mode

Hello all,
My nrf52820 board consuming high current in system off mode(56 uA) than mentioned in the datasheet(0.3 uA), for simple gpio code.

Can anyone help me solve this issue.

Thank you.

code:

#include <stdio.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/pm/device.h>
#include <zephyr/sys/poweroff.h>

#define SLEEP_TIME_MS   2000

#define LED0_NODE DT_ALIAS(led0)
#define BUTTON DT_ALIAS(sw0)

static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET(BUTTON, gpios);

int main(void)
{
  int ret;

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

  ret = gpio_pin_configure_dt(&button, GPIO_INPUT);
  if (ret < 0) {
    return 0;
  }

  ret = gpio_pin_interrupt_configure_dt(&button, GPIO_INT_EDGE_TO_ACTIVE);
  if (ret < 0) {
    return 0;
  }

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

  k_msleep(SLEEP_TIME_MS);

  gpio_pin_configure_dt(&led, GPIO_DISCONNECTED);

  sys_poweroff();

  return 0;
}

proj.config:
CONFIG_GPIO=y

CONFIG_PM_DEVICE=y
CONFIG_POWEROFF=y
Parents Reply Children
Related