ESP32S3, esp-idf-v5.0.1 - GPIO inputs with interrupts
Calling gpio_config() with intr_type of GPIO_INTR_XXXEDGE or GFLAG_INPUT_CHANGING has worked fine for me, and the interrupt functions work as expected.
However, after reading the ESP32 Errata section "The ESP32 GPIO peripheral may not trigger interrupts correctly." I tried to implement the workaround where using GPIO_INTR_HIGH/LOW_LEVEL interrupts and flipping the level each time the ISR is called.
See https://github.com/espressif/esp-idf/issues/9746 for a great explanation.
The problem I'm seeing is that if gpio_config() is called with GPIO_INTR_LOW_LEVEL and the pin is already low or if it's called with GPIO_INTR_HIGH_LEVEL and the pin is already high the interrupt occurs within gpio_config() and the code seems to get stuck in an endless ISR loop, before rebooting.
I have tried configuring the GPIO and an input and reading its value prior to selecting GPIO_INTR_HIGH/LOW_LEVEL but this still leaves a race condition.
There appears to be a workaround of using gpio_config() to setup the GPIO as an input (pullup, pulldown etc) with intr_type = GPIO_INTR_DISABLE, and then following this by calling gpio_set_intr_type(GPIO_INTR_HIGH/LOW_LEVEL) and gpio_intr_enable(pin#);
Has anyone else encountered this ? Either I was doing something wrong when calling gpio_config() with GPIO_INTR_HIGH/LOW_LEVEL, or those interrupt types are incompatible with gpio_config() (in which case there's a bug in esp-idf - and this incompatibility should be documented).
Calling gpio_config() with intr_type = GPIO_INTR_HIGH/LOW_LEVEL causes reboot
Who is online
Users browsing this forum: Bing [Bot] and 363 guests