0

Hack a Decimila to program its bootloader via onboard USB
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Hack a Decimila to program its bootloader via onboard USB

by darus67 on Sat Feb 09, 2008 6:50 pm

This is a continuation of a thread I started in another topic.

Over there I wrote:
I was wondering if it would be possible to hack an Arduino board so
that the on-board USB-to-Serial chip could double as a built-in
in-circuit programmer

Here was my train of thought...

If I have an arduino board and a BLANK ATMega168 chip, I need an external
programmer to burn the bootloader onto the ATM168.

The programming circuitry on the MiniPOV3 can be used as an external
programmer, to program the ATM168.

In my case, I use a USB to serial dongle with my MiniPOV3.

The Arduino board already has a USB to Serial chip on board.

Could I hack an Arduino board so that the on-board usb-to-serial chip
could be used to program a BLANK ATM168 chip in situ, rather than
hooking up an external programmer?

Then, once the (formerly blank) ATM168 has the Arduino bootloader
burned on it, I can go ahead and use the regular Arduino software
to load sketches via the bootloader.


I started by comparing the schematics of the MiniPOV3 and the
Arduino Decimila and determined where to add connections.

There are 4 jumpers to add.
1) from U4 pin 3 to IC1 pin 1
2) from U4 pin 1 to IC1 pin 17
3) from U4 pin 11 to IC1 pin 18
4) from U4 pin 2 to IC1 pin 19

Fortunately all of the nets I needed to tap had reasonably easily
accessible points to solder wires without having to solder directly to
the tiny surface mount pads of (U4) the FTDI chip.

Stay tuned.
Photos and further write up to come...
"He's just this guy. You know?"
darus67
 
Posts: 246
Joined: Wed Sep 26, 2007 10:25 pm
Location: Minnesota, USA

by darus67 on Sun Feb 10, 2008 8:55 pm

Here are a couple pictures showing the jumpers I added.
Click the thumbnails to see the full size images at my Flickr page.

[url=http://www.flickr.com/photos/darus67/2254752259/]Image
[/url]
[url=http://www.flickr.com/photos/darus67/2256572502/]Image
[/url]
"He's just this guy. You know?"
darus67
 
Posts: 246
Joined: Wed Sep 26, 2007 10:25 pm
Location: Minnesota, USA

by darus67 on Sun Feb 10, 2008 9:35 pm

The last piece of the puzzle is the software.
We have to provide a new programmer definition for avrdude.

oPossum provided the solution to that

oPossum wrote:RS-232 drivers do invert the signal, so a new entry in avrdude.conf will be required for direct connection to a FTDI chip.

I think this will work...

programmer
id = "arduino_dasa";
desc = "serial port banging, reset=rts sck=dtr mosi=txd miso=cts";
type = serbb;
reset = ~7;
sck = ~4;
mosi = ~3;
miso = ~8;
;


I added this entry to my avrdude.conf, plugged in my arduino, checked to see what com port it connected as, and fired up avrdude.

Image
"He's just this guy. You know?"
darus67
 
Posts: 246
Joined: Wed Sep 26, 2007 10:25 pm
Location: Minnesota, USA

by darus67 on Sun Feb 10, 2008 10:08 pm

It is probably not a good idea to leave these connections in place permanently, since there
are no resistors to provide buffering in case you run a sketch that drives one
of the pins in conflict with the FTDI chip. If you wanted to make these
connections permanent, it would probably be a good idea to put a 4.7k
resistor in series with each connection.

Also, keep in mind that this method of programming an AVR is gosh-awful
slow. It makes snail racing seem thrilling. But, if you have somehow broken
the bootloader in your arduino, and don't have any other way of
programming the ATMega168, this may just save your bacon.
"He's just this guy. You know?"
darus67
 
Posts: 246
Joined: Wed Sep 26, 2007 10:25 pm
Location: Minnesota, USA

Please be positive and constructive with your questions and comments.