Problema
Você está tentando usar a API de interrupções GPIO do ESP-IDF, mas seu ESP entra em loop de crash com as seguintes mensagens de erro:
gpio_isr_error_log.txt
E (374) gpio: gpio_isr_handler_add(527): GPIO isr service is not installed, call gpio_install_isr_service() first
ESP_ERROR_CHECK failed: esp_err_t 0x103 (ESP_ERR_INVALID_STATE) at 0x400d1584
file: "src/main.cpp" line 478
func: void app_main()
expression: gpio_isr_handler_add(rx_config.gpio_num, onDALIReceive, (void*)0 )
abort() was called at PC 0x40086117 on core 0Solução
Você precisa chamar gpio_install_isr_service() antes de chamar gpio_isr_handler_add()!
Aqui está um exemplo:
gpio_install_isr_service.cpp
#include <driver/gpio.h>
void app_main() {
ESP_ERROR_CHECK(gpio_install_isr_service(0 /* No flags */));
// Now you can add your GPIO interrupt handlers
// ...
ESP_ERROR_CHECK(gpio_isr_handler_add(GPIO_NUM_2, myGPIOInterrupt, nullptr));
}Note que chamar gpio_install_isr_service() é fundamentalmente incompatível com o uso da função gpio_set_intr_type(). Então você não pode usar ambos no mesmo projeto.
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow