-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Description
Environment
- Development Kit: [none]
- Module or chip used: [ESP32-WROOM-32D]
- IDF version: v4.3.2
- Build System: [idf.py]
- Compiler version: 8.4.0
- Operating System: [Windows]
- (Windows only) environment type: [ESP Command Prompt].
- Using an IDE?: [Yes - vscode]
- Power Supply: [USB]
Problem Description
My application is calling function declared and defined in separate component. This should take care of i2c communication with GPIO expanders. However i always get some weird errors when calling two specific functions.
I tried:
- expanding main task size
- commenting out lines of code, up to the point when the function does nothing
- measuring 3.3V rail with oscilloscope, to rule out PSU problems
- checking that i dont use the pins dedicated for onboard SPI flash
- Another board
Expected Behavior
Call the function and run the code obviously.
Actual Behavior
Calling function from main task results in Core panic Illegalnstruction with nothing insightful in register dump (last address executed is the address of called function - exception decoder points this to the line of code where function is defined. When i comment out everything in function, so it just returns without doing anything, i get LoadProhibited error, again with nothing insightful being reported by register dump - it reports last executed command as a class initializer, which is not even called in that function.
If I comment out that initializer, it again proceeds with error IllegalInstruction
Code to reproduce this issue
#include "adc-api.h"
extern "C" void app_main(void)
{
while(1){
vTaskDelay(1000/portTICK_PERIOD_MS);
setHeatRange(R33,CHAN2);
}
}
adc-api.h
enum heat_range_e {
R33,
R100,
R330,
R10
};
enum channels_e {
CHAN1,
CHAN2,
CHAN3,
CHAN4,
CHAN_MAX
};
extern esp_err_t setHeatRange(heat_range_e resi, channels_e channel);
adc-api.cpp
esp_err_t setHeatRange(heat_range_e resi, channels_e channel)
{
return ESP_OK;
}
Debug Logs
Guru Meditation Error: Core 0 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e6210: 00004136 00004136 f01d0070
0x400e6210: setHeatRange(heat_range_e, channels_e) at D:\STU\repos\model-gas\build/../components/adc-api/adc-api.cpp:122
Core 0 register dump:
PC : 0x400e6216 PS : 0x00060630 A0 : 0x800d6b30 A1 : 0x3ffc69c0
0x400e6216: esp_pm_impl_waiti at C:/Users/Dendo/esp/esp-idf/components/esp_pm/pm_impl.c:814
A2 : 0x00000000 A3 : 0x020035ac A4 : 0x3f4056f0 A5 : 0x000004c2
A6 : 0x3f402810 A7 : 0x3ffe3b80 A8 : 0x8008713e A9 : 0x3ffc69a0
A10 : 0x00000000 A11 : 0x000000be A12 : 0x3ffb47c4 A13 : 0x3ffb3f60
A14 : 0x00000005 A15 : 0x3ffb3f8c SAR : 0x00000004 EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xffffffff
Backtrace:0x400e6213:0x3ffc69c0 0x400d6b2d:0x3ffc69e0 0x400e69c8:0x3ffc6a00 0x400887e1:0x3ffc6a20
0x400e6213: setHeatRange(heat_range_e, channels_e) at ??:?
0x400d6b2d: app_main at D:\STU\repos\model-gas\build/../main/main.cpp:57 (discriminator 1)
0x400e69c8: main_task at C:/Users/Dendo/esp/esp-idf/components/freertos/port/port_common.c:133 (discriminator 2)
0x400887e1: vPortTaskWrapper at C:/Users/Dendo/esp/esp-idf/components/freertos/port/xtensa/port.c:168