Arduino UNO SRAM

Hi all
Have a nice day :smiley:

I worked with ATmega328 with UNO bootloader that is connected to Keypad an LCD , but when my code become bigger (about 18 KB out of 32 KB from flash memory) the SRAM is occupied with percentage (77%, From IDE 1.6.0), because of that the code didn't work correctly.

I think to use two IC's ATmega328 but it doesn't a sufficient solution because i will add a hradware with 2 KB only.

So what do you think to solve this problem?

best regards
:slight_smile:

Post your code by attaching it to your post rather then trying to paste it into a code box. People here will probably be able to help in reducing your SRAM usage by suggesting changes like...
Avoid using the String class as it fragments memory and will probably cause crashes after some time.
Store text strings in flash memory instead of SRAM. So serial.print("A simple text string"); becomes serial.print(F("A simple text string"));. The F() macro will store the string in flash instead of SRAM. Maybe lots of other data can also be stored in flash.

Hi Riva

I removed all unusable "Serial.print" command and i used the "F()" command as you said, then the SRAM percentage = 27% :smiley:

i would like to ask of the benefit of use external SRAM like 23K256 chip ?

thank you for answering

palmood:
Hi Riva

I removed all unusable "Serial.print" command and i used the "F()" command as you said, then the SRAM percentage = 27% :smiley:

i would like to ask of the benefit of use external SRAM like 23K256 chip ?

thank you for answering

Glad you managed to reduce SRAM usage so easily.
The only benefit of using external SRAM on an UNO that I can think of is if your storing a lot of temporary data (maybe from sensor readings) as you cannot map the external SRAM chips memory into the UNO SRAM memory space to increase the 2K limit.