<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>gpiote interrupt invalid</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/29717/gpiote-interrupt-invalid</link><description>nRF51822 sdk9.0 
 I am having a problem with GPIOTE. I have four interrupts programmed on four different pins. 
 As long as the signals do not transition at the same time, the firmware receives interrupts from all pins independently; everything works</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 24 Jan 2018 14:51:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/29717/gpiote-interrupt-invalid" /><item><title>RE: gpiote interrupt invalid</title><link>https://devzone.nordicsemi.com/thread/117903?ContentTypeID=1</link><pubDate>Wed, 24 Jan 2018 14:51:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4dfcb0b-a8f1-4a5a-b7e1-cb6d1a629f39</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;That is strange. I tested your code, slightly modified to make it compile and use the correct pins on my nRF51 DK, and it seemed to work:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void gpiote_ppr_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
    nrf_gpio_pin_toggle(LED_1);
}

void gpiote_chr_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
    nrf_gpio_pin_toggle(LED_2);
}

void gpiote_bhi160_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
    nrf_gpio_pin_toggle(LED_3);
}

void gpiote_button_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
    nrf_gpio_pin_toggle(LED_4);
}
    
void setup()
{
    uint32_t err_code;
            
    err_code = nrf_drv_gpiote_init();
    APP_ERROR_CHECK(err_code);
    
    nrf_drv_gpiote_in_config_t config_ppr = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
    config_ppr.pull = NRF_GPIO_PIN_PULLUP;
    err_code = nrf_drv_gpiote_in_init(BUTTON_1, &amp;amp;config_ppr, gpiote_ppr_handler);
    APP_ERROR_CHECK(err_code);

    nrf_drv_gpiote_in_config_t config_chr = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
    config_chr.pull = NRF_GPIO_PIN_PULLUP;        
    err_code = nrf_drv_gpiote_in_init(BUTTON_2, &amp;amp;config_chr, gpiote_chr_handler);
    APP_ERROR_CHECK(err_code);

    nrf_drv_gpiote_in_config_t config_ppr_1 = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
    //config_ppr_1.sense = NRF_GPIOTE_POLARITY_LOTOHI;
    config_ppr_1.pull = NRF_GPIO_PIN_PULLUP;
    err_code = nrf_drv_gpiote_in_init(BUTTON_3, &amp;amp;config_ppr_1, gpiote_bhi160_handler);

    nrf_drv_gpiote_in_config_t config_ppr_2 = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
    config_ppr_2.pull = NRF_GPIO_PIN_PULLUP;
    err_code = nrf_drv_gpiote_in_init(BUTTON_4, &amp;amp;config_ppr_2, gpiote_button_handler);
    
    nrf_drv_gpiote_in_event_enable(BUTTON_1, true);
    nrf_drv_gpiote_in_event_enable(BUTTON_2, true);
    nrf_drv_gpiote_in_event_enable(BUTTON_3, true);
    nrf_drv_gpiote_in_event_enable(BUTTON_4, true);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I tied all the buttons together and triggered them simultaneously and all interrupts fired.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>