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

GPIOTE interrupt not trigered

It seems GPIOTE interrupt do not trigger when multiple IN signals are defined as GPIOTE_CONFIG_IN_SENSE_XXX(false). It works when GPIOTE_CONFIG_IN_SENSE_XXX(true)

I am using sdk14.0.0 with 10040 kit for this example.

It is a modified "pin_change_int" SDK example : Commented 1 signal : works Uncommented 2 signals : do not work 2 signals with SENSE "true" : works

void in_pin_handler0(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
    nrf_drv_gpiote_out_toggle(PIN_OUT0);
}


void in_pin_handler1(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
    nrf_drv_gpiote_out_toggle(PIN_OUT1);
}

/**
 * @brief Function for configuring: PIN_IN0 pin for input, PIN_OUT0 pin for output,
 * and configures GPIOTE to give an interrupt on pin change.
 */
static void gpio_init(void)
{
    ret_code_t err_code;

    err_code = nrf_drv_gpiote_init();
    APP_ERROR_CHECK(err_code);

    nrf_drv_gpiote_out_config_t out_config = GPIOTE_CONFIG_OUT_SIMPLE(false);

	
    err_code = nrf_drv_gpiote_out_init(PIN_OUT0, &out_config);
    APP_ERROR_CHECK(err_code);
	
    err_code = nrf_drv_gpiote_out_init(PIN_OUT1, &out_config);
    APP_ERROR_CHECK(err_code);

	
	
    nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
    in_config.pull = NRF_GPIO_PIN_PULLUP;

	
	
    err_code = nrf_drv_gpiote_in_init(PIN_IN0, &in_config, in_pin_handler0);
    APP_ERROR_CHECK(err_code);
	
    //err_code = nrf_drv_gpiote_in_init(PIN_IN1, &in_config, in_pin_handler0);
    //APP_ERROR_CHECK(err_code);

	
    nrf_drv_gpiote_in_event_enable(PIN_IN0, true);
    //nrf_drv_gpiote_in_event_enable(PIN_IN1, true);
}

/**
 * @brief Function for application main entry.
 */
int main(void)
{
    gpio_init();

    while (true)
    {
        // Do nothing.
    }
}
  • In my code 2 input work fine GPIOTE_CONFIG_IN_SENSE_XXX(false) --> works GPIOTE_CONFIG_IN_SENSE_XXX(true) --> works

  • As you said it works for you, I tried whit SDK 12. It seems to do different, but does not work neither ... What version of SDK do you use ?

  • I use nRF52832's nRF52DK and SDK12.3 and SDK14.0 I use 2 button on the nRF52Dk and It works.

  • Hi,

    When you are using the GPIOTE module in low accuracy/low-power mode by calling the GPIOTE_CONFIG_IN_SENSE_TOGGLE() function with the .hi_accuracy flag set to false, you need to make sure that you have configured the GPIOTE module for enough low-power input pins. I.e. make sure that GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS in sdk_config.h corresponds to the number of low-power events you using.

  • Hi,

    Thanks, it works for the SDK example ! But still do not in my project ... I already had 4, but even trying with GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS = 8

    What does count as LP event ? I have SPI initialised, and some other input pins with no interrupt ...

1 2