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

PORT EVENT with 2 Pins event, only one detected

Hi everyone,

In my low power application , I use PORT EVENT to detect the interrupts of my two pins. when I use only one pin interrupt, it's working well . But with two interrupts, only one of them are detected.

    static void gpiote_port_init() {
	
	NRF_GPIO->PIN_CNF[BOARD_INT1] = (GPIO_PIN_CNF_SENSE_High << GPIO_PIN_CNF_SENSE_Pos)
	                                        | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos)
	                                        | (NRF_GPIO_PIN_PULLDOWN<< GPIO_PIN_CNF_PULL_Pos)
	                                        | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos)
	                                        | (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos);
	

	NRF_GPIO->PIN_CNF[BODY_ACCESSORY] = (GPIO_PIN_CNF_SENSE_High << GPIO_PIN_CNF_SENSE_Pos)
                                        | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos)
                                        | (NRF_GPIO_PIN_PULLUP << GPIO_PIN_CNF_PULL_Pos)
                                        | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos)
                                        | (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos);

	
	NRF_GPIOTE->INTENCLR = 0xFFFFFFFF;
	NRF_GPIOTE->INTENSET = (GPIOTE_INTENSET_PORT_Set << GPIOTE_INTENSET_PORT_Pos);
	NVIC_ClearPendingIRQ(GPIOTE_IRQn);
	NVIC_SetPriority(GPIOTE_IRQn, APP_IRQ_PRIORITY_LOW);
	NVIC_EnableIRQ(GPIOTE_IRQn);
}



   void GPIOTE_IRQHandler(void)
{
  // Event causing the interrupt must be cleared
  if ((NRF_GPIOTE->EVENTS_PORT != 0))
  {
    NRF_GPIOTE->EVENTS_PORT = 0;
  }

 
  if (nrf_gpio_pin_read(BOARD_INT1) == 1)
   {

       counter++;

 	}
  if (nrf_gpio_pin_read(BODY_ACCESSORY) == 1)

  {	  
  	
  	
  		timer_start();
  	
   }


}

Is it correct what I did?

Related