Hello,
In NRF54L15, Is it possible to wake up the Device from deep sleep through EDGE triggered GPIO interrupt pin?
Hello,
In NRF54L15, Is it possible to wake up the Device from deep sleep through EDGE triggered GPIO interrupt pin?
Hello,
Yes, wakeup from System OFF (deep sleep) can be triggered by a GPIO input as demonstrated by the zephyr sample here: https://github.com/nrfconnect/sdk-zephyr/tree/main/samples/boards/nordic/system_off
Best regards,
Vidar
Hello,
Yes, I tried to wake up through the pin using LEVEL triggerd (GPIO_INT_LEVEL_ACTIVE) as given in this example, and it was working fine, but when I tried EDGE triggered Interrupt (GPIO_INT_EDGE_RISING and GPIO_INT_EDGE_TO_ACTIVE), the device could not wake up from sleep.
If you want to use the GPIO_INT_EDGE_* flags you need to use the sense-edge-mask property in your gpio devictree node so that the driver will also enable GPIO sense mechanism for this configuration and not just for the level triggering. However, there’s no reason to do this if the goal is only to configure a wakeup pin.
It's probably worth pointing out that `GPIO_INT_LEVEL_ACTIVE` appears to be not level-triggered but edge-triggered.
To demonstrate this, add `k_msleep(5000)` right before the call to `sys_poweroff()` in the sample app mentioned.
Then press the button during those five seconds and hold it down.
If it was a true level trigger, the active button would immediately restart the app after powering off. But this is not what happens. The app stays off until you release the button and press it again.
(tested with NCS 2.9.2, nrf54l15-dk board)
In other words, there is a period of time between `gpio_pin_interrupt_configure_dt()` and `sys_poweroff()` where the interrupt edge is lost. I ran into this when trying to wake with an accelerometer interrupt. If it fired too soon: no wakie for me. The workaround I found was to install an interrupt handler for that pin, that did a NVIC_SystemReset(). This requires attention to any code that looks at RESETREAS.
It's probably worth pointing out that `GPIO_INT_LEVEL_ACTIVE` appears to be not level-triggered but edge-triggered.
To demonstrate this, add `k_msleep(5000)` right before the call to `sys_poweroff()` in the sample app mentioned.
Then press the button during those five seconds and hold it down.
If it was a true level trigger, the active button would immediately restart the app after powering off. But this is not what happens. The app stays off until you release the button and press it again.
(tested with NCS 2.9.2, nrf54l15-dk board)
In other words, there is a period of time between `gpio_pin_interrupt_configure_dt()` and `sys_poweroff()` where the interrupt edge is lost. I ran into this when trying to wake with an accelerometer interrupt. If it fired too soon: no wakie for me. The workaround I found was to install an interrupt handler for that pin, that did a NVIC_SystemReset(). This requires attention to any code that looks at RESETREAS.
Thanks for the comment. I think what is happening is that GPIOTE IRQ handler is invoked between your call to gpio_pin_interrupt_configure_dt() and sys_poweroff() and inverts the sense level as gpio_pin_interrupt_configure_dt() is enabling the GPIOTE PORT interrupt.
To confirm this, you may try the following:
1. Right before gpio_pin_interrupt_configure_dt(), call irq_lock() to mask the GPIOTE IRQ and any other application level interrupts.
2. Replace k_msleep(5000) with a busy wait as we can't do any context switches with the interrupts masked.
3. Keep the button pressed and check if it wakes up immediately again after entering system again confirming it's level triggered.