Device doesn't wake up from low power mode on Zephyr timer events

Our board is based on nRF52833, using SDK 2.1.2, Zephyr 3.1.99

Project is configured to enter low power mode for both CPU and peripherals

CONFIG_PM=y
CONFIG_PM_DEVICE=y

Our Zephyr application contains a timer that fires up every 5 min and performs certain activity (including advertising BLE)
I'd expect that timer event (interrupt) would wake device up from low power mode 
Unfortunately sometimes it doesn't.
Occasionally we discover devices that are "frozen" and stay in low power mode until GPIO interrupt, which ALWAYS causes device to wake up.
The problem is that I can't rely on this GPIO interrupt to happen periodically enough, timer is my last line of defense.
When I set breakpoint int he debugger, after waking up, I'm always at next instruction after WFI (low power mode Wait for interrupt)

I'm wondering if timer interrupt is not configured properly in the device tree somewhere...




  • Hi,

    I see. Do you have the hardware watchdog enabled? If not, it would be intreresting to see if using the watchdog would help, so that the device would reset in case it is in this bad state. One reason is that it could be a potential fail-safe/workaround if the issue is not fixed, but also as the watchdog is based on the LFCLK, and if the watchdog functions, that means that the LFCLK is also running. Given that this issue is difficult to reproduce I am not sure how easy it is to test, though?

    Focusing on the firmware side of things, could there be a bug in your fimrware that could create a situation were there are no threads that have any work to do at any time in the future withotu a GPIO interrupt? So that other than the idle task which enters WFE there is no work to be done before a GPIO interrupt happens?

  • Hi Einar,
    Thank you, HW watchdog is a great idea, I was thinking I need to implement it regardless of this problem.
    There is a bit of concern that If max WD timer is not long enough - and therefore needs to be pet frequently - it could have impact on my battery life, but I suspect it would be tolerable.
    Could you please point me to concise example of WDT implementation ?
    The only example I found in SDK 2.1.2 is MemFault demo, and its very memfault-specific
    Thank you,
    Alex

  • Hi Alex,

    I suggest you refer to the watchdog driver sample under zephyr/samples/drivers/watchdog/ (this link is for SDK v2.9, but the sample exist in 2.1.2).

Related