Page 2 of 2
Re: Please help me with ESP32 Guru meditation error core 0
Posted: Thu Mar 21, 2019 2:24 pm
by FeherAron6
The strings are global variables
Code: Untitled.c Select all
char str_data[5], str_topic[11];
char flag_topic[11] = {'t','o','d','e','v','/','f','l','a','g','s'};
char ref_topic[9] = {'t','o','d','e','v','/','r','e','f'};
.
Re: Please help me with ESP32 Guru meditation error core 0
Posted: Mon Mar 25, 2019 4:07 am
by Sprite
Just guessing here, as I'm not that familiar with the mqtt code, but are you sure the topic and data are zero-terminated? If not, the strcpy will copy lots of bytes, overwriting lots of static data.
Re: Please help me with ESP32 Guru meditation error core 0
Posted: Mon Mar 25, 2019 10:16 am
by FeherAron6
It is not zero terminated - or at least the payload is certainly not. When I send the data "todev/flags" from node-red, the esp32 sees it as a char array of length 11. That is why I had to compare it to the string shown in the previous reply, but I've used strncmp for the most part.
Are you saying that I should change the topic and data copy lines from strcpy to strncpy? I could measure the maximum string length in node-red, and use that value for every copy.
Re: Please help me with ESP32 Guru meditation error core 0
Posted: Tue Mar 26, 2019 4:01 pm
by FeherAron6
Just guessing here, as I'm not that familiar with the mqtt code, but are you sure the topic and data are zero-terminated? If not, the strcpy will copy lots of bytes, overwriting lots of static data.
This was the problem. I've replaced the
Code: Untitled.c Select all
strcpy(str_topic, event->topic);
strcpy(str_data, event->data);
lines with
Code: Untitled.c Select all
strncpy(str_topic, event->topic, event->topic_len);
strncpy(str_data, event->data, event->data_len);
and everything works as intended.
Thank you so much for these invaluable responses. I've learnt a lot in these few days.
Re: Please help me with ESP32 Guru meditation error core 0
Posted: Wed Mar 27, 2019 2:22 am
by Sprite
Nice. Note that if you use strncpy, str_topic and str_data themselves also won't be null-terminated, so if your later code assumes they are, you'll have the same issues all over again. Perhaps it's an idea to null-terminate them yourself so you'll at least not have that trap to fall down in.
Re: Please help me with ESP32 Guru meditation error core 0
Posted: Wed Apr 10, 2019 3:02 pm
by Alan Collins
I have the same issue, while using simple "Hello World" example from platformIO. This is part of the LOG I get from console:
Guru Meditation Error: Core 0 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400d2c40: 775f2289 dd55d557 57f7d755
Core 0 register dump:
PC : 0x400d2c47 PS : 0x00060130 A0 : 0x800d2cb5 A1 : 0x3ffe3930
A2 : 0x3ffe3970 A3 : 0x3ffc0000 A4 : 0x3ffc3050 A5 : 0x3ffe3970
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x0000002c A9 : 0x3ffe3bb0
A10 : 0x0000000a A11 : 0x00000000 A12 : 0x00000000 A13 : 0x00002000
A14 : 0x3ffe3ba7 A15 : 0x00000200 SAR : 0x00000005 EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000
As, you can see PC is located in 0x400d2c47
Looking into my .map file, I see the code is happening inside the .pioenvs\esp32dev\libheap.a(heap_caps_init.o)
This data is persistent if I use the HelloWorld, or my application. Both fail with Ilegal instruction at the Lebheap library.
This problem is not happened in the ESP32-WROOM-32, but happens with ESP32-WROOM-32D, which is supposed to be the same.
I continue my debug. I´ll keep you posted in my findings.
Re: Please help me with ESP32 Guru meditation error core 0
Posted: Thu Apr 11, 2019 5:33 am
by Sprite
You may want to investigate your power supply; sometimes these errors originate in a brownout.
Re: Please help me with ESP32 Guru meditation error core 0
Posted: Sat Apr 13, 2019 9:58 am
by Ritesh
You may want to investigate your power supply; sometimes these errors originate in a brownout.
Hi,
We are also recomanding to use at least 5V 1 Amp into our device in which we have used ESP32 Module.