Saur0o0n / PIDKiln

Kiln PID controller based on Espressif Systems ESP32 chip board with Arduino IDE.
GNU General Public License v2.0
102 stars 38 forks source link

Guru Meditation Error: Core 1 panic'ed (StoreProhibited) #38

Closed codilau closed 1 year ago

codilau commented 1 year ago

Hello, thanks for the great work, I love yout project for its light weigth and use of the great ESP32, coming from a PID based on PicoReflow, running on the hard to find Rpis I can really appreciate our cheap light Esps.

I ran into a problem though and can't wrap my head around it. As the title suggests, execution halts with this error at the moment on loading a program, either from the SPIFFS or from the web interface.

192.168.1.110 [PRG] Loading directory... [PRG] counted 2 files [PRG] Processing filename: index.html [PRG] Processing filename: program1.txt Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled.

Core 1 register dump: PC : 0x4008a6f2 PS : 0x00060130 A0 : 0x800da3b5 A1 : 0x3ffb2620
A2 : 0x00000000 A3 : 0x3ffb2690 A4 : 0x000000ff A5 : 0x0000ff00
A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x676f7270 A9 : 0x00000069
A10 : 0x00000000 A11 : 0x3ffd6bbc A12 : 0x3f401dfd A13 : 0x3ffb2610
A14 : 0x3ffb25e0 A15 : 0x00000008 SAR : 0x0000001e EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000000 LBEG : 0x4008a6e5 LEND : 0x4008a6f9 LCOUNT : 0xffffffff

Backtrace:0x4008a6ef:0x3ffb26200x400da3b2:0x3ffb2630 0x400da560:0x3ffb26d0 0x400dad84:0x3ffb27b0 0x400eb7e2:0x3ffb2820

I traced this back with the exception decoder:

PC: 0x4008a6f2 EXCVADDR: 0x00000000

PC: 0x4008a6f2 EXCVADDR: 0x00000000

Decoding stack results 0x400da3b2: Load_programs_dir() at D:\1.PROG\PIDKiln/PIDKiln_program.ino line 157 0x400da560: Generate_INDEX() at D:\1.PROG\PIDKiln/PIDKiln_http.ino line 204 0x400dad84: setup() at D:\1.PROG\PIDKiln/PIDKiln.ino line 166 0x400eb7e2: loopTask(void*) at C:\Users\alexl\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32\main.cpp line 42

The culprit seems to be

0x400da3b2: Load_programs_dir() at D:\1.PROG\PIDKiln/PIDKiln_program.ino line 157 which is this line:

strcpy(Programs_DIR[Programs_DIR_size].filename,tmp);

But that's where my knowledge ends. Any ideas to make this work?

codilau commented 1 year ago

Al right, it's not that evident in my opinion but it's due to using a board without PSRAM, hint taken from reading the changelog of v1.2 Modified the malloc definition and it's all good. Thanks for your work and hope to see this firmware goind forward!