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

GPIOTE_IRQHandler does not execute

Hi all,

I have some problems with GPIO Interrupts.

I'm using nrf52832, s132 and sdk 12.2

The error is totally random so I don't know why is generated. The case is I have 3 pins that I configure with app_button_init and 2 pins that I configure directly with gpiote driver.

The sequence is this:

  • All interrupts work fine
  • normal execution of interruptions for each pin
  • the interruption of pin1 works fine until the error occurs. When the error occurs, pin1 = 0 (pin1 is configured with gpiote driver), and this should activate the interruption for this pin, but the interruption does not execute, at this point GPIO interruptions does not work (GPIOTE_IRQHandler does not execute) except when the same pin1 is set to '1', that seems that restablish the interruptions and the next time the pin1 = 0, the interruption of this pin and all the rest activates well.
  • during the GPIO interruption doesn't work, bluetooth, timers and the rest of the execution of the code works fine.

Do you have any idea why this can happen? Is it possible that it has something to do with activating two interrupts at the same time?

Thanks in advance,

Aida

  • I've tried setting .hi_accuracy = true to all pins and the error has not reappeared but the consumption is higher. I search information about why hi_accuracy solves the problem and I find a question with the same situation as me: devzone.nordicsemi.com/.../. The solution that is given here in order to have low consumption and avoid this error is to config all pins with GPIOTE_CONFIG_IN_SENSE_TOGGLE. At the moment, this solve my problem.

  • The "low accuracy" in the GPIOTE driver refers to using the PORT event instead of the IN event. The PORT event is generated for all GPIOs which is configured with the DETECT signal, which means that several pins can potentially generate the same event. So the driver then checks which pin triggered the signal afterwards. This will take a few CPU cycles and any changes on other pins will not be detected until it is finished.

    The DETECT signal will trigger on either high level or low level but not on rising/falling edge. So if it is configured to trigger on high level, and the signal goes high, the DETECT signal will continue to generate a PORT event until the line goes low again. In practice this means that you can not trigger on two GPIOs simultaneously. Like two button presses at the same time.

    Using low accuracy mode is reliable if the frequency is not very high, like user input, and the user presses one button at a time.

Related