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

GPIOTE pending IRQ

Hi,

I'm running an app with softdevice v2.0.0 with SDK 11 on an nrf52832.

the app is using gpiote to handle incoming interrupt from another device.

to start handling the interrupt I run the following:

if (!nrf_drv_gpiote_is_init())
{
	APP_ERROR_CHECK(nrf_drv_gpiote_init());
}
nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_LOTOHI(false);
nrf_drv_gpiote_in_init(ADXL362_INT2_PIN_OFFSET, &config, handler);
nrf_drv_gpiote_in_event_enable(ADXL362_INT2_PIN_OFFSET, true);

and when I want to stop handling the interrupt I run the following:

if (nrf_drv_gpiote_is_init())
{
	nrf_drv_gpiote_in_event_disable(INT2_PIN_OFFSET);
	nrf_drv_gpiote_in_uninit(INT2_PIN_OFFSET);
	nrf_drv_gpiote_uninit();
}

in the main loop I check for pending IRQs using sd_nvic_GetPendingIRQ and I see sometimes that the GPIOTE_IRQ is pending.
to my understanding, disabling the gpiote_in_event on a given pin should clear the interrupt and thus if I always disable first before gpiote uninit I shouldn't get a pending GPIOTE_IRQ.
Am I missing something?
can someone help me understand how could this happen?

Thanks.

Related