I’m working on an nRF52-based design where the device should remain in System ON low-power mode after an operation (SAADC sampling + BLE sync). After SAADC data collection and BLE data transfer complete, I enter an idle state using nrf_pwr_mgmt_run(). However , we have encountered a strange problem. The system is not going to sleep despite calling nrf_pwr_mgmt_run(). I have tried toggling a pin inside the nrf_pwr_mgmt_run(). The gpio doesnt toggle. Is there a way to check whether the cpu goes to system on sleep mode or not?
Before calling nrf_pwr_mgmt_run, i toggle a pin, the pin gets toggled, i have checked this in logic analyser. However i amd not able to check whetehr the cpu is going to system on sleep or not.
This is the code snippet from inside the nrf_pwr_mgmt_run()
void nrf_pwr_mgmt_run(void)
{
NRF_GPIO_Type * reg = NRF_P0;
uint32_t pins_state = reg->OUT;
reg->OUTSET = (~pins_state & (1UL << 12));
reg->OUTCLR = (pins_state & (1UL << 12));
PWR_MGMT_FPU_SLEEP_PREPARE();
PWR_MGMT_SLEEP_LOCK_ACQUIRE();
PWR_MGMT_CPU_USAGE_MONITOR_SECTION_ENTER();
PWR_MGMT_DEBUG_PIN_SET();
// Wait for an event.
#ifdef SOFTDEVICE_PRESENT
if (nrf_sdh_is_enabled())
{
reg->OUTSET = (~pins_state & (1UL << 12));
reg->OUTCLR = (pins_state & (1UL << 12));
ret_code_t ret_code = sd_app_evt_wait(); //sd_power_system_off();
ASSERT((ret_code == NRF_SUCCESS) || (ret_code == NRF_ERROR_SOFTDEVICE_NOT_ENABLED));
UNUSED_VARIABLE(ret_code);
}
else
#endif // SOFTDEVICE_PRESENT
{
// Wait for an event.
__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();
}
Can you please add another mail id- [email protected] ?