High frequency GPIO Interrupt
Posted: Sat Feb 09, 2019 5:03 am
I'm having a problem with "high-frequency" GPIO interrupt. I have a signal coming from another microcontroller that generates a 50us low pulse every 12ms and I capture this pulse using a falling-edge interrupt to send a task notification to a task with the highest priority in all my program.
The GPIO ISR service is placed in IRAM using:
The interrupt type is GPIO_INTR_NEGEDGE and the ISR handler looks like this:
The problem is, this works for around 250 ms after ESP32 boot and then the interrupt stops being fired (I'm checking everything with a logic analyzer and logs). However, if I increase the time to generate a 50us low pulse every 100ms instead of 12ms, it works as expected. How can I diagnose this problem? Can't the ESP32 handle an interrupt every 12ms? Even the RTOS tick rate is faster than that.
The GPIO ISR service is placed in IRAM using:
Code: Select all
gpio_install_isr_service(ESP_INTR_FLAG_IRAM);
Code: Select all
static void IRAM_ATTR scl_isr_handler(void* arg)
{
static BaseType_t xHigherPriorityTaskWoken = pdFALSE;
if(!gpio_get_level(PIC16_PIN))
{
vTaskNotifyGiveFromISR(task_handle, &xHigherPriorityTaskWoken);
if(xHigherPriorityTaskWoken)
{
portYIELD_FROM_ISR();
}
}
}