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

Creative ways to generate external pin change interrupts, maximum pin interrupts we can have from nRF51

GPIOTE gives us 4. LPCOMP gives us 1.

What else?

I am working on something related with external interrupts. Doesn't have problem in my project, but I just always see people have creative ways to get more pin change interrupts.

  • You can get pin wakeup on any number of pins, using the PORT event and the SENSE field in PIN_CNF. This is the low-power way to get pin wakeup, since using GPIOTE channels or the LPCOMP will cause additional current consumption.

    The way this works is that a change on any pin to the level defined as its SENSE leve in PIN_CNF will cause a wakeup from system off. If you want an interrupt while in system on, you can enable the PORT event in GPIOTE. Be aware that this method doesn't tell you exactly which pin woke you up, so this is something you'll have to check in code as soon as you wake up. If there is only a very short pulse, you may not be able to check which pin woke you up fast enough, and for such use cases, you'll have to use a GPIOTE channel.

    You can refer to this question for a further discussion on this.

Related