Very unstable system after migrating to Arduino-ESP32 3.0.01
xwtk opened this issue · comments
Board
ESP32-S3-WROOM-1-N8
Device Description
Custom hardware based on ESP32-S3-WROOM-1-N8 (240Mhz CPU set).
Hardware Configuration
GPIO 18, 19 allocated to HardwareSerial 1
Onewire BUS on GPIO 4
External accessory software power trigger on GPIO 5 (Output)
Recovery trigger on GPIO 42 (Input with Pullup)
Version
v3.0.1
IDE Name
Arduino as ESP-IDF component
Operating System
Ubuntu 24.04 on ARM (RPi 400)
Flash frequency
N/A
PSRAM enabled
no
Upload speed
N/A
Description
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.
Sketch
N/A
Debug Message
Provided in description
Other Steps to Reproduce
N/A
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.