Espressif software reset load unhanled

pablo1610
Posts: 7
Joined: Thu Oct 28, 2021 9:10 am

Espressif software reset load unhanled

Postby pablo1610 » Fri Nov 12, 2021 11:04 am

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

ESP_Sprite
Posts: 9724
Joined: Thu Nov 26, 2015 4:08 am

Re: Espressif software reset load unhanled

Postby ESP_Sprite » Sat Nov 13, 2021 5:43 am

That's hard to say. Can you post the entire error, if possible including the backtrace?

pablo1610
Posts: 7
Joined: Thu Oct 28, 2021 9:10 am

Re: Espressif software reset load unhanled

Postby pablo1610 » Mon Nov 15, 2021 8:32 am

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.
  1. Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
  2.  
  3. Core  0 register dump:
  4. PC      : 0x400d8000  PS      : 0x00060330  A0      : 0x800d83f8  A1      : 0x3ffba6c0
  5. 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
  6.  
  7. A2      : 0x00000000  A3      : 0x00000041  A4      : 0x3f4048b4  A5      : 0x3ffb5d8c
  8. A6      : 0x00000020  A7      : 0x00000001  A8      : 0x800d7ff0  A9      : 0x3ffba6a0
  9. A10     : 0x00000000  A11     : 0x00000041  A12     : 0x3f4048b4  A13     : 0x3ffba6c4
  10. A14     : 0x00000000  A15     : 0x00000001  SAR     : 0x00000018  EXCCAUSE: 0x0000001c
  11. EXCVADDR: 0x00000020  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0x00000000
  12.  
  13. Backtrace:0x400d7ffd:0x3ffba6c0 0x400d83f5:0x3ffba6f0 0x400d6a30:0x3ffba710 0x4013db3d:0x3ffbab40 0x4008bc31:0x3ffbab60
  14. 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
  15.  
  16. 0x400d83f5: nvs_get_blob at D:/esp-idf/components/nvs_flash/src/nvs_api.cpp:514
  17.  
  18. 0x400d6a30: app_main at C:\Users\Usuario11\eclipse-workspace\hello_world\build/../main/hello_world_main.c:57 (discriminator 13)
  19.  
  20. 0x4013db3d: main_task at D:/esp-idf/components/freertos/port/port_common.c:133 (discriminator 2)
  21.  
  22. 0x4008bc31: vPortTaskWrapper at D:/esp-idf/components/freertos/port/xtensa/port.c:168
  23.  

pablo1610
Posts: 7
Joined: Thu Oct 28, 2021 9:10 am

Re: Espressif software reset load unhanled

Postby pablo1610 » Tue Nov 16, 2021 8:20 am

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:
  1. char *ssid = malloc(20 + sizeof(uint32_t))
  2. char wifi_ssid[20];
  3.  
  4. err = nvs_get_blob(my_handle, "ssid", ssid, &size_req );
  5. 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

ESP_Sprite
Posts: 9724
Joined: Thu Nov 26, 2015 4:08 am

Re: Espressif software reset load unhanled

Postby ESP_Sprite » 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.

pablo1610
Posts: 7
Joined: Thu Oct 28, 2021 9:10 am

Re: Espressif software reset load unhanled

Postby pablo1610 » Tue Nov 16, 2021 9:36 am

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.

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 83 guests