Dick Cappels' project pages http://www.projects.cappels.org

return to HOME


 


BUILD A SIMPLE SERIAL PROGRAMMER FOR AVR DEVICES.


Everything you need to get started is here.


Note that the AVR910 programmer does not support all AVR processors, especially the newest chips. Be sure to check the documentation to see if it supports the version(s) of the processor you are interested in.

Atmel described a simple programmer based on the AT90S1200 (NOT the AT90S1200A) controller in their application note, AVR910 (a modification to use the AT90S2313 is also given below).The circuit is so small and simple, I was able to put two of them together without using a printed circuit board, taking only about an hour to assemble each one. Both worked fine without any hitches. These programmers are compatible with RS-232 ports, cost well under US$10 to build, and program AVR chips in the serial mode (and thus is not able to access programming options only available in parallel mode -read those data sheets!). It connects to a target controller via a 6 pin cable. The target controller needs to have its own clock and power supply. The target also supplies power to the programmer. The 6 pin cable as well as the rest of the system is clearly explained in the AVR910 application note. The programmer works seamlessly with the programmer application that comes with the AVR Studio package and also seamlessly with MacAVRpa, an assembler/programmer application for the Macintosh.

Though several web sites mentioned the programmer, even after finding the application note, I still had questions, so I decided to put the bulk of the information here for anyone who might be starting down the same road. In addition to the electronic components, you need these things to build and use the programmer based on the AVR910 application note. 

1. AVR910 application note.

avr910.pdf

check Atmel's site for the latest version www.atmel.com

2.Assembly code for the AT90S1200 micro controller, including the file, 1200def.inc, that comes with both of the assemblers mentioned here. See below for info on a preprogrammed chip. 

ASSEMBLLY CODE for AT90S1200: avr910a.htm. Check Atmel's site for the latest version at www.atmel.com

ASSEMBLY CODE for AT90S2313: avr9103a.htm

For a wider selection of supported chips (including more ATMEGA and ATTiny chips, here is a realtively un-tested version for the AT90S2313 written by a person named J. Samperi. Note the cautions at the top of the file: MOSI and MISO lines have been swapped and need to be swapped back to work with the original AVR910 hardware (go to the .equ statements and make MOSI= 6 and MISO = 5). I am trying this one cautiously and so far I am happy with the way it works while programming that AT90S2313. AVR910_2313_v3.asm

 HEX FILES for AT90S1200
For use with AVR Studio's programming tool (Windows): AVR910.HEX,
For use with MacAVRpa for the Mac: AVR910 v2.2.hex
HEX FILES for AT90S2313 For use with AVR Studio's programming tool (Windows): AVR91013.hex
or use with MacAVRpa for the Mac: AVR91013pa.hex
 

3. Assembler and programming software.

Windows: AVR Prog application that comes with AVR Studio 

www.atmel.com AVR Studio is a complete development package and includes a fairly good simulator.

A few notes on variations and resources

The design is clever and works very well. It is an amazing demonstration of what can be done in 1K or ROM and only a 3 level deep stack. Take note that R101 does not do anything important and can be omitted. Though I have not surveyed all of the AVR devices, R103 and R106 are superfluous at least for the AT90S1200 and AT90S2313 and may be omitted. In one unit I used 39k resistors for R105, R102, and R104 to save power and they worked fine (I used a 2N2907 for Q100 and a 2N2222 for Q101).The programmer in the image on this page differs from that described in the Atmel application note in that there is an LED and series resistor connected across the power supply to indicate the presence of voltage, and an LED with series resistor connected from the +5V to the ATS90S1200 pin 16 (reset output) to indicate programmer activity. Sometimes the AVR Programming application from Atmel gets out of sync with the programmer (this does not happen with MacAVRpa ). The LED on the reset line show right away whether the hardware is really programming the chip as the software says. Build your fist one as faithfully as you can according to the application note -this application note is several years old and Atmel has had adequate opportunity to receive feedback on it an make corrections, while my changes have only been applied to one programmer. Read the application note carefully and reproduce the design as faithfully as you can and you shouldn't have any trouble.

Note: you can use an AT90S2313 instead of an AT90S1200 if you add two lines to initialize the stack pointer, since the AT90S2313 is a superset of the AT90S1200, the difference being that the '1200 has a hardware stack and thus does not require pointer initialization. To use the AT90S2313 with AVR910 code, insert these to lines immediately after the reset label. The complete modified assembly code and hex files for MacAVRpa and AVR Studio are available inthe assebly code section of this page.

---start code fragment---

ldi r16,RAMEND ;Init Stack Pointer

out SPL,r16

---end code fragment---

A clever variation

David C Keenan (d.keenan@uq.net.au) came up with a clever modification of this design, to allow programming features only available in the parallel mode on some AVR chips. Check out David's design at http://users.bigpond.net.au/d.keenan/AVR/index.htm
 
   

Where to get that first chip?

The problem many people encounter in building their first programmer is the paradox of obtaining the first AT90S1200. The best way is to find someone locally who has a programmer and program the chip using a hex file generated with the assembly code and tools from Atmel. You can also buy programmers and preprogrammed chips. There are many programmers available, so here are a couple of examples.

Programmers:

Iguana Labs (www.iguanalabs.com

You can buy a very nice, low cost little programmer that programs AVR devices as well some 8051 family parts from Iguana Labs. I had a small problem using their PG-302 programmer the first time and was impressed at how professional and helpful they were. Their site also has a small tutorial on electronics essential to using micro controllers. The programmer comes assembled with a 110VAC/60Hz power supply.

Dontronics(www.dontronics.com) 

You can also get a chip preprogrammed from Dontronics, but note that the firmware on this chip was modified to be compatible with the small PC boards that Dontronics sells. You can buy all the parts necessary to build a programmer, from Dontronics, including a AT90S1200 that has been preprogrammed with a special version of the AVR910 code that was modified to run on the Dontronics boards.

There are lots of other programmers available, including some from Atmel. I found the AVR910 programmer well suited to my needs because it is well integrated with Atmels' development environment and, needing only a serial port, can also be used on Macintoshes (at least through OS 9.2.1).



HOME
 
 

Please see the liability disclaimer on the  HOME page.

 Contents ©2002, 2004 Richard Cappels All Rights Reserved