Minimum heap necessary for OTA?

Leonos
Posts: 4
Joined: Wed Nov 28, 2018 8:16 am

Minimum heap necessary for OTA?

Postby Leonos » Wed Nov 28, 2018 8:33 am

I am building a weather station with all kinds of sensors, SD card etc. When the program is running it results in a reported free heap of only 114 kB. OTA does not work anymore but when I run the example BasicOTA, it works. The OTA code in my program is copy / paste from that example. Could it be that there is a minimum of RAM needed in order to let OTA work? And if so, how much is it?

Somewhat related to this: in Arduino and ESP8266 programs I was able to release a lot of memory by not using Serial.begin(), .print() etc. after debugging is done by using
#define DEBUG
#ifdef DEBUG
#define SP(x) Serial.print(x)
#define SPl(x) Serial.println(x)
#else
#define SP(x) {}
#define SPl(x) {}
#endif

and

#ifdef DEBUG
Serial.begin(115200);
#endif

That does not seem to make any difference in ESP32. Is that correct?

Thanks in advance for your advice.

Leonos
Posts: 4
Joined: Wed Nov 28, 2018 8:16 am

Re: Minimum heap necessary for OTA?

Postby Leonos » Fri Nov 30, 2018 7:58 am

I moved the SC card initialisation part out of setup() into a function so it only gets loaded when needed. I also disabled Bluetooth and reclaimed its memory so now I am north of 220 kB free again. OTA works fine now. It would be nice to know the minimum required, though.

And I still wonder about Serial, not freeing up memory when not used. Any ideas?

Who is online

Users browsing this forum: No registered users and 61 guests