Very unstable system after migrating to Arduino-ESP32 3.0.1

__xwtk
Posts: 4
Joined: Mon Feb 21, 2022 5:05 pm

Very unstable system after migrating to Arduino-ESP32 3.0.1

Postby __xwtk » Fri Jun 21, 2024 8:29 am

Hey everyone.

I have recently migrated from ESP-IDF 4 with Arduino-ESP32 2.x.x to ESP-IDF 5 with Arduino-ESP32 3.0.1. I have read the migration guide and changed everything that needed to be done to run smoothly, however the system runs very unstable, details:

Certain standard ESP libraries such as Arduino main.cpp, Preferences, HardwareSerial are modified in my projects due to specific demands. In Arduino main.cpp, I remove loopTask and subsequent components of it in esp32-hal-rmt and esp32-hal-misc, while leaving CONFIG_AUTOSTART_ARDUINO set to true. I additionally have a 1MB encrypted NVS partition, which is used to its extent, since NVS stores a map in memory, I have to "mount" and "unmount" it whenever I need it, so instead of using Preferences.begin and .end, I modified and added a few functions which would keep the desired namespace stored in the private variable, and whenever an operation is called the function would init the nvs partition, enter namespace and do the action, afterwards deinit. I additionally made mount and unmount functions in case I would need to do bulk NVS operations with additional checks to prevent issues. I have an Asyncwebserver running with mDNS in background.

This scheme works perfectly with Arduino-ESP32 2.x.x (ESP-IDF 4), I have about 90-100K free heap available while everything is running except NVS, and when I need to do NVS operations, I initialize, do the action, and quit to leave the heap free. But with ESP-IDF 5 (Arduino-ESP 3.0.1), things have changed. Now if I mount the NVS once and unmount, whenever I try to do any change I get nvs_init failed with error "OTHER" and subsequently nvs_open failed with error "NOT_INITALIZED". While webserver and mDNS is running, a lot of the times ssl fails to allocate memory (all requests are done in HTTPS with some exceptions), note that this was NOT the case with Arduino-ESP32 2.x.x. As well as seems like heap memory got a hit, while previously I had 90-100K free, I now have 60-70K with systems running, on paper that shouldn't be a problem but seems like it is?

I mainly want to use Arduino-ESP32 3 (ESP-IDF 5) because I don't like using outdated versions, plus I may want to utilize Zigbee support later on. My suspicions fall on ESP RainMaker and ESP Skainet, which I don't utilize at all and don't know how to remove from the project.

Who is online

Users browsing this forum: No registered users and 140 guests