nRF 低功耗相关

无协议栈的例程或涉及失能协议栈的例程LOG的相关操作会影响功耗(占用资源)

 

低功耗电源管理函数 nrf_pwr_mgmt_run 中:

使能协议栈时执行:

PWR_MGMT_FPU_SLEEP_PREPARE();
PWR_MGMT_SLEEP_LOCK_ACQUIRE();
PWR_MGMT_CPU_USAGE_MONITOR_SECTION_ENTER();
PWR_MGMT_DEBUG_PIN_SET();

ret_code_t ret_code = sd_app_evt_wait();
ASSERT((ret_code == NRF_SUCCESS) || (ret_code == NRF_ERROR_SOFTDEVICE_NOT_ENABLED));

UNUSED_VARIABLE(ret_code);

PWR_MGMT_DEBUG_PIN_CLEAR();
PWR_MGMT_CPU_USAGE_MONITOR_SECTION_EXIT();
PWR_MGMT_SLEEP_LOCK_RELEASE();

 

失能协议栈时执行:

PWR_MGMT_FPU_SLEEP_PREPARE();
PWR_MGMT_SLEEP_LOCK_ACQUIRE();
PWR_MGMT_CPU_USAGE_MONITOR_SECTION_ENTER();
PWR_MGMT_DEBUG_PIN_SET();

__WFE();

// Clear the internal event register.
__SEV();
__WFE();

PWR_MGMT_DEBUG_PIN_CLEAR();
PWR_MGMT_CPU_USAGE_MONITOR_SECTION_EXIT();
PWR_MGMT_SLEEP_LOCK_RELEASE();

 

注意:2.4G通讯时,

__SEV();

__WFE();

后两行操作影响数据通讯实时性,故只用__WFE();

 

参考骰子项目的发送端,多协议gzll的程序

 

你可能感兴趣的:(nRF 低功耗相关)