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?
GPIO interrupt handler only firing once
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:
How did you fix it?
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?
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.
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 290 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.