Go Down

Topic: Increase flash memory Arduino UNO (Read 17669 times) previous topic - next topic

ClaudioRadu

Hi everybody,
I have an arduino UNO and  I've written a code more than 32Kb that Arduino have on his flash memory, I've buyed an arduino ethernet shield wich has a memory extender for micro SD cards, is there a way to increase it's 32 Kb or another method in order to run my code wich is greater than 32 Kb on Arduino UNO ?
Claudio

MichaelMeissner

It isn't really possible with an Uno, since I don't believe it has any way of extending program memory.  If you have filled up your program memory with strings and read-only data using PROGMEM, you could move these to using a micro-SD card, and read in the values when you need them, or use a i2c/spi memory expansion chip instead of the micro-Sd card.  You would have to restructure the program, and move even more out to external memory, as the libraries to access these devices will take space.

A much simpler solution is to use a Mega 2560, which has 256K of program memory, instead of 32K (and 8K of SRAM memory instead of 2K).

Or if you can run your devices at 3.3v instead of 5v, the Teensy 3.1 (which uses an Arm processor instead of the AVR processors used in the Uno/Mega) also has 256K of program memory (and 64K of SRAM memory).  Similarly, the Arduino Due has 512K of program memory and 96K of SRAM.

robtillaart

many programs can be coded more efficiently, e.g. by removing all float math from it

Is you code (partial) reviewed to see if it can be optimized?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

ClaudioRadu

Hi boys thanks for answers.
@MichaelMeissner  I'll consider moving to Mega 2560.

@robtillaart:  I don't wanna be silly, but I'm a programmer and the code unfortunately can't be optimized more I have double-checked it.

NI$HANT

You can use a serial SPI flash and the library is already there here >https://github.com/LowPowerLab/SPIFlash
"Real Men can Accomplish  Anything"

- skype : nishants5  
ਫ਼ਤੇਹ ਕਰੁਂ!
www.winacro.com

NI$HANT

Also you do not need to definitely upgrade to a ATmega2560 arduino that has over 200kb of flash rather than you can also go for ATmega1284/1280 based designs!  thats half the falsh memory soit means saving money if not much but yes saving that god damn hard earned bucks! or maybe go for ATmega644 etc.

Talk with CrossRoads a respected forum senior member you should try his boards ,they are dependable and comes in green and yellow colors!
"Real Men can Accomplish  Anything"

- skype : nishants5  
ਫ਼ਤੇਹ ਕਰੁਂ!
www.winacro.com

Akbarpulatov


It isn't really possible with an Uno, since I don't believe it has any way of extending program memory.  If you have filled up your program memory with strings and read-only data using PROGMEM, you could move these to using a micro-SD card, and read in the values when you need them, or use a i2c/spi memory expansion chip instead of the micro-Sd card.  You would have to restructure the program, and move even more out to external memory, as the libraries to access these devices will take space.

A much simpler solution is to use a Mega 2560, which has 256K of program memory, instead of 32K (and 8K of SRAM memory instead of 2K).

Or if you can run your devices at 3.3v instead of 5v, the Teensy 3.1 (which uses an Arm processor instead of the AVR processors used in the Uno/Mega) also has 256K of program memory (and 64K of SRAM memory).  Similarly, the Arduino Due has 512K of program memory and 96K of SRAM.


Good day!
I have this kind of problem, i have sensors, and need some external space, so how can i connect micro SD card and use it? Thanks in advance for answer.

GhostSO2ao2

If you have a lot of big strings, integers, pics, files or files just read your code from the sd when ever possible to save space.

Else you could use the rx/tx to link another Arduino together. 

What i usually do is create a dat file and read the info from the SD card on the Arduino.   

ejonesss

many programs can be coded more efficiently, e.g. by removing all float math from it

Is you code (partial) reviewed to see if it can be optimized?
while writing a program for my uno i found i can use 0 for low and 1 for high so eliminating 5 letters does not sound like much but take a blinking led for example that is 10 letters less you need to use

so instead of

digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second


you use

digitalWrite(13, 1);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(13, 0);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second





it may be possible to use variables so you dont have to repeat so much.

Delta_G

while writing a program for my uno i found i can use 0 for low and 1 for high so eliminating 5 letters does not sound like much but take a blinking led for example that is 10 letters less you need to use

so instead of

digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second


you use

digitalWrite(13, 1);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(13, 0);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second





it may be possible to use variables so you dont have to repeat so much.
That doesn't save code space, just space on your screen and makes the code harder to read. 

HIGH and LOW are #define to 1 and 0.  So before the compiler ever sees the code they get replaced and the code that goes to the compiler ends up looking just like what you wrote here. 

It's instructions that matter to code size, not letters of text.  Unless, of course, those letters are part of string variables.  Instructions, not lines of code, remember that one line of code often translates to many many many machine instructions. 
Ad hoc, ad loc, and quid pro quo.  So little time - so much to know!  ~Jeremy Hillary Boob Ph.D

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy