This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

System Off and GPIOTE

I have multiple GPIOs that are configured to use GPIOTE in my application. When one of these GPIOs is in the active state I start timer. Once the timer expires I want to enter system off using sd_power_system_off() and I want the GPIO that started the timer to wakeup the system.

Do I need to disable the GPIOTE events for this pin before calling nrf_gpio_cfg_sense_set()?

What about peripherals and interrupts? Do peripherals need to be stopped and interrupts disabled before calling sd_power_system_off()?

Thanks, Darren

  • Hi,

    You should not need to disable the GPIOTE events for that pin. The only peripherals that are partially kept active in SYSTEM OFF are GPIO, LPCOMP and NFC. Remember that the nrf_gpio_cfg_sense_set()function only sets the SENSE field of the pin so the other fields (direction, pull etc) will be the same. nrf_gpio_cfg_sense_input() will set all fields.

    Other peripherals are not functional in SYSTEM OFF and are reset when the device wakes up after SYSTEM OFF, see here. So there is no need to stop the peripherals and disable interrupts before going to SYSTEM OFF.

    Ole

  • Ole,

    Thank you for the reply it helps!

    I have some follow up questions.

    My custom board has several GPIOs configured to use GPIOTE as I stated above. Out of all of these GPIOs I only want 1 to wake the processor up from System Off. Am I correct in thinking that I need to disable all of the GPIOTE events except for the 1 pin I want?

    Also I am a little confused between the using GPIOTE and nrf_gpio_cfg_sense_input() as which is the best to wake the processor up from System Off at the same allows the lowest power operation.

    Cheers, Darren

  • GPIOTE will not wake the processor up from SYSTEM OFF, the sense mechanism in the GPIO peripheral will. If you enable the sense mechanism, a DETECT signal will be generated if the correct sense is detected on one of the pins. As the specification says this can be used to:

    • POWER: uses the DETECT signal to exit from System OFF.
    • GPIOTE: uses the DETECT signal to generate the PORT event.

    Before you enter SYSTEM OFF you need to disable the sense mechanism for the pins that are not going to wake up the chip and enable it on the one that are going to wake up the chip.

    Also, if you use GPIOTE in port event mode (low power mode or hi_accuracy = false):

    GPIOTE_CONFIG_IN_SENSE_...(false);
    

    The sense mechanism will be set for that pin.

Related