Pin interrupt only running once?
Posted: Thu Sep 19, 2019 9:02 pm
Hi,
I have GPIO17 set as an input interrupt pin with pullup/down disabled, and I'm using an external pullup resistor. This is connected to an optosiolator (LTV-844). I'm feeding the optoisolater a 60Hz test signal, so I should be getting interrupts at 120Hz.
However, the interrupt seems to only run once.
What am I doing wrong here?
I've checked that I am getting a good 120Hz signal on the pin (see: https://i.imgur.com/9EB3Bb8.png)
I have GPIO17 set as an input interrupt pin with pullup/down disabled, and I'm using an external pullup resistor. This is connected to an optosiolator (LTV-844). I'm feeding the optoisolater a 60Hz test signal, so I should be getting interrupts at 120Hz.
However, the interrupt seems to only run once.
What am I doing wrong here?
Code: Select all
uint64_t inmask = (1ULL << 17);
gpio_config_t input_conf;
input_conf.pin_bit_mask = inmask;
input_conf.mode = GPIO_MODE_INPUT;
input_conf.pull_up_en = 0; //disable pullup
input_conf.pull_down_en = 0; //disable pulldown
input_conf.intr_type = 0; //disable interrupts
gpio_config(&input_conf);
gpio_install_isr_service(ESP_INTR_FLAG_EDGE | ESP_INTR_FLAG_IRAM);
gpio_isr_handler_add(17, input_isr_handler, NULL);
gpio_set_intr_type(17, GPIO_INTR_NEGEDGE);
gpio_intr_enable(17);
Code: Select all
bool testflag = false;
static void IRAM_ATTR input_isr_handler(void* arg) {
current_input_low = gpio_input_get();
current_input_high = gpio_input_get_high();
if(testflag) {
GPIO.enable_w1ts = 23;
testflag = false;
} else {
GPIO.enable_w1tc = 23;
testflag = true;
}
ets_printf("\nInterrupt\n");
}