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

Missing Interrupts on GPIOE PORT events

we're using Mbed for NRF51822. our board using 2 GPIOs interrupt.image description

problem: the Rise edge did not generate the Interrupt event: set EVENTS_PORT. I try uisng while, but it did not working: volatile uint32_t newVal = NRF_GPIO->IN;

    while ( (NRF_GPIOTE->EVENTS_PORT != 0) && ( (NRF_GPIOTE->INTENSET & GPIOTE_INTENSET_PORT_Msk) != 0) ){
        newVal = NRF_GPIO->IN;
//    if ( (NRF_GPIOTE->EVENTS_PORT != 0) && ( (NRF_GPIOTE->INTENSET & GPIOTE_INTENSET_PORT_Msk) != 0) ){
        NRF_GPIOTE->EVENTS_PORT = 0;
        setisrcheck001(1);
        for(uint8_t i=0;i<31;i++){
            if(channel_ids[i]>0){
                if(channel_enabled[i]){
                    if( ((newVal>>i)&1)  && ( ( (NRF_GPIO->PIN_CNF[i] >>GPIO_PIN_CNF_SENSE_Pos) & GPIO_PIN_CNF_SENSE_Low) != GPIO_PIN_CNF_SENSE_Low) && ( (portRISE>>i)&1) ){
                            irq_handler(channel_ids[i], IRQ_RISE);            
                    }                    
                    else if( ( ((newVal>>i)&1) == 0) && ( ( (NRF_GPIO->PIN_CNF[i] >>GPIO_PIN_CNF_SENSE_Pos)&GPIO_PIN_CNF_SENSE_Low) == GPIO_PIN_CNF_SENSE_Low) && ( (portFALL>>i)&1) ){
                            irq_handler(channel_ids[i], IRQ_FALL);
                    }                    
                }

                if(NRF_GPIO->PIN_CNF[i] &GPIO_PIN_CNF_SENSE_Msk){
                    NRF_GPIO->PIN_CNF[i] &= ~(GPIO_PIN_CNF_SENSE_Msk);
                                         
                    if(newVal>>i &1){
                         NRF_GPIO->PIN_CNF[i] |= (GPIO_PIN_CNF_SENSE_Low     << GPIO_PIN_CNF_SENSE_Pos) ;
                    }
                    else{
                         NRF_GPIO->PIN_CNF[i] |= (GPIO_PIN_CNF_SENSE_High     << GPIO_PIN_CNF_SENSE_Pos) ;
                    }
                }
            }
        }
        setisrcheck001(0);
    }

the Rise edge of RED signal should generate another interrupt. but seem failed.

Question:

  1. what's condition to generate EVENTS_PORT in GPIOTE_IRQHandler() process? it' seem just clear EVENTS_PORT not enough.
  2. how the GPIOE EVENTS_PORT generate when multi-GPIOs rise and fall ?
Related