-
Notifications
You must be signed in to change notification settings - Fork 7.6k
I2c i2c_isr_handler_default cause watchdog timeout #4227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You can't call log_e inside an isr. The backtrace points to the uart failing to transmit and not i2c at fault. However, in the snippet you posted from i2c, the first line inside that if block will clear the interrupt and the line after the log will disable it from being raised again. The activeInt variable should be reset by assignment inside the loop somewhere. |
But int the I2c Hal.c file, theydid it. https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-i2c.c
Yes that's true, But ISR never exits.
Yes that should, But couldn't find a resetting line in hal i2c.c file. |
Yes, I see that. It should be isr_log_e() instead.
The updated decode doesn't appear related to I2C but instead due to re-initialization of the UART which looks like an issue that was reported already (though I can't find it currently).
inside the if statement where the log_e call is add an assignment to set activeInt to zero. This block shouldn't ever be entered under normal circumstances though. |
If you find the issue, please post it here
It is a Rx FIFO overflow. Dont know what cause it. I think wire library should take care of overflows. However for some reason, if it happens INT WDT timeout is inevitable. Thank you |
Is it possible that log_e cause the UART malfunction? |
Being called inside an ISR context very likely it is not helping.
that should be handled elsewhere in the ISR code I believe.
Often it is a misbehaving library that uses Wire, ie it doesn't check error codes etc... |
Thank you |
Fix Serial.end: #3894 |
Hardware:
Board: ESP32 Dev Module
Core Installation version: 1.0.4
IDE name: Arduino IDE
Flash Frequency: 80Mhz
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Windows 10
Description:
when running a code, sometimes i2c_isr_handler_default() function executes over and over again and causes firing the interrupt watchdog. This doesn't happen periodically. Sometimes it is 2 3 hours after ESP starts and sometimes it is just 20 minutes.
According to the debug text, activeInt variable of esp32-hal-i2c.c file is 4.
When i examine the esp32-hal-i2c.c file, in line 909, i noticed that interrupts were handled in an while loop. It only exits when activeInt is 0.
Now look the if condition in line 1003.
If this condition is the only condition becomes true, the while loop never exits because activeInt will not set to 0 and ISR executes until INT WDT fires.
This is the case as i understand. Please correct me if im wrong.
Thank you.
Debug Messages:
decoded backtrace
Decoding stack results
0x4008c417: multi_heap_free_impl at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/multi_heap.c line 131
0x4008cb4e: multi_heap_get_allocated_size at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/multi_heap_poisoning.c line 290
0x40085368: heap_caps_free at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/heap_caps.c line 267
0x4008539d: heap_caps_realloc at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/heap_caps.c line 282
0x40085861: lock_init_generic at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/newlib/locks.c line 85
0x400e212d: uartBegin at C:\Users\VEGA_1010\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32\esp32-hal-uart.c line 207
0x40081a7a: pinMatrixInDetach at C:\Users\VEGA_1010\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32\esp32-hal-matrix.c line 40
0x40082b11: esp_intr_enable at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/intr_alloc.c line 801
0x4008a669: prvAddNewTaskToReadyList at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/tasks.c line 1149
0x4008c3b3: multi_heap_malloc_impl at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/multi_heap.c line 155
0x4008cb64: multi_heap_get_allocated_size at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/multi_heap_poisoning.c line 295
0x40085368: heap_caps_free at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/heap_caps.c line 267
0x4008539d: heap_caps_realloc at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/heap_caps.c line 282
0x40085861: lock_init_generic at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/newlib/locks.c line 85
0x400e212d: uartBegin at C:\Users\VEGA_1010\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32\esp32-hal-uart.c line 207
0x400dbfde: ping_start(IPAddress, int, int, int, int, ping_option*) at C:\Users\VEGA_1010\Documents\Arduino\libraries\ESP32Ping-master\ping.cpp line 121
0x400dc33d: WiFiClient::connect(char const*, unsigned short, int) at C:\Users\VEGA_1010\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/IPAddress.h line 29
0x400894d1: xPortSysTickHandler at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 284
The text was updated successfully, but these errors were encountered: