After countless hours trying to debug my 'was working fine with MEGA' code, i have diagnosed the issue to my SRAM. I except that my code (a combination of NTPClient, EthernetClient & various sensor readings that cover all available pins), is maybe too much work for the UNO & will be switching over to the MEGA.
However, during the debug i used free_ram() function below:
int free_ram()
{
extern int __heap_start, *__brkval;
int v;
return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}
The output, with just the function in the source was around 1800 mark (about right if the UNOs limit is 2k). When i used this function with the full code, it read at -351. i expected 0 (zero) or above...
(in case the reader is interested, the MEGA's free_ram output was 7463)
My question is simple, what is the lowest limit reading of SRAM, using the function detailed?
__brkval
and__heap_start
are after local variables in memory, which may not be true for the Mega. \$\endgroup\$