Occasional crash writing to NVS

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Occasional crash writing to NVS

Postby fly135 » Sat Nov 03, 2018 4:56 pm

I'm finding my app occasionally rebooting while writing to NVS storage. The backtrace doesn't immediately reveal anything obvious that I'm doing wrong.

Code: Select all

0x4009682f:0x3ffb8b00 esp_clear_watchpoint
0x40096987:0x3ffb8b20 esp_clear_watchpoint
0x4010cc66:0x3ffb8b40 esp_ota_get_boot_partition
0x400efa3c:0x3ffb8b60 is_safe_write_address
0x40084b16:0x3ffb8b80 spi_flash_write
0x401d6703:0x3ffb8be0 Page::findItem
0x401d673d:0x3ffb8c10 Page::findItem
0x401d6a5a:0x3ffb8c30 Page::findItem
0x401d5b16:0x3ffb8ca0 nvs_get_used_entry_count
0x401d57fe:0x3ffb8d00 nvs_set_str
You have to read it from bottom to top. It looks like it's crashing while getting the current boot partition. I guess it's trying to make sure you don't write to the boot partition. If it's a stack overflow issue I usually see something that indicates that. Plus after 12 hours of run time the task calling the NVS write indicates a stack high water mark of 1K. And it writes this particular value (a float in string) to NVS every 10 minutes. I'm thinking of preventing the write if the value doesn't change much (it's the current temperature). But the counterpoint is if writing to NVS can occasionally crash the app I should investigate why.

Obviously I haven't given you any code to read. And I doubt it would help because it's a big application. But I'm throwing it out for ideas in case this rings a bell with anyone or they've seen the issue too. I'm not really confident that I haven't caused this somehow as it seems to just have popped up recently. :?:

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Occasional crash writing to NVS

Postby ESP_igrr » Mon Nov 05, 2018 1:52 am

Which IDF commit are you using? There was a related issue which was fixed recently in https://github.com/espressif/esp-idf/co ... 16946db5ae. The fix is also present in the latest 3.1.1 release.

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Occasional crash writing to NVS

Postby fly135 » Mon Nov 05, 2018 3:55 pm

ESP_igrr wrote:Which IDF commit are you using? There was a related issue which was fixed recently in https://github.com/espressif/esp-idf/co ... 16946db5ae. The fix is also present in the latest 3.1.1 release.
I'm using Release v3.1. Looks like I ran into that problem... Thanks!!!

John A

Who is online

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