I am new to ESP32 and started to write a code to create a TCP/IP server which would receive commands and send answers over Wi-Fi.
Setup:
Kit: ESP32-S3-DevKitC-1
IDE: PlatformIO
Framework: Arduino (I found the Arduino libraries useful as they seems to provide very high level functionality requiring minimum code to write and minimum knowledge about what happens in depth)
Sometimes the module is running fine for a few hours and sometimes the same code seems to be generating Guru meditation errors even multiple in less than 1 minute. These errors are often different. Most of them backtrace to Wi-Fi Arduino framework and sometimes to my own code. Sometimes the backtrace is corrupted.
QUESTION: Is the backtrace showing the real problem or can the problem be unrelated to the backtrace? Would anybody have an idea why the code seems to be failing almost always in a different location of the code? Could it be because of high module consumption whist being powered from a the USB of a PC? (I would try to power is separately but I need to think how as the PCB doesn't have a dedicated pin for external power supply)
I will post here one error/backtrace:
Below is the code referenced by backtrace #1:Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x4200afa0: 03bdf01d 00fffa44 c8c033c8
Core 1 register dump:
PC : 0x4200afa4 PS : 0x00060930 A0 : 0x82003189 A1 : 0x3fce2bc0
A2 : 0x3fce2c68 A3 : 0x3fc98d98 A4 : 0xdf15350f A5 : 0x00000000
A6 : 0x3fcf3900 A7 : 0x00000000 A8 : 0x00000080 A9 : 0xffffff80
A10 : 0x3fce2c90 A11 : 0x3fc98d98 A12 : 0x3fce2c90 A13 : 0x0000ff00
A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x00000014 EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x400556d5 LEND : 0x400556e5 LCOUNT : 0xffffffff
Backtrace:0x4200afa1:0x3fce2bc00x42003186:0x3fce2be0 0x42004b01:0x3fce2c60 0x42005142:0x3fce2d00 0x4200d821:0x3fce2d20
#0 0x4200afa1:0x3fce2bc0 in String::operator=(String const&) at C:/Users/mariusrusu/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.cpp:303
#1 0x42003186:0x3fce2be0 in CmdParser::getCommand() at src/CmdParser.cpp:20
#2 0x42004b01:0x3fce2c60 in readAndHandleCommands() at src/main.cpp:194
#3 0x42005142:0x3fce2d00 in loop() at src/main.cpp:152
#4 0x4200d821:0x3fce2d20 in loopTask(void*) at C:/Users/mariusrusu/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:50
Code: Select all
17 CmdStruct CmdParser::getCommand(){
18 CmdStruct cmd;
19 cmd.available = false; //presume command is available
20 cmd.title = emptyString; <-- BACKTRACE #1
21 cmd.body = emptyString;
22 cmd.param = 0;
23 cmd.hasParam = false; //presume command does not have param
24 cmd.error = emptyString;
Code: Select all
struct CmdStruct{
bool available;
String title;
String body;
float param;
bool hasParam;
String error;
};
Code: Select all
293 String & String::operator =(const String &rhs) {
294 if(this == &rhs)
295 return *this;
296
297 if(rhs.buffer())
298 copy(rhs.buffer(), rhs.len());
299 else
300 invalidate();
301
302 return *this;
303 } <--- BACKTRACE #0
...
916 // global empty string to allow returning const String& with nothing
917
918 const String emptyString;