Skip to main content

Arduino Duemilanove and the SD Card Reader

 

Arduino Duemilanove and the SD Card Reader

The second Arduino board that I tried to get the SD Card Readers to work on was the Duemilanove, an old, cheap, small board that was my introduction to Arduino back around 2010 or so.

 
Arduino Duemilanove

I set up the Arduino IDE with the correct board, processor and comm port…

Duemilanove, ATmega168 and COM14 in this case.

 
Duemilanove Setup

Notice that the comm port changes each time we plug a board with a different type of USB to Serial chip on it.

I ran into problems immediately with this board. While it is pretty much pin-compatible with the Arduino Uno, it uses a smaller processor, and has much less storage and memory available.

When I attempted to compile the CardInfo code for the Duemilanove, it came up with a memory error right away.

 
SRAM Memory Error

Sketch uses 10676 bytes (74%) of program storage space. Maximum is 14336 bytes.

Global variables use 1434 bytes (140%) of dynamic memory, leaving -410 bytes for local variables. Maximum is 1024 bytes.
Not enough memory; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing your footprint.
Error compiling for board Arduino Duemilanove or Diecimila.

The Arduino Uno has 32kb of Flash Memory (where your sketch is stored), of which 2kb is used for the bootloader.  It has 2kb of SRAM memory (where variables are stored).

The Arduino Duemilanove has half this amount of Flash Memory at 16kb (where your sketch is stored), of which 2kb is used for the bootloader.  It has half the amount of SRAM memory at 1kb(where variables are stored).

While I may be able to work with the program using 74% of memory space available, there is no way around running over the SRAM (dynamic memory).  I am only loading the libraries that are needed for the CardInfo program (SD and SPI), and have very few additional variables declared globally.

Now a really smart programmer could probably dissect the libraries and hand code sections to cover only the very basic necessity of the program, but I wouldn’t expect students to go through that process in this day and age.  Back when a new processor with the power of the Arduino Uno costs many thousands of dollars (in the 70’s), we used machine code, or at most assembly language to write very efficient programs.  But now we can buy a more powerful processor for about $20 or less, so there is no need to go to such extremes.

So anyway, if anyone is trying to run programs that need to write or read from SD Cards, I would suggest upgrading from the Duemilanove with its ATmega168 processor and 1kb of static ram.

Microcontroller ATmega168
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 16 KB (ATmega168) or 32 KB (ATmega328) of which 2 KB used by bootloader
SRAM 1 KB (ATmega168) or 2 KB (ATmega328)
EEPROM 512 bytes (ATmega168) or 1 KB (ATmega328)
Clock Speed 16 MHz

On to the next one…

Comments

Popular posts from this blog

APRS I-Gate

Yaesu G-450XL Rotator Repair

ERC-4 Interface & My HyGain Ham-IV Rotator Controller – Part 3