I'm reading the SDK15.2 documentation coming from SDK 11. I've noticed the nrf_pwr_mgmt module, but I haven't seen it utilized by any of the examples. When should this module be used? It seems like its not required for Power Optimization, so I'm a bit baffled at to its purpose.
Hi Jeff.The nrf_pwr_mgmt module is utilized by most examples with the call nrf_pwr_mgmt_run();In the main-loop in most examples the function idle_state_handle(); is called, and inside this function the nrf_pwr_mgmt_run(); function is called.It's used to make the CPU enter sleep mode and remain in sleep mode until an event occurs. This is done by a _WFE() instruction either in nrf_pwr_mgmt_run() or in sd_app_evt_wait().- Andreas
I didn't see this in the example I was looking at. What about in the freeRTOS examples, i didn't see any called to nrf_pwr_mgmt in these examples, nor in the nrf_sdh_freertos.c? Do these needs calls for nrf_pwr_mgmt is power optimize?
Also curious about why nrf_pwr_mgmt was created in addition to sd_app_evt_wait(). Its just a little confusing.
Whether or not nrf_pwr_mgmt or sd_app_evt_wait(); is used depends on how effective each method is. You don't need nrf_pwr_mgmt for the FreeRTOS examples.
In the FreeRTOS examples _WFE(); is used, because sd_app_error_wait(); increases power consumption with freeRTOS compared to _WFE();
I'm looking at ble_peripheral > ble_app_hrs_freertos as well as peripheral > blinky_freertos in SDK 15.2.0 Examples, but I can't seem to find the _WFE() usage.
Do you mind sharing a link to a FreeRTOS example where it is using _WFE()? Thanks
Please take a look in port_cmsis_systick.c and the function vPortSuppressTicksAndSleep().
You should use the configUSE_TICKLESS_IDLE 1 mode in FreeRTOSConfig.h to make the app sleep in idle.