This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

reducing current consumption of nrf5340 GPIO interrupts configured for edge triggering

I have a few GPIOs configured as interrupt pins.. most are edge triggered GPIO_INT_EDGE_FALLING or GPIO_INT_EDGE_RISING (won't work otherwise so, i cant go for level triggered at this time)..Only button is GPIO_INT_LEVEL_INACTIVE..  Looks like in 1.9.1 we need to add an entry in overlay to take care of masking for sense-edge and i did..

&gpio0 {
status = "okay";
sense-edge-mask = < 0xffffffff >;
};

&gpio1 {
status = "okay";
sense-edge-mask = < 0xffffffff >;
};

Will making interrupts edge triggered add lot 10s of extra uA like it is mentioned in some older tickets ? is there a way around that I am missing ?

Older tickets talked about using CONFIG_GPIO_NRF_INT_EDGE_USING_SENSE but as we all know that macro doesn't seem to exist anymore.. some ticket mentioned setting hi_accuracy parameter to false for gpio config.. some ticket mentioned setting low latency to 0  (haven't found a zephyr api to do that yet( but I am using the interrupt set up as follows and can't find any other  way

Is there a way to use edge triggered interrupts and not take up too much power at all ?  I have searched as much as I could but couldn't get anywhere.. I have 5 gpios configured and hence any current saved will be awesome.

  • I tried this.. I was expecting double digit uA reduction per GPIO interrupt and given I have 5 such interrupts configured, was hoping to see significant change.. i saw probably 10s of uA change with this edit.. is that ot be expected ? I couldn't find exact power numbers in the data sheet

  • Hi,

    How much current consumption are you actually seeing, and what is the exact difference in current consumption between using sense and not? I cannot say whether the difference is to be expected or not without knowing what it actually is.

    Are you using other things with high current consumption? Please try disabling logging/serial.

    You can also see typical numbers for current consumption here: nRF5340 current consumption.

    Best regards,

    Marte

  • i have seen that datasheet.. it is honestly not clear as to what should be expected when I have bunch of GPIOs configured for interrupt.. 

    In any case, at least two of my peripheral interrupts create havoc if I have both edges configured.. and hence i wont be able to go with your solution .. will just have to live with the power consumption.

    I had another ticket about all things power but i was told to file separate tickets for each issue going forward.. 

    Thank you for your help.. you can close this ticket since there doesn't seem to be a real way to do what I wanted to do

  • If you use GPIO_INT_TRIG_BOTH | GPIO_INT_ENABLE. It will fail an assertion Only one of GPIO_INT_LOW_0, GPIO_INT_HIGH_1 can be enabled for a level interrupt

  • I'm getting the same assertion failure when assert is enabled. Is there a solution for this? 

    CONFIG_ASSERT=y

    gpio_pin_interrupt_configure_dt(&m_config.gpioDtSpec, GPIO_INT_ENABLE | GPIO_INT_TRIG_BOTH)

    ASSERTION FAIL [((flags & (1U << 22)) == 0) || ((flags & (1U << 24)) != 0) || ((flags & ((1U << 25) | (1U << 26))) != ((1U << 25) | (1U << 26)))] @ WEST_TOPDIR/zephyr/include/zephyr/drivers/gpio.h:881
    Only one of GPIO_INT_LOW_0, GPIO_INT_HIGH_1 can be enabled for a level interrupt.

Related