We are using nRF52833 with Softdevice S113 for BLE.
in the OS_Idle function, nrf_pwr_mgmt_run is called.
But never comes out of sleep.
Is there a need to call nrf_drv_power_sleepevt_init?
Are examples available?
thanks
Geert Venken
We are using nRF52833 with Softdevice S113 for BLE.
in the OS_Idle function, nrf_pwr_mgmt_run is called.
But never comes out of sleep.
Is there a need to call nrf_drv_power_sleepevt_init?
Are examples available?
thanks
Geert Venken
Hi,
Are you using embOS and do you know if interrupts are disabled when this function is called?
Thanks,
Vidar
EDIT: Please enable SEVONPEND to see if it helps. You can do this by adding this line at the beginning of main():
SCB->SCR |= SCB_SCR_SEVONPEND_Msk;
Hi Vidar,
We are using embOS and interrupts are enabled.:
This is the Idle funciton:
void OS_Idle(void) { // Idle loop: No task is ready to execute
#if USE_TICKLESS_IDLE == 1
if (low_power_enabled) {
OS_INT_IncDI();
OS_TIME idleTicks = OS_TICKLESS_GetNumIdleTicks();
if (idleTicks > RTC_WAKEUP_MIN_TIME) {
if (idleTicks > RTC_WAKEUP_MAX_TIME) {
idleTicks = RTC_WAKEUP_MAX_TIME;
}
if (idleTicks > 1000) { // more than 1 second
rtc_suspend_interrupt();
}
rtc_set_wakeup(idleTicks, &WakeupCallback);
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
SysTick_CTRL_ENABLE_Msk; /* Disable SysTick IRQ */
OS_TICKLESS_Start(idleTicks, &EndTicklessMode);
}
OS_INT_DecRI();
}
#endif
#if USE_LOAD_MEASUREMENT == 1
while (1) { // Nothing to do ... increment counter for load measurement
OS_INC_IDLE_CNT();
}
#else
while (1) { // Nothing to do ... wait for interrupt
if (low_power_enabled) {
nrf_pwr_mgmt_run();
}
}
#endif
}
Interrupts are disabled around the RTC calculations and function but not around the nrf_pwr_mgmt_run function.
What I noticed when the WFE is called (in the debugger)
:
Must these be set to 1?
thanks,
Geert
Geert,
EDIT: Please enable SEVONPEND to see if it helps. You can do this by adding this line at the beginning of main():
This will be needed to wakeup on pending RTC IRQ ( if interrupt is disabled for this IRQ).
Best regards,
Vidar
Vidar,
This line was already in the function OS_InitHW, added it additionally ot main, but no success.
Hm, does it work if you replace the SD function with a __WFE() or __WFI()?
Hm, does it work if you replace the SD function with a __WFE() or __WFI()?
SD function?
Do you mean, if I replace WFE by WFI or visa versa in nrf_pwr_mgmt_run?
This does not make a difference, same behavior.
Sorry for the misunderstanding.
Now I got your point. In nrf_pwr_mgmt_run I removed all related to softdevice and always call __WFI.
No success. Same behavior.
I also enabled PWR_MGMT_DEBUG_PIN_SET and routed this to a LED. Goes on but never off.
Watchdog resets the system.
It's my bad, I should have referenced the full function name without any abbreviation. Anyway, thanks for confirming that you see the same behavior with __WFI(). This suggests that the issue isn’t with the sleep function (__WFI() or nrf_pwr_mgmt_run()) but rather that the RTC isn’t triggering the wake-up interrupt as expected.