ESP32 Rev 3 differences in memory allocation
Posted: Mon Nov 14, 2022 9:43 pm
I saw something strange and am left wondering if there are differences between older and newer ESP32 Rev 3 chips (WROVER-E module).
I have a product designed around the ESP32. Recently we made a new manufacturing run after about a year's time from the previous build. At the same time I implemented some firmware changes that used more internal heap memory and moved to IDF v4.4.2. My changes worked fine on the new boards but failed to run on the older boards. It turned out the xTaskCreate for the final task launched by main() was failing. I was able to modify my code to not use so much memory and the problem went away but I did some further experimentation on a body of boards and am left with a question about differences between the old ESP32 devices and the new ones.
I instrumented the code with heap_caps_print_heap_info(MALLOC_CAP_INTERNAL) and ran it after the system booted and hit a steady state. With the exception of WiFi (configured to prefer SPIRAM) most buffers and data structures are statically defined or malloc'd during start-up so there shouldn't be much variation when the system is in steady state after boot (idle). For my testing WiFi was enabled and connected to an access point but with no explicit traffic occurring.
I consistently saw that the older ESP32 Rev 3 chip systems showed slightly less free memory than the new ESP32 Rev 3 systems by about 400 bytes. There was some variation (+/- 50-60 bytes) on boards with the same generation ESP32 which I attributed the state of WiFi at the sample time.
So my question to those in the know is are there differences in the rev 3 ESP32 chips manufactured over time that would account for different memory usage? Or does someone have another explanation? It is clear there is a difference between the old and new boards (hardware otherwise the same and running the same IDF v4.4.2 built code).
I have a product designed around the ESP32. Recently we made a new manufacturing run after about a year's time from the previous build. At the same time I implemented some firmware changes that used more internal heap memory and moved to IDF v4.4.2. My changes worked fine on the new boards but failed to run on the older boards. It turned out the xTaskCreate for the final task launched by main() was failing. I was able to modify my code to not use so much memory and the problem went away but I did some further experimentation on a body of boards and am left with a question about differences between the old ESP32 devices and the new ones.
I instrumented the code with heap_caps_print_heap_info(MALLOC_CAP_INTERNAL) and ran it after the system booted and hit a steady state. With the exception of WiFi (configured to prefer SPIRAM) most buffers and data structures are statically defined or malloc'd during start-up so there shouldn't be much variation when the system is in steady state after boot (idle). For my testing WiFi was enabled and connected to an access point but with no explicit traffic occurring.
I consistently saw that the older ESP32 Rev 3 chip systems showed slightly less free memory than the new ESP32 Rev 3 systems by about 400 bytes. There was some variation (+/- 50-60 bytes) on boards with the same generation ESP32 which I attributed the state of WiFi at the sample time.
So my question to those in the know is are there differences in the rev 3 ESP32 chips manufactured over time that would account for different memory usage? Or does someone have another explanation? It is clear there is a difference between the old and new boards (hardware otherwise the same and running the same IDF v4.4.2 built code).