Programming Atmel ATtiny15L Using AVR-GCC

There seems to be a lot of interest in this based on the email I've received. I've put together a distribution for Windows which I use for progamming ATtiny15L parts using avr-gcc. The techniques shown should also work for other AVR microcontrollers without on-chip SRAM, such as the ATtiny12.

This technique also was described in an article in Circuit Cellar Magazine (#192, p. 20, July 2006) named Tiny AVR Serial Port Programmer. The schematics and PCB design files are available on this Web site.

Take a look at this 3.2 Mbyte ZIP file, which should have almost everything you need...

    http://www.lightner.net/avr/ATtiny.zip

If you want, you can browse the source code and "avr-gcc" toolset binaries without downloading the entire ZIP archive.

See the README.txt file in the distribution's base directory for ZIP file installation instructions and a different README.txt file in the "projects" subdirectory for background on the methods used. Also read the comments at the beginning of the "Makefile".

The Makefile logic is setup for the older "gcc 2.95" so I've included a complete binary distribution of this for Windows. (This also works under Linux, if you have the gcc 2.95 avr-gcc distribution, like I do.) There are some good reasons for using the older version of "avr-gcc", including the fact that the parameter passing scheme for 8-bit values is much more efficient, when compared to "avr-gcc" 3.x and 4.x.

IMPORTANT NOTE: You will have to adapt the "make load" logic for your own programmer.

There is also "make" logic for "make sim" and "make wave" which uses my own "home grown" AVR simulator. This C-based AVR simulator runs faster than realtime on modern PC processors (under both Linux and Windows), but I don't distribute it because it's writtin in ugly, blazingly fast, C-code with zero documentation. It can output VCD "waveform" files for viewing using GTKWave (a.k.a. "WinWave"), an amazing bit of open-source software.

Please read the comments in the "Makefile" regarding the ATtiny "OSCCAL" oscillator calibration byte. My custom-made AVR PC parallel port programmer reads and inserts this value into program memory such that the ATtiny part can automatically calibrate itself after reset. This makes "bit banged" UARTs work perfectly.

I'm happy to answer questions, but be warned, this stuff is not for "newbies". Much of this is based on knowing AVR assembly code very well, and knowing exactly how "avr-gcc" converts C into AVR machine code.


Send mail to Bruce D. Lightner at lightner@lightner.net or visit his personal Web page at www.lightner.net/lightner/bruce.html.

Last updated Mon Jul 6 12:55:31 PDT 2015