ESP32-C3 lost in BTM module with a suspicious callback while trying to fix ADC crash when connecting via Bluetooth

User avatar
evanescent_nacho
Posts: 10
Joined: Thu Nov 17, 2022 10:58 pm

ESP32-C3 lost in BTM module with a suspicious callback while trying to fix ADC crash when connecting via Bluetooth

Postby evanescent_nacho » Mon Jan 30, 2023 8:41 pm

Development specs: WIndows 10, ESP-IDF for VSCode v4.4, ESP32-C3 connecting with onboard JTAG debugging and serial logging.

I'm trying to debug a crash I am getting while connecting to an ESP32-C3 based device after having added ADC code. I was able to connect before adding in the ADC. I am using ADC 1 channels 2 and 3 and ADC 2 channel 0. I have read that the Wifi can have conflicts with ADC2, but the documentation https://docs.espressif.com/projects/es ... imitations does not say that this affects Bluetooth and that using it in continuous mode should work between certain frequency limitations. Since I have satisfied those limitations and this issue does not seem to apply, that does not seem to be the issue.

I set a break point on line 341 in panic_arch.c to try and find the offending code from the call stack. It looks like the panic handler is called right after btm_establish_continue(). Looking at this function, it looks like is is calling a callback with some data it was structured for the function. According to the watch variables, p_bl_changed_cb references multiprecision_add_mod+100. This seems wrong and the code that sets that callback references the function bta_dm_bl_change_cback instead. I was hoping to trace it back to something that I incorrectly setup in code, but at this point it looks like its pointed at a random function. I also have not been able to find a good explanation of what the '+100' means. It looks like it's pointing the callback to something maybe 100 addresses later from that function, but that doesn't really make sense to me too.

It looks like my debugger is lying to me about where the code is executing. When I have set break points in code previously while getting the debugger working, the code does not seem to ever stop on the line that I set the break point, so it is like the translation of addresses to actual code is offset, but I don't know how to go about fixing that.

Who is online

Users browsing this forum: HighVoltage and 113 guests