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

Issues with gpiote interrupt

void gpiote_event_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
    spi_read();
}

static void DRDY_interrupt_init(void)
{
    ret_code_t err_code;
//    NVIC_EnableIRQ(GPIOTE_IRQn);
    err_code = nrf_drv_gpiote_init();
    APP_ERROR_CHECK(err_code);
    if (!nrf_drv_gpiote_is_init())
    {
      nrf_drv_gpiote_init();
    }
    nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(false);
//    nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true);
    in_config.pull = NRF_GPIO_PIN_PULLUP;
    err_code = nrf_drv_gpiote_in_init(DRDY_PIN, &in_config, gpiote_event_handler);
    APP_ERROR_CHECK(err_code);
    
    nrf_drv_gpiote_in_event_enable(DRDY_PIN, true);
}

Hi we are having issues with gpiote interrupt. We would like to do some spi read when drdy gpio becomes high to low. I have done above configuration for the same. 

We are using following set up

Segger Embedded studio. nRF5_SDK_15.2.0_9412b96  pca10056 soft device enabled, gpiote enabled. The project is based on ble_app_att_mtu_throughput example

Issues: when following code is executed 

nrf_drv_gpiote_in_event_enable(DRDY_PIN, true);

the code get stuck in dummy handler in ses_startup_nrf52840.s.

What could be the issue for this?? 

We are not using any timer module for now but we might use this in future. So also  wanted  to know do we need to set different priority for gpiote interrupt and timer interrupt or is it not required. 

How many gpiote channel can be used at once?

Please see what we have configured and let us know what went wrong.

Thanks

Parents
  • Hi,

    Please try to read out the current ISR number from xpsr register when the program has ended up inside the Dummy handler. This will tell us what the interrupt source is. I included the screenshot below to illustrate what I mean. In this case, the IRQ number is 17, which if you look up in the nrf52840.h corresponds to RTC1_IRQn.  

    We are not using any timer module for now but we might use this in future. So also  wanted  to know do we need to set different priority for gpiote interrupt and timer interrupt or is it not required. 

    You can use the same priority for both. It is probably safer too. Note that all SDK modules use priority '6' by default. 

    How many gpiote channel can be used at once?

     It has 8 channels. So 8 channels.

Reply
  • Hi,

    Please try to read out the current ISR number from xpsr register when the program has ended up inside the Dummy handler. This will tell us what the interrupt source is. I included the screenshot below to illustrate what I mean. In this case, the IRQ number is 17, which if you look up in the nrf52840.h corresponds to RTC1_IRQn.  

    We are not using any timer module for now but we might use this in future. So also  wanted  to know do we need to set different priority for gpiote interrupt and timer interrupt or is it not required. 

    You can use the same priority for both. It is probably safer too. Note that all SDK modules use priority '6' by default. 

    How many gpiote channel can be used at once?

     It has 8 channels. So 8 channels.

Children
Related