Arduino - Bootloader - A fistful of programmers

During my tries to burn an Arduino-bootloader on an ATMEGA168, I tested a fistful (yes, exactly five!) programmers. Here, I like to share my experiences. But also the members of the Arduino community have been assiduous and improved the description for burning a bootloader, and also the capability of the Arduino environment (Arduino 0009) for burning bootloaders a lot (see [1])! I did not test out yet, so maybe things I did not succeed in, do work now.


1. DAPA-Programmer

DAPA Programmer
Schematic DAPA programmer

The Programmer described in Arduino-Playground (see [2]) is known as "DAPA" by programmers software. With this, it was simple to burn an Arduino bootloader on ATMEGA8 properly, even just with the menu of the Arduino environment (the Arduino-environment had to be started with Administrator privileges and GIVEIO had to be installed). So that, I do not mention ATMEGA 8 later, since there the simplest method works fine.

Burning the bootloader-hex on an ATMEGA 168 results in an interesting problem: After the upload of the bootloader, it's possible to upload software - but only once. The uploaded software works fine, exactly as it's expected. But it's not possible to upload a new one- the bootloader was overwritten by the sketch because of the wrong settings of the fuses. - I did not find any way to set the fuses on an ATMEGA168 correctly with a DAPA programmer.


2. BSD-Programmer

The programmer known as "BSD" is similar to the DAPA, just with different connexions[3]. Since this programmer is known by ”AVRDude”, one can upload the bootloader with ”UISP” (contained in Arduino package) and set the fuses with AVRDude (or do all with AVRDude).

Upload the bootloader with uisp:

uisp -dpart=ATmega168 -dprog=bsd -dlpt=0x378 --wr_lock=0x3F
uisp -dpart=ATmega168 -dprog=bsd -dlpt=0x378 --erase --upload if=bootloader\ATMegaBOOT_168.hex -v
uisp -dpart=ATmega168 -dprog=bsd -dlpt=0x378 --wr_lock=0xCF
BSD Programmer
Schematic BSD programmer

(The hex-file of the bootloader can now be easily found at [4], thanks to the Arduino community.)

Change the fuses with avrdude is descibed in [5] (thanks to zitron in the Arduino-forum[6].)

lfuse C7
hfuse DF
efuse 0
Anyway, in some cases, it did not work and the ATMEGA 168 became inprogrammable- only to be refreshed with high voltage programming - see fourth paragraph. Later I found out this must be because of too low signal levels of my parallel port. Because it worked with the STK-200 compatible programmer.

3. STK200-compatible programmer

STK200-compatible Programmer
Schematic STK200-compatible programmer

The hardware description for another programmer, known as "STK200" by the programs, I found here at [7].

Since I'm an anxious person, I added 1kOhm Resistors to all lines (except GND, of course) connecting my parallel port with the programmer. In this programmer, a 74xx244 works as line driver and amplifies the signals from parallel port and the ATMEGA, which was necessary for my laptop's parallel port. This programmer is easy and fast to build on a drilled board ("Veroboard"), the 74HCT244 is cheap and easily available at electronic stores.

Also, one can get that kind of programmer for around 10 Euros at electronic shops or ebay. A handy layout fitting inside a D-Sub connecter can be found at [8]

With that, I got no problems in programming and setting fuses with AVRDude (see the description linked above).


4. STK-500 Evaluation board (high voltage mode)

STK500
STK 500 in high-voltage programming mode

A friend of mine had a STK500-Evaluation board lying about, now being part of my stuff-collection :-) The software "AVR-Studio" supplied with that and the high-voltage-programming mode allowed to "repair" the ATMEGAs becoming unavailable by the tries with the BSD-programmer. This is a fine toy, also works with RS232 to USB connectors. The disadvantage is the necessity to apply the ATMEGA to the awful built-in sockets for high-voltage programming mode.

A wonderful description how to use AVR-Studio for programming the Arduino bootloader is in the Arduino playground at [9].


5. STK-500 Evaluation board (ISP mode)

STK500
STK 500 in ISP programming mode

The last possibility I tried out was to use the STK500 as ISP with AVR-Studio (by the way: freely available, just Google about). I did not test that Software with the other ISPs above; perhaps this may interest me later.

This is a wonderful combination and overall solution when experimenting with other fuses and different crystals.


6. USB-ISP with STK-500 Emulation

USB-ISP
Home-brewed USB-ISP

Since the original STK-500 is good, but not very handy, I made a more handy one. The version I chosed is described in [10]. It needs only a few cheap components and works like a charm (tested with Windows XP). Since I own this toy, I never needed the original STK-500 again.

A different layout of the same device can be found here (EAGLE files) and its description (only german).

Update: This programmer does not work, neither as STK-500-emulation nor as AVRISPmkII-emulation under the 64-bit-Version of Windows 7.

References


DL1DOW German Amateur Radio Station