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

Enter in SYSTEM ON doest not work

Hello everyone,

I'm using the nrf52840 Dev Kit (PCA10056 1.1.0 2019.19 683465548)

SDK version: 15.3

OS: Fedora

I work on a custom board and try to put it in SYSTEM ON mode like so:

int main(void)
{
    log_init();
    NRF_LOG_INFO("App start\n");
    NRF_LOG_FLUSH();

    power_management_init();
    for (;;) {
        nrf_pwr_mgmt_run();
    }
}

When I measure my consommation with OTII I get 4 mA instead of 1.5 uA according to this link (Debugging: Section 4).

Any ideas?

Regards,

Louis

Parents
  • Hi Louis

    As stated in the link you provided, this means the CPU is still running for some reason. Seeing as you're using a logger, I assume your application doesn't handle pending log operations before it goes to sleep, which causes the CPU to keep running.

    Could you try adding the idle_state_handle(); in your for loop instead of the nrf_pwr_mgmt_run(); as idle_state_handle(); handles pending log operations, then sleeps until the next event occurs.

    /**@brief Function for handling the idle state (main loop).
     *
     * @details Handle any pending log operation(s), then sleep until the next event occurs.
     */
    static void idle_state_handle(void)
    {
        if (NRF_LOG_PROCESS() == false)
        {
            nrf_pwr_mgmt_run();
        }
    }

    Due to the summer holidays in Norway, our support team is understaffed this week, and delayed replies must be expected. Sorry for the inconvenience!

    Best regards,

    Simon

Reply
  • Hi Louis

    As stated in the link you provided, this means the CPU is still running for some reason. Seeing as you're using a logger, I assume your application doesn't handle pending log operations before it goes to sleep, which causes the CPU to keep running.

    Could you try adding the idle_state_handle(); in your for loop instead of the nrf_pwr_mgmt_run(); as idle_state_handle(); handles pending log operations, then sleeps until the next event occurs.

    /**@brief Function for handling the idle state (main loop).
     *
     * @details Handle any pending log operation(s), then sleep until the next event occurs.
     */
    static void idle_state_handle(void)
    {
        if (NRF_LOG_PROCESS() == false)
        {
            nrf_pwr_mgmt_run();
        }
    }

    Due to the summer holidays in Norway, our support team is understaffed this week, and delayed replies must be expected. Sorry for the inconvenience!

    Best regards,

    Simon

Children
  • Hi Simonr

    I tried with idle_state_handle function and now I have 2.6 mA instead of 1.5 uA.

    I compiled and run the pwr_mgmt example with no modification except commenting some lines like so:

    int main(void)
    {
        // APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
        // NRF_LOG_DEFAULT_BACKENDS_INIT();
    
        // NRF_LOG_INFO("Power Management example");
    
        lfclk_config();
    
        uint32_t err_code = app_timer_init();
        APP_ERROR_CHECK(err_code);
    
    // #if NRF_PWR_MGMT_CONFIG_USE_SCHEDULER
    //     APP_SCHED_INIT(APP_SCHED_MAX_EVENT_SIZE, APP_SCHED_QUEUE_SIZE);
    // #endif // NRF_PWR_MGMT_CONFIG_USE_SCHEDULER
        // bsp_configuration();
    
        ret_code_t ret_code = nrf_pwr_mgmt_init();
        APP_ERROR_CHECK(ret_code);
    
        while (true)
        {
    // #if NRF_PWR_MGMT_CONFIG_USE_SCHEDULER
    //         app_sched_execute();
    // #endif // NRF_PWR_MGMT_CONFIG_USE_SCHEDULER
    
            if (NRF_LOG_PROCESS() == false)
            {
                nrf_pwr_mgmt_run();
            }
        }
    }

    and my consommation is 4 mA..

    I don't know how to get 1.5 uA.

    Any ideas?

  • If I unplug my JLink from my custom board I get 2.6 mA on pwr_mgmt example too.

Related