This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Achieving 3.16µA System ON Sleep in Zephyr

Device

nRF52840dk PCA10056

nRF6707 power profiler

What I Want to Do

I'm trying to achieve ION_RAMON_RTC current consumption of 3.16µA via Zephyr but I have not been able to get below 3.8µA avg consumption. I've followed the Optimizing Power on nRF52 Designs guide to a tee but am still not having luck. What am I missing? I'm observing with my power profiler a periodic spike in current consumption which might be a clue.

KCONFIGS

# DEBUG CONFIGS
CONFIG_ASSERT=n
# Memory/etc configs
CONFIG_DEBUG=n
CONFIG_DEBUG_OPTIMIZATIONS=n

##### PRINTING | LOGGING #####
# Print configs
CONFIG_PRINTK=n
CONFIG_USE_SEGGER_RTT=n
CONFIG_RTT_CONSOLE=n
CONFIG_UART_CONSOLE=y
# Logging
CONFIG_LOG=n
CONFIG_LOG_MAX_LEVEL=4
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BUFFER_SIZE=1024
CONFIG_LOG_STRDUP_BUF_COUNT=128

# Clock Configs
CONFIG_CLOCK_CONTROL=y
CONFIG_CLOCK_CONTROL_NRF=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y
CONFIG_NRF_RTC_TIMER=y

# Power
CONFIG_SYS_POWER_MANAGEMENT=y
CONFIG_DEVICE_POWER_MANAGEMENT=y
CONFIG_DEVICE_IDLE_PM=y
CONFIG_BOARD_ENABLE_DCDC=y
Main.c
#include <zephyr.h>

#include <hal/nrf_saadc.h>
#include <hal/nrf_comp.h>
#include <hal/nrf_lpcomp.h>
#include <hal/nrf_timer.h>
#include <hal/nrf_uart.h>
#include <hal/nrf_uarte.h>
#include <hal/nrf_power.h>
#include <hal/nrf_rtc.h>

void set_regulator_ldo(void)
{
    nrf_power_dcdcen_set(NRF_POWER, 0);
}

void set_lfrc(void)
{
    NRF_CLOCK->LFCLKSRC = 0;
    NRF_CLOCK->TASKS_LFCLKSTART = 1;
}

void idle_all_peripherals(void)
{
    nrf_saadc_disable(NRF_SAADC);
    nrf_comp_disable(NRF_COMP);
    nrf_lpcomp_disable(NRF_LPCOMP);
    
    nrf_timer_task_trigger(NRF_TIMER0, NRF_TIMER_TASK_STOP);
    nrf_timer_task_trigger(NRF_TIMER1, NRF_TIMER_TASK_STOP);
    nrf_timer_task_trigger(NRF_TIMER2, NRF_TIMER_TASK_STOP);
    nrf_timer_task_trigger(NRF_TIMER3, NRF_TIMER_TASK_STOP);
    nrf_timer_task_trigger(NRF_TIMER4, NRF_TIMER_TASK_STOP);
    
    nrf_rtc_task_trigger(NRF_RTC0, NRF_RTC_TASK_STOP);
    nrf_rtc_task_trigger(NRF_RTC2, NRF_RTC_TASK_STOP);
    
    nrf_uart_disable(NRF_UART0);
    nrf_uarte_disable(NRF_UARTE0);
    nrf_uarte_disable(NRF_UARTE1);
}

void stop_clock(void)
{
    NRF_CLOCK->TASKS_LFCLKSTOP = 1;
    NRF_CLOCK->TASKS_HFCLKSTOP = 1;
}



int main(void)
{
    set_regulator_ldo();
    set_lfrc();
    
    idle_all_peripherals();
    stop_clock();

    k_sleep(K_FOREVER);    
    return 0;
}
Power Profiler Output
Parents Reply Children
No Data
Related