GPIO interrupt handler only firing once

User avatar
kolban
Posts: 131
Joined: Tue Jun 16, 2015 1:09 pm
Location: Fort Worth, Texas, USA

GPIO interrupt handler only firing once

Postby kolban » Mon Oct 12, 2015 10:06 am

I have written some code that attempts to register an interrupt handler for a GPIO. I find that when the signal changes on the pin, the interrupt handler does indeed fire ... but only the first time. If the signal changes again, no new interrupt handler invocation occurs. I have tried to acknowledge the interrupt, but no joy yet. I am using SDK 1.4.

At a high level, my code looks as follows:

InterruptHandler(mask) {
log the interrupt;
gpio_intr_ack(mask);
}

main() {
gpio_init();
Set the pin to be input;
gpio_intr_handler_register(InterruptHandler, NULL);
gpio_pin_intr_state_set(GPIO_PIN_ID(12), GPIO_PIN_INTR_ANYEDGE);
}

Can anyone spot what I might be missing?

gustavo
Posts: 24
Joined: Thu Apr 28, 2016 6:01 pm

Re: GPIO interrupt handler only firing once

Postby gustavo » Tue May 31, 2016 7:30 pm

Hi,
I'm having the same issue.

My code is as follows:

Code: Select all

void callOut() {
    int gpio_status = GPIO_REG_READ(GPIO_STATUS_ADDRESS);
    GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, gpio_status);
    printf("callOut.");
}

void user_init(void)
{   
    GPIO_ConfigTypeDef gpio_in_cfg;                                    //Define GPIO Init Structure
    gpio_in_cfg.GPIO_IntrType = GPIO_PIN_INTR_NEGEDGE;                 //Falling edge trigger
    gpio_in_cfg.GPIO_Mode = GPIO_Mode_Input;                           //Input mode
    gpio_in_cfg.GPIO_Pin  = GPIO_Pin_12;                               // Enable GPIO
    gpio_config(&gpio_in_cfg);                                         //Initialization function
    gpio_intr_handler_register(callOut, NULL);                   // Register the interrupt function
    _xt_isr_unmask(1 << ETS_GPIO_INUM);                                //Enable the GPIO interrupt
}


How did you fix it?

gustavo
Posts: 24
Joined: Thu Apr 28, 2016 6:01 pm

Re: GPIO interrupt handler only firing once

Postby gustavo » Thu Jun 02, 2016 4:39 pm

Found the problem in my code.
Not setting the button to pull up.

Code: Select all

gpio_in_cfg.GPIO_Pullup = GPIO_PullUp_EN;

Who is online

Users browsing this forum: No registered users and 13 guests