This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

gpiote interrupt resolution

Can NRF52 gpiote detects pulse width nearly 250ns? We use a AFE sensor that notifies MCU it's data by sending a low to high pulse. The pulse width is about 250ns which is very small, I set the gpio triggering interrupt from low to high,but NRF52 can't run into the interrupt?

  • Hi,

    Have you looked at the pulses with an oscilloscope and made sure they go high enough to register as a logic high on the nRF52? The pulse must cross Vdd * 0.7.

    I used an nRF52 DK and this code to measure pulses shorter than 250ns:

    void GPIOTE_IRQHandler(void)
    {
        nrf_gpio_pin_toggle(LED_1);
        NRF_GPIOTE->EVENTS_IN[0] = 0;
        NVIC_ClearPendingIRQ(GPIOTE_IRQn);
    }
    
    int main(void)
    {
        LEDS_CONFIGURE(LEDS_MASK);
        LEDS_OFF(LEDS_MASK);
        nrf_gpio_cfg_input(BUTTON_1, NRF_GPIO_PIN_PULLUP);
    
        NRF_GPIOTE->INTENSET = 1;
        NRF_GPIOTE->CONFIG[0] = GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos | 
                 3 << GPIOTE_CONFIG_PSEL_Pos |
                 GPIOTE_CONFIG_POLARITY_HiToLo << GPIOTE_CONFIG_POLARITY_Pos;
        
        NVIC_EnableIRQ(GPIOTE_IRQn);
    
        while (true)
        {
            __WFE();
        }
    }
    

    As long as you cross Vdd * 0.7, 250ns shouldn't be a problem.

  • Hi,Martin, Thanks for your reply. I added your code after my gpiote configuration code, then I found the problem.since nrf_drv_gpiote_init()was not called, nrf_drv_gpiote_in_init()returned on pin_in_use_by_gpiotechecking. It's my fault. Now it's working. Thanks again!

Related