arkhipenko / esp32-mjpeg-multiclient-espcam-drivers

ESP32 MJPEG Multiclient Streaming Server with latest Espressif drivers
BSD 3-Clause "New" or "Revised" License
168 stars 40 forks source link

GPIO interrupt error #19

Closed kurgunu closed 3 years ago

kurgunu commented 3 years ago

Hello,

trying to attach interrupt for a button /// interrupt function: /// static void IRAM_ATTR buttonPressed(void arg) { Serial.println("handler on"); } /// in setup after esp_camera_init : /// gpio_set_pull_mode(GPIO_NUM_2, GPIO_PULLUP_ONLY); gpio_set_intr_type(GPIO_NUM_2, GPIO_INTR_ANYEDGE); gpio_isr_handler_add(GPIO_NUM_2, &buttonPressed, (void ) GPIO_NUM_2); //// and on any pin after button pressing code falls to Guru Meditation: //// 09:51:02.316 -> Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1) 09:51:02.549 -> Core 1 register dump: 09:51:02.549 -> PC : 0x400923f2 PS : 0x00060334 A0 : 0x8009160f A1 : 0x3ffc0db0
09:51:02.549 -> A2 : 0x3ffdac24 A3 : 0x3ffbc798 A4 : 0x00000001 A5 : 0x00000001
09:51:02.549 -> A6 : 0x00060323 A7 : 0x00000000 A8 : 0x3ffbc798 A9 : 0x3ffbc798
09:51:02.549 -> A10 : 0x00000019 A11 : 0x00000019 A12 : 0x00000001 A13 : 0x00000001
09:51:02.549 -> A14 : 0x00060321 A15 : 0x00000000 SAR : 0x00000008 EXCCAUSE: 0x00000006
09:51:02.549 -> EXCVADDR: 0x00000000 LBEG : 0x4008c778 LEND : 0x4008c794 LCOUNT : 0xffffffff
09:51:02.549 -> Core 1 was running in ISR context: 09:51:02.549 -> EPC1 : 0x40138b43 EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x400923f2 09:51:02.549 -> 09:51:02.549 -> ELF file SHA256: 0000000000000000 09:51:02.549 -> 09:51:02.549 -> Backtrace: 0x400923f2:0x3ffc0db0 0x4009160c:0x3ffc0dd0 0x4008f5a3:0x3ffc0df0 0x40138ac1:0x3ffc0e30 0x4012572b:0x3ffc0e50 0x40139abd:0x3ffc0e80 0x4013a0cd:0x3ffc0ea0 0x40127998:0x3ffc0ee0 0x4012816d:0x3ffc0f10 0x400d8485:0x3ffc0f30 0x4015e97d:0x3ffc0f70 0x400dfe6b:0x3ffc0f90 0x400dfec9:0x3ffc0fc0 0x400e002b:0x3ffc0fe0 0x40081454:0x3ffc1000 0x40088ca9:0x3ffc1020 0x4008a359:0x3ffc1040 0x4015fb63:0x3ffbc680 0x401478a3:0x3ffbc6a0 0x4009129d:0x3ffbc6c0 0x4008f76a:0x3ffbc6e0 09:51:02.549 -> 09:51:02.549 -> Core 0 register dump: 09:51:02.549 -> PC : 0x400907de PS : 0x00060e34 A0 : 0x80091c4d A1 : 0x3ffb4ce0
09:51:02.549 -> A2 : 0x3ffc0428 A3 : 0x0000cdcd A4 : 0xb33fffff A5 : 0x00000001
09:51:02.549 -> A6 : 0x00060e23 A7 : 0x0000abab A8 : 0x0000cdcd A9 : 0x3ffb4cf0
09:51:02.549 -> A10 : 0x3ffdaeec A11 : 0x3ffdaeec A12 : 0x00060620 A13 : 0xef913416
09:51:02.549 -> A14 : 0x00000000 A15 : 0x65746174 SAR : 0x00000010 EXCCAUSE: 0x00000006
09:51:02.549 -> EXCVADDR: 0x00000000 LBEG : 0x4008c778 LEND : 0x4008c794 LCOUNT : 0x00000000
09:51:02.549 -> 09:51:02.549 -> ELF file SHA256: 0000000000000000 09:51:02.549 -> 09:51:02.549 -> Backtrace: 0x400907de:0x3ffb4ce0 0x40091c4a:0x3ffb4d10 0x4008f50b:0x3ffb4d30 0x401389ea:0x3ffb4d70 0x40138cd8:0x3ffb4d90 0x40128954:0x3ffb4db0 0x401289b2:0x3ffb4dd0 0x4012fee4:0x3ffb4df0 0x401304c4:0x3ffb4e20 0x4013a8ae:0x3ffb4e90 0x4013b993:0x3ffb4eb0 0x40125599:0x3ffb4ed0 0x4008f76a:0x3ffb4f00 09:51:02.549 -> 09:51:02.549 -> Rebooting... ///

what it could be?..

kurgunu commented 3 years ago

device by itself works fine, and on clear code like this all interrupts are served:

include

include <driver/rtc_io.h>

static void IRAM_ATTR buttonPressed(void * arg) { Serial.println("handler on"); }

void setup() { delay(3000); Serial.begin(115200); Serial.println("Begin..."); gpio_install_isr_service(0); gpio_set_pull_mode(GPIO_NUM_2, GPIO_PULLUP_ONLY); gpio_set_intr_type(GPIO_NUM_2, GPIO_INTR_ANYEDGE); gpio_isr_handler_add(GPIO_NUM_2, &buttonPressed, (void *) GPIO_NUM_2); Serial.println("Ready."); }

void loop() { Serial.println("Tick..."); delay(1000); }

arkhipenko commented 3 years ago

Sorry - I cannot help with modifications to my code.

If I were to guess:

(Interrupt wdt timeout on CPU1)

Core 1 in my code is dedicated 100% to serving images to the buffer. Depending on your resolution it is probably busy already, so adding anything to Core 1 would likely cause WDT interrupt. Try moving all logic to Core 0