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 ?
Parents
  • @wen jin zhang :

    1. GPIOTE PORT event generated on the rising edge of DETECT signal. Please have a look at section 15.1.2

    2)DETECT signal is common signal when multiple pins are configured with SENSE mechanism. The DETECT signal is only cleared when all of the pin with SENSE mechanism is inactive. So if there still one pin is active, you won't be able to receive another interrupt on GPIOTE PORT event.

    It's hard for me to understand the red signal. Could you capture another trace which may show the issue more clearly ?

  • Thanks for help! my case look like these:

    1. 2 GPIOs interrupt happened.
    2. GPIOTE_IRQHandler clear PORT EVENT.
    3. first ISR execute, the first GPIO level to change HIGH.
    4. set first GPIO SENSE mechanism to HIGH. it'll active. but NO PORT EVENT/Interrupt because still has other pin active.
    5. second ISR execute, and it change GPIO SENSE mechanism level. it deactived. but DETECT signal did not clear.
    6. GPIOTE_IRQHandler() finished. exit interrupt.
    7. No PORT EVENT/interrupt generate for first GPIO interrupt.

    question:

    1. is there any solution for these case?
    2. is DETECT signal for each GPIO pin and there has another DETECT signal for all? section 14 figure 15.
Reply
  • Thanks for help! my case look like these:

    1. 2 GPIOs interrupt happened.
    2. GPIOTE_IRQHandler clear PORT EVENT.
    3. first ISR execute, the first GPIO level to change HIGH.
    4. set first GPIO SENSE mechanism to HIGH. it'll active. but NO PORT EVENT/Interrupt because still has other pin active.
    5. second ISR execute, and it change GPIO SENSE mechanism level. it deactived. but DETECT signal did not clear.
    6. GPIOTE_IRQHandler() finished. exit interrupt.
    7. No PORT EVENT/interrupt generate for first GPIO interrupt.

    question:

    1. is there any solution for these case?
    2. is DETECT signal for each GPIO pin and there has another DETECT signal for all? section 14 figure 15.
Children
No Data
Related