Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

GPIOTE missing event.

Hello,

I have problem with missing GPIOTE event. Sometimes event doesn't occur, sometimes there is no problem. This event is very rare but important. I think it happens during radio activity. Have I missed something?

Device: nRF5282
SDK: 13.0.0.

gpiote_in_cfg.sense 		= NRF_GPIOTE_POLARITY_TOGGLE;
gpiote_in_cfg.pull			= NRF_GPIO_PIN_PULLUP;
gpiote_in_cfg.is_watcher	= false;
gpiote_in_cfg.hi_accuracy	= false;

err_code = nrf_drv_gpiote_in_init(PIN, &gpiote_in_cfg, PIN_on_pin_toggle_evt_handler);

if (err_code == NRF_SUCCESS)
{
	nrf_drv_gpiote_in_event_enable(PIN, true);
}

Parents
  • Hey Reynard,

    You will need to use the LATCH register. 

    Without the 'high' accuracy setting, the GPIOTE will trigger a single interrupt regardless of which pin triggered its sense interrupt. This singular GPIOTE interrupt will set the interrupt pending register and the CPU will eventually jump to the GPIOTE interrupt handler. Inside this handler the status of each registered GPIOTE pin is read and checked against its sense setting, hi-lo, lo-hi, or toggle. A problem arises when the a triggered GPIOTE pin changes to its previous state before the GPIOTE interrupt handler can read it. This is not very common, but it can happen. 
    The way to work around this problem is to read the LATCH register instead of the current pin state.

    Cheers,

    Håkon.

Reply
  • Hey Reynard,

    You will need to use the LATCH register. 

    Without the 'high' accuracy setting, the GPIOTE will trigger a single interrupt regardless of which pin triggered its sense interrupt. This singular GPIOTE interrupt will set the interrupt pending register and the CPU will eventually jump to the GPIOTE interrupt handler. Inside this handler the status of each registered GPIOTE pin is read and checked against its sense setting, hi-lo, lo-hi, or toggle. A problem arises when the a triggered GPIOTE pin changes to its previous state before the GPIOTE interrupt handler can read it. This is not very common, but it can happen. 
    The way to work around this problem is to read the LATCH register instead of the current pin state.

    Cheers,

    Håkon.

Children
No Data
Related