Page 1 of 1
Espressif software reset load unhanled
Posted: Fri Nov 12, 2021 11:04 am
by pablo1610
Hi all,
Currently I'm developing a C program to run in the Espressif. The first time I start the program well, but when I do a software reset the Espressif gets stuck in an error loop with the next error code:
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
I don't know what it is the sentence causing this problem, because the first time the program runs, it is doing it correctly.
Thank you,
Pablo
Re: Espressif software reset load unhanled
Posted: Sat Nov 13, 2021 5:43 am
by ESP_Sprite
That's hard to say. Can you post the entire error, if possible including the backtrace?
Re: Espressif software reset load unhanled
Posted: Mon Nov 15, 2021 8:32 am
by pablo1610
ESP_Sprite wrote: ↑Sat Nov 13, 2021 5:43 am
That's hard to say. Can you post the entire error, if possible including the backtrace?
The problem happens when I do the nvs_get_blob instrucction. The first time Ithe program executes it, it does it well, but when the espressif reboots, the error happens. I do the nvs initialization as it is explained in the nvs eclipse example.
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x400d8000 PS : 0x00060330 A0 : 0x800d83f8 A1 : 0x3ffba6c0
0x400d8000: nvs_get_str_or_blob(unsigned int, nvs::ItemType, char const*, void*, unsigned int*) at D:/esp-idf/components/nvs_flash/src/nvs_api.cpp:498
A2 : 0x00000000 A3 : 0x00000041 A4 : 0x3f4048b4 A5 : 0x3ffb5d8c
A6 : 0x00000020 A7 : 0x00000001 A8 : 0x800d7ff0 A9 : 0x3ffba6a0
A10 : 0x00000000 A11 : 0x00000041 A12 : 0x3f4048b4 A13 : 0x3ffba6c4
A14 : 0x00000000 A15 : 0x00000001 SAR : 0x00000018 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000020 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000
Backtrace:0x400d7ffd:0x3ffba6c0 0x400d83f5:0x3ffba6f0 0x400d6a30:0x3ffba710 0x4013db3d:0x3ffbab40 0x4008bc31:0x3ffbab60
0x400d7ffd: nvs_get_str_or_blob(unsigned int, nvs::ItemType, char const*, void*, unsigned int*) at D:/esp-idf/components/nvs_flash/src/nvs_api.cpp:497
0x400d83f5: nvs_get_blob at D:/esp-idf/components/nvs_flash/src/nvs_api.cpp:514
0x400d6a30: app_main at C:\Users\Usuario11\eclipse-workspace\hello_world\build/../main/hello_world_main.c:57 (discriminator 13)
0x4013db3d: main_task at D:/esp-idf/components/freertos/port/port_common.c:133 (discriminator 2)
0x4008bc31: vPortTaskWrapper at D:/esp-idf/components/freertos/port/xtensa/port.c:168
Re: Espressif software reset load unhanled
Posted: Tue Nov 16, 2021 8:20 am
by pablo1610
Hi all,
I have found a solution to this error. The problem was related to the destination buffer for the function nvs_get_blob. Although the output buffer was initialized, it looks like the Espressif does't like it.
I have created a pointer to a reserved memory space:
char *ssid = malloc(20 + sizeof(uint32_t))
char wifi_ssid[20];
err = nvs_get_blob(my_handle, "ssid", ssid, &size_req );
memcpy(wifi_ssid,ssid,20);
Now it is working perfectly, I don't know why in this case using a defined variable as the buffer output it doesn't work.
Thanks,
Pablo
Re: Espressif software reset load unhanled
Posted: Tue Nov 16, 2021 9:22 am
by ESP_Sprite
That should work... are you sure size_req is also initialized? Also note that nvs_get_blob doesn't necessarily return a null-terminated string; that could lead to issues.
Re: Espressif software reset load unhanled
Posted: Tue Nov 16, 2021 9:36 am
by pablo1610
ESP_Sprite wrote: ↑Tue Nov 16, 2021 9:22 am
That should work... are you sure size_req is also initialized? Also note that nvs_get_blob doesn't necessarily return a null-terminated string; that could lead to issues.
Yes, the variable was initializaed to 20 (uint32_t size_req = 20;), also before I found the solution to the problem, that variable was initializaed.