ESP32 hangs after a few days
Posted: Fri Sep 13, 2024 3:23 pm
I have an Adafruit HUZZAH32 ESP32 MCU that gathers the following data from a domestic water tank: water level, temperature, humidity and LiPo battery voltage. This data is printed to a 16x2 LCD. It also sends daily texts three times a day and if the water level drops below eight (8) feet, it sends a low water level text.
Startup is always normal - no issues, but after a few days of operation the unit quits completely. I have never been in the pump house when this happens so I do no know exactly what happens. The only way that I become aware of this malfunction is when the daily reports are not sent at their preset times.
Startup IDE info is as follows:
As I understand it, the above data is FLASH memory usage, not PSRAM info.
I think that my Heap and Stack memory data are overlapping and corrupting the data thus shutting down the MCU.
I currently have a sketch that reports numerical data from the following calls:
- ESP.getHeapSize()
- ESP.getFreeHeap()
- ESP.getMinFreeHeap()
I have also tried getting data from the following calls:
- ESP.getPsramSize()
- ESP.getFreePsram()
- ESP.getMinFreePsram()
- ESP.getMaxAllocPsram()
The latter Psram calls all return a value of '0'. These are the memory calls that I would like to get data back from.
Do anyone know why these calls return zeros?
Sample START data is as follows:
Sample ENDING data (after three(3) hours of run time) is as follows:
If someone can show me how to get SPRAM data I would be most grateful.
Thank you.
Startup is always normal - no issues, but after a few days of operation the unit quits completely. I have never been in the pump house when this happens so I do no know exactly what happens. The only way that I become aware of this malfunction is when the daily reports are not sent at their preset times.
Startup IDE info is as follows:
Code: Select all
Sketch uses 1058985 bytes (80%) of program storage space. Maximum is 1310720 bytes.
Global variables use 47816 bytes (14%) of dynamic memory, leaving 279864 bytes for local variables. Maximum is 327680 bytes.
I think that my Heap and Stack memory data are overlapping and corrupting the data thus shutting down the MCU.
I currently have a sketch that reports numerical data from the following calls:
- ESP.getHeapSize()
- ESP.getFreeHeap()
- ESP.getMinFreeHeap()
I have also tried getting data from the following calls:
- ESP.getPsramSize()
- ESP.getFreePsram()
- ESP.getMinFreePsram()
- ESP.getMaxAllocPsram()
The latter Psram calls all return a value of '0'. These are the memory calls that I would like to get data back from.
Do anyone know why these calls return zeros?
Sample START data is as follows:
Code: Select all
14:19:25.561 -> ... HEAP SIZE is 332352
14:19:25.561 -> ... Free heap memory is 200792
14:19:25.596 -> ... MIN FREE HEAP is 195704
14:19:25.596 -> ... MAX ALLOC HEAP is 110580
14:19:25.596 -> ... Free heap SIZE is 153628
14:19:25.596 ->
14:19:25.596 -> ... SPRAM SIZE is 0
14:19:25.596 -> ... FREE SPRAM SIZE is 0
14:19:25.596 -> ... MIN FREE SPRAM is 0
14:19:25.596 -> ... MAX ALLOC SPRAM is 0
Sample ENDING data (after three(3) hours of run time) is as follows:
Code: Select all
17:06:59.642 -> ... HEAP SIZE is 332352
17:06:59.642 -> ... Free heap memory is 181664
17:06:59.642 -> ... MIN FREE HEAP is 127388
17:06:59.642 -> ... MAX ALLOC HEAP is 81908
17:06:59.642 -> ... Free heap SIZE is 134236
17:06:59.642 ->
17:06:59.642 -> ... SPRAM SIZE is 0
17:06:59.642 -> ... FREE SPRAM SIZE is 0
17:06:59.642 -> ... MIN FREE SPRAM is 0
17:06:59.642 -> ... MAX ALLOC SPRAM is 0
Thank you.