GPIO interrupt issue
Posted: Wed Aug 26, 2020 9:45 am
Hello, guys!
We are using esp-idf v3.3.2 and ESP32-WROVER-B device in our design.
There is a situation when we need to process interrupts on two GPIOs (GPIO_NUM_13 and GPIO_NUM_14) every 2ms (i.e. 500 times per second). What we have connected to GPIO_NUM_13 and GPIO_NUM_14 is something like you can see in the attachment.
Both GPIOs are configured to be sensitive on negative edge.
We tried to have interrupt service routine as short as possible:
Basically, we are just notifying another task that interrupt happened.
What we noticed is happening though is that sometimes one interrupt is processed two times.
Do you have any idea what might be the reason for that? Is 2ms between the interrupts too little time for ESP32?
Is there anything we are missing here, do we need somehow to clear the interrupt within ISR routine or something?
Thanks in advance for your time and efforts.
Sincerely,
Bojan.
We are using esp-idf v3.3.2 and ESP32-WROVER-B device in our design.
There is a situation when we need to process interrupts on two GPIOs (GPIO_NUM_13 and GPIO_NUM_14) every 2ms (i.e. 500 times per second). What we have connected to GPIO_NUM_13 and GPIO_NUM_14 is something like you can see in the attachment.
Both GPIOs are configured to be sensitive on negative edge.
Code: Select all
gpio_config_t io_conf;
io_conf.pin_bit_mask = GPIO_NUM_13 | GPIO_NUM_14;
io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
io_conf.pull_up_en = GPIO_PULLUP_DISABLE;
io_conf.intr_type = GPIO_INTR_NEGEDGE;
io_conf.mode = GPIO_MODE_INPUT;
err = gpio_config(&io_conf);
Code: Select all
static void IRAM_ATTR wiegand_D1_isr_handler(void* arg){
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
vTaskNotifyGiveFromISR(xD1_int, &xHigherPriorityTaskWoken);
if (xHigherPriorityTaskWoken == pdTRUE){
portYIELD_FROM_ISR();
}
}
What we noticed is happening though is that sometimes one interrupt is processed two times.
Do you have any idea what might be the reason for that? Is 2ms between the interrupts too little time for ESP32?
Is there anything we are missing here, do we need somehow to clear the interrupt within ISR routine or something?
Thanks in advance for your time and efforts.
Sincerely,
Bojan.