BUILD A SIMPLE SERIAL PROGRAMMER FOR AVR DEVICES using ATtiny2313 Microcontroller

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.
avr 910

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. T he 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 ([email protected]) 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.

For more detail: BUILD A SIMPLE SERIAL PROGRAMMER FOR AVR DEVICES using ATtiny2313 Microcontroller


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top