Is there any possibility to detect active state on the more than one pin using sense mechanism? GPIOTE_IRQHandler is blocked when it detect active state on the one of the used pins. How to deal with it?
Is there any possibility to detect active state on the more than one pin using sense mechanism? GPIOTE_IRQHandler is blocked when it detect active state on the one of the used pins. How to deal with it?
The sense part of GPIOTE (PORT event) will not give you an individual event for each pin. You will get a generic interrupt when the port event is triggered. The way to detect which pin triggered the port interrupt is to manually read the GPIO IN register. If you need an individual interrupt for your pins, you will have to use GPIOTE IN/OUT tasks and events (which will use 16M clock, and therefore draw more power than PORT event)
I check the status as you described but.... What about IRQ_Handler if active state is still on "pin number one" and active state occure on the "pin number two"? I think it's blocked.
In this scenario you will then get two interrupts after each other, as it's a nested interrupt vector. It'll look something like this: Pin 1 trigger interrupt. Pin 2 set while in interrupt handler triggered by Pin 1. Pin 2 trigger same interrupt.
It's not clear for me. Could you modify example code in attached file?
void GPIOTE_IRQHandler(void)
{
if ((NRF_GPIOTE->EVENTS_PORT != 0) && (NRF_GPIOTE->INTENSET & GPIOTE_INTENSET_PORT_Msk))
{
NRF_GPIOTE->EVENTS_PORT = 0;
if(nrf_gpio_pin_read(PIN_1)==1)
{
flag_1=true;
}
if(nrf_gpio_pin_read(PIN_2)==1)
{
flag_2=true;
}
if(nrf_gpio_pin_read(PIN_3)==1)
{
flag_3=true;
}
}
}
Hi,
You are doing this correct. You are reading which pin is active when the interrupt is triggered. An easier way is to read the GPIO IN register directly instead of reading one and one pin, and see which pins are active: uint32_t active_pins = NRF_GPIO->IN; if (active_pins & my_bitmask_button_2) do_something();