Sanguino variant

Setting up a Sanguino w/644P with an Arduino ISP

I’ve recently killed the Atmega328p chip on my Arduino Duemilanove board. (I accidentally touched a 2000mA power source to one of the output pins….)

Instead of buying a replacement chip I’ve decided to get the Atmega 644P and reuse my old Duemilanove board for USB and Power. 644P has more IO pins, more program memory and more SRAM.

Here are the full specs: DataSheet ATmega644P

I made a Sanguino variant with an ATmega644P on a perf-board as shown here: Sanguino Schematics. I only want to power the 644P chip and have an external oscillator.

This is a minimalist version without the voltage regulator circuitry and only the ICSP header. Everything will be powered and programmed by the old board. I’ve inserted an Atmega8 into the Arduino Duemilanove and flashed a Boot Loader using the BitBang method described below and uploaded the ArduinoISP sketch.

Tasks to be done:

1. Burn Boot Loader to the 644P chip
1.1 Burning via FT232RL BitBang Mode
1.2 Burning via Arduino as ISP

2. Upload the Blink sketch
2.a. Manually
2.b. via Arduino IDE

1. Burn Boot Loader to the 644P chip

1.1 Burning via FT232RL BitBang Mode

An extensive tutorial on the subject:

After installing “avrdude-serjtag” according to the tutorial, open up a terminal and try to read the signature of the 644p chip.

avrdude -c diecimila -p m644p -P ft0

If you can’t get a connection try -B 4800 (worked for me)

You can now copy the file ATMEGABOOT_644p.hex into the bin directoryof avrdude and flash it to the chip.

avrdude -c diecimila -p m644p -P ft0 -B 57600 -U flash:w:atmegaBOOT_644p.hex

Reset your board after detaching the ICSP. The debug LED should blink. (probably 3 times in about 6-8 seconds)

1.2 Burning via Arduino as ISP

You can check a tutorial on it here: ArduinoISP

!!! Upload the ArduinoISP sketch: Remember to upload the Examples/ArduinoISP sketch to your controller board. (You will use this to communicate with the Sanguino) This will turn your Arduino board into an avrisp programmer.

!!! You need to disable AutoResetOnSerialConnection Here is more info: DisablingAutoResetOnSerialConnection

For me I just put a 10uF cap to the 3.3v and the Reset pin but the 120 resistor works too. (make sure you get the polarity right)

Now try to get the signature of the device:

avrdude -p m644p -c avrisp -P com5 -b 19200 -V

You should get something like this. This guarantees a correct read.

You should get the Sanguino folder and copy it into Arduino IDE/hardware/

You might need the 644p profile for avrdude.conf and the ATmegaBOOT_644P.hex

You can now flash the chip manually with avrdude or via Arduino IDE.

a.) Manually

avrdude -p m644p -c avrisp -P com5 -b 19200 -V -U flash:w:atmegaBOOT_644p.hex

You should get a confirmation at the end that all went well.

b.) via Arduino IDE.

To burn the bootloader you need to edit boards.txt files in the Hardware/Sanguino folder and change the content to this:

[code] (w ArduinoISP)

In Arduino IDE go to Boards and select Sanguino (w ArduinoISP). Now go to Tools/Burn Bootloader/w Arduino ISP. All should go well.

2. Upload the blink sketch

Here is a small modified version of the sketch to loop through all the output pins and blink them.

void setup() {
for(int i=0;i<32;i++) {
pinMode(i, OUTPUT);

void loop() {
for(int i=0;i<32;i++) {
digitalWrite(i, HIGH); // set the LED on
digitalWrite(i, LOW); // set the LED off

Make sure you have AutoResetOnSerialConnection disabled and that you get a correct signature read.

If you don’t you will get an error like this:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9307
avrdude: Expected signature for ATMEGA644P is 1E 96 0A
Double check chip, or use -F to override this check.

avrdude done. Thank you.

Or worse yet you might attempt to use the -F option and overwrite something on your main chip. Remember that if you mess up anything you can always use the ftdi bitbang method to re-flash the bootloaders to your chips.

All you need to do now is to choose Sanguino(w ArduinoISP) from your boards menu and click upload. All should be OK.