Abort/Panic Reboot Problem With Interrupt - Having Trouble Deciphering Log And Troubleshooting

Mahonroy
Posts: 7
Joined: Tue Sep 21, 2021 10:53 pm

Abort/Panic Reboot Problem With Interrupt - Having Trouble Deciphering Log And Troubleshooting

Postby Mahonroy » Tue Dec 28, 2021 7:11 pm

Hello, I am using an ESP32-WROOM-32UE (16MB). Basically what I am doing is a serial transmit/receive function on a single GPIO to communicate with a sensor. I have 2 hardware timers running (1 for transmit function, 1 for receive function). I also set up some interrupts that are used for the receiving function. The transmit piece works perfectly. As soon as I am done transmitting, I go into a receiving state, where I set up interrupts for collecting the receiving bits. If a sensor does not respond, e.g. nothing to trigger an interrut, then everything works and no crash. If a sensor responds, it immediately crashes.

I attached the .cpp file with the serial functions in it. Let me know if there are other code snippits you want to see.

This is the log leading up to the incident:

Code: Select all

abort() was called at PC 0x400827cf on core 0
0x400827cf: lock_acquire_generic at C:/Users/mahon/esp_v431/esp-idf/components/newlib/locks.c:139


Backtrace:0x40084f1f:0x3ffb0230 0x40085711:0x3ffb0250 0x4008a84a:0x3ffb0270 0x400827cf:0x3ffb02e0 0x40082919:0x3ffb0310 0x40082992:0x3ffb033ffb0360 0x400e3e85:0x3ffb0670 0x400e86e5:0x3ffb06a0 0x4008a6dd:0x3ffb06d0 0x400d4a85:0x3ffb0720 0x400d726e:0x3ffb0780 0x400d689b:0x3ffb07c0 b07e0 0x40083d3d:0x3ffb0800 0x400825e1:0x3ffb0820 0x400820cf:0x3ffb7aa0 0x400820ee:0x3ffb7ac0 0x400d747b:0x3ffb7ae0 0x400d62e4:0x3ffb7b00 0xb40 0x400d5e5d:0x3ffb7c00 0x400d5f4f:0x3ffb7e90 0x400e8414:0x3ffb7eb0 0x400885b1:0x3ffb7ed0
0x40084f1f: panic_abort at C:/Users/mahon/esp_v431/esp-idf/components/esp_system/panic.c:368
0x40085711: esp_system_abort at C:/Users/mahon/esp_v431/esp-idf/components/esp_system/system_api.c:112
0x4008a84a: abort at C:/Users/mahon/esp_v431/esp-idf/components/newlib/abort.c:46
0x400827cf: lock_acquire_generic at C:/Users/mahon/esp_v431/esp-idf/components/newlib/locks.c:139
0x40082919: _lock_acquire_recursive at C:/Users/mahon/esp_v431/esp-idf/components/newlib/locks.c:167
0x40082992: __retarget_lock_acquire_recursive at C:/Users/mahon/esp_v431/esp-idf/components/newlib/locks.c:323
0x400e0e72: _vfprintf_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/vfprintf.c:or 2)
0x400e3e85: vprintf at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/vprintf.c:34 (d
0x400e86e5: esp_log_writev at C:/Users/mahon/esp_v431/esp-idf/components/log/log.c:189
0x4008a6dd: esp_log_write at C:/Users/mahon/esp_v431/esp-idf/components/log/log.c:199
0x400d4a85: gpio_config at C:/Users/mahon/esp_v431/esp-idf/components/driver/gpio.c:385 (discriminator 13)
0x400d726e: attachInterrupt(unsigned char, void (*)(void*), InterruptMode) at C:\Users\mahon\Source\repos\ESP32ControllerFirmware\controller../main/Utility/gpio.cpp:18
0x400d689b: ParticleSdiSerial::attachRxStartBitInterrupt() at C:\Users\mahon\Source\repos\ESP32ControllerFirmware\controller-firmware\build/ParticleSdiSerial.cpp:158
0x400d6abe: ParticleSdiSerial::rxTimerISR() at C:\Users\mahon\Source\repos\ESP32ControllerFirmware\controller-firmware\build/../main/Utilityal.cpp:331
0x40083d3d: timer_isr_default at C:/Users/mahon/esp_v431/esp-idf/components/driver/timer.c:216
0x400825e1: _xt_lowint1 at C:/Users/mahon/esp_v431/esp-idf/components/freertos/port/xtensa/xtensa_vectors.S:1105
0x400820cf: esp_timer_impl_get_counter_reg at C:/Users/mahon/esp_v431/esp-idf/components/esp_timer/src/esp_timer_impl_lac.c:136 (discriminat
0x400820ee: esp_timer_impl_get_time at C:/Users/mahon/esp_v431/esp-idf/components/esp_timer/src/esp_timer_impl_lac.c:152
0x400d747b: millis() at C:\Users\mahon\Source\repos\ESP32ControllerFirmware\controller-firmware\build/../main/application.cpp:5
0x400d62e4: MultiSoilSdi12::getResponse(ParticleSdiSerial&, unsigned int) at C:\Users\mahon\Source\repos\ESP32ControllerFirmware\controller-./main/ComponentServices/MultiSoilSdi12.cpp:330
0x400d63a5: MultiSoilSdi12::IdentifySensor() at C:\Users\mahon\Source\repos\ESP32ControllerFirmware\controller-firmware\build/../main/ComponiSoilSdi12.cpp:219
0x400d5e5d: setup() at C:\Users\mahon\Source\repos\ESP32ControllerFirmware\controller-firmware\build/../main/controller-firmware.cpp:166
0x400d5f4f: app_main at C:\Users\mahon\Source\repos\ESP32ControllerFirmware\controller-firmware\build/../main/controller-firmware.cpp:363
0x400e8414: main_task at C:/Users/mahon/esp_v431/esp-idf/components/freertos/port/port_common.c:133 (discriminator 2)
0x400885b1: vPortTaskWrapper at C:/Users/mahon/esp_v431/esp-idf/components/freertos/port/xtensa/port.c:168


ELF file SHA256: d16723a90ec655cf
Rebooting...
I'm a bit confused deciphering some of the logs/errors, and how I might go about troubleshooting this. It seemed like some "vprintf" command is causing the abort.... but further down you can see it seems to have stemmed from attaching interrupts and configuring the gpio, so I'm not entirely sure.

Any help or advice is greatly appreciated, thanks!
Attachments
ParticleSdiSerial.cpp
(9.88 KiB) Downloaded 456 times

ESP_Sprite
Posts: 9761
Joined: Thu Nov 26, 2015 4:08 am

Re: Abort/Panic Reboot Problem With Interrupt - Having Trouble Deciphering Log And Troubleshooting

Postby ESP_Sprite » Wed Dec 29, 2021 2:40 am

Looking at your backtrace, you tried to do something complicated (ParticleSdiSomething) in a timer ISR. Timer ISRs on the ESP32 can do only a very limited amount of functions, and things like e.g. printf or esp_logi are not one of them. The suggested way to use them is to not do much more than to set a semaphore, task notification or something else to awaken a task that does the actual work. (Also, instead of hardware timers, you may want to look into using esp_timer, as the callbacks it gives you are not done in ISR context, so you're allowed to do more in there.)

Who is online

Users browsing this forum: No registered users and 82 guests