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

GPIOTE PORT (Low-accuracy) interrupt detection with multiple pins

Hello,

I know there are dozens of threads on this topic already but they don't seem to quite answer all my questions.

Some background:

SDK: 15.2

SoftDevice: s140_nrf52_6.1.0

Facts about GPIOTE that I am aware of (Please correct me if I am wrong):

  • There are 8 GPIOTE pin event channels on the nRF52840 (High-accuracy)
  • The HF Clock is running if any pin is configured as a pin event (High-accuracy)
  • If multiple pins are configured as low-accuracy (port event), events from other pins are ignored so long as an event is active on a given pin due to all pins having a shared DETECT signal (They are OR'd together in hardware). For example, Signal A is set to interrupt on HITOLO. Signal B is set to interrupt on HITOLO. If signal A is driven low, generates an event, and remains low, an interrupt event will never be received if signal B is then also driven low.

I have seen some other threads mention that if you set all PORT event pins to TOGGLE, that you can then receive interrupts from other pins even if one of them remains in the active state.

Source: https://devzone.nordicsemi.com/f/nordic-q-a/47740/what-is-the-difference-between-high-accuracy-and-signal-mode-in-gpiote/189361#189361

I have tested this myself by setting two pins as TOGGLE and I am able to receive interrupts from both regardless of what state the pin is in.

Question 1: Is setting all PORT (low-accuracy) pins to TOGGLE a good solution?

Question 2. If all PORT pins are set to TOGGLE, is it possible to miss an interrupt from one of the pins if both pins are asserted at the same time?

Question 3: I noticed that newer SDK's have additional logic to handle pins configured as PORT interrupts (port_event_handle() in nrfx_gpiote.c, SDK 17.1). Is there any added benefit to upgrading to this SDK that will mitigate or resolve any potential issues with receiving multiple interrupts at the same time on pins configured for low-accuracy (PORT event)?

Source: https://devzone.nordicsemi.com/f/nordic-q-a/78504/correct-way-to-handle-gpiote-port-event/325905#325905

Thanks,

Derek

Parents
  • Hi again Derek

    Yes, the callbacks should be called for each pin, but you should still do some testing on your end to make sure your application does what you want it to do in corner cases you can think of as well.

    I'd recommend checking out how our example projects/drivers handle this. For example the pin_change and GPIOTE examples as well as the GPIOTE library.

    Best regards,

    Simon

Reply
  • Hi again Derek

    Yes, the callbacks should be called for each pin, but you should still do some testing on your end to make sure your application does what you want it to do in corner cases you can think of as well.

    I'd recommend checking out how our example projects/drivers handle this. For example the pin_change and GPIOTE examples as well as the GPIOTE library.

    Best regards,

    Simon

Children
No Data
Related