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

Right method for power mgmt of nRF52832 with s112 enabled

Hi,

I am using nRF52832 with s112 BLE stack and SDK v16.0. I am wondering what is the most proper way for the "idle_state_handle()" method in the main loop.

Currently I am not including "nrf_pwr_mgmt.h" and only use the following lines:

// handle sched/logs
static void idle_state_handle(void) {
  app_sched_execute();
  if (NRF_LOG_PROCESS() == false) { sd_app_evt_wait(); }
}

However, the ble_peripheriral/ble_app_template sample uses "nrf_pwer_mgmt_run()" like below:

static void idle_state_handle(void)
{
    if (NRF_LOG_PROCESS() == false)
    {
        nrf_pwr_mgmt_run();
    }
}

May I know which method is more energy efficient?

regards,

Parents
  • Hi,

    if you look at nrf_pwr_mgmt sources, you can see that, apart from conditionally-compiled tasks, it check whether softdevice is active and calls the same sd_app_evt_wait(). If your project is based on SDK components, I would prefer to use nrf_pwr_mgmt_run(), because it controls FPU sleep in right way, and you can enable CPU usage monitor if needed. If these options are not used, that code is thrown away - an overhead is negligible.

Reply
  • Hi,

    if you look at nrf_pwr_mgmt sources, you can see that, apart from conditionally-compiled tasks, it check whether softdevice is active and calls the same sd_app_evt_wait(). If your project is based on SDK components, I would prefer to use nrf_pwr_mgmt_run(), because it controls FPU sleep in right way, and you can enable CPU usage monitor if needed. If these options are not used, that code is thrown away - an overhead is negligible.

Children
Related