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

NRF9160 Low Power GPIO interrupt

I am currently working on a low power application using the NRF9160 chip.
During power optimalisation I found out that my sleep current can be reduced from around 50uA to as low as 7uA. 
In order to get to these low power values I needed to disable GPIO input interrupts on 4 inputs.

However I need these GPIO interrupts to wake up from deep sleep mode, I came across the following topic:

https://devzone.nordicsemi.com/f/nordic-q-a/50987/nrf9160-gpio-consume-higher-current-when-configure-as-input/204827#204827

In this topic it was recommended to use GPIO_INT_LEVEL interrupts instead of GPIO_INT_EDGE, allowing the usage of the GPIOTE peripheral and reduce power consumption.

I tried this setup and indeed reached way better sleep power consumption:

	Switch->gpiodev = device_get_binding(Switch->gpiocontroller);
	
	gpio_pin_configure(Switch->gpiodev, Switch->pin.index, GPIO_DIR_IN | GPIO_INT |  Switch->pin.flags | GPIO_INT_LEVEL | GPIO_INT_ACTIVE_HIGH );
    if( Switch->callback_handler )
    {
            gpio_init_callback(&Switch->callback, Switch->callback_handler, BIT(Switch->pin.index));
            gpio_add_callback(Switch->gpiodev, &Switch->callback);
            gpio_pin_enable_callback(Switch->gpiodev, Switch->pin.index);
    }

However when my input interrupt is triggered by applying a rising edge to this input, the interrupt keeps firing for as long as the input level remains high.

Is there a solution to get the GPIOTE peripheral to be used to reduce power, but to keep the ability to get only a single interrupt on a rising/falling edge?

Kind regards,

Eric

  • Hi,

    Is there a solution to get the GPIOTE peripheral to be used to reduce power, but to keep the ability to get only a single interrupt on a rising/falling edge?

    As of today, the Zephyr GPIO driver only support edge triggering with GPIOTE channel. Improvements on this has been has been requested.

    But, if you are using these pins to wake-up from System OFF mode, it might be easier to just access the GPIO peripheral directly, configure it with sense, and then go to System OFF sleep.

    Snippet:

    #include <gpio.h>
    #include <hal/nrf_regulators.h>
    #include <hal/nrf_gpio.h>
    #include <hal/nrf_power.h>
    
    
    
    nrf_gpio_cfg_input(WAKEUP_PIN_1,NRF_GPIO_PIN_PULLUP);
    nrf_gpio_cfg_sense_set(WAKEUP_PIN_1,NRF_GPIO_PIN_SENSE_LOW);
    
    lte_lc_power_off();
    bsd_shutdown(); // Method to gracefully shutdown the BSD library.
    nrf_regulators_system_off(NRF_REGULATORS_NS);
    
    

Related