Using an arduino as a AVR Programmer

Nikolaus Gradwohl2009-12-14T01:53:00+00:00

I managed to use an arduino as an isp programmer for my ATTiny13. I first i tried to use the avr910 program described in this blogpost from Randall Bohn, but avrdude could not flash my hex file :-/

then i found a newer version of the code that emulates an avrisp at googlecode

arduinoisp

To make use of the programm place your attiny13 on a breadboard and connect the +5V and The ground from the arduino to it. Add a small condensator between the VCC and the GND pin.

Then add a wire from pin 10 (arduino) to the RST pin (pin 1 of the attiny)

connect pin 11 (arduino) to pin 5 (MOSI attiny13) connect pin 12 (arduino) to pin 6 (MISO attiny13) connect pin 13 (arduino) to pin 7 (SCK attiny13)

then add a led and a resistor to pin 9 of the arduino (this shows if the program is running)

When everything is running upload the pde from the google-code link to your arduino.

copy the following code to a file named test.c

#include <avr/io.h>
#define F_CPU 1000000UL
#include <util/delay.h>

int main(void) {
    int n;
    DDRB |= ( 1 << 4 );
    while (1) {
        PORTB &= ~(1 << 4 );
        _delay_ms(1000);
        PORTB |= ( 1 << 4 );
        _delay_ms(1000);
    }
    return 0;
}

This program makes a led on pin 4 blink every second.

Compile and link the program and convert it to a hex file

avr-gcc -g -Os -c -mmcu=attiny13 test.c
avr-gcc -mmcu=attiny13 test.o -o test.elf
avr-objcopy -O ihex -R .eeprom test.elf test.hex

and finally write it to the ATTiny13

avrdude -P /dev/ttyUSB2 -p t13 -c avrisp -b 19200 -U test.hex

now connect a led with a pull up resistor to PB4 and enjoy the blinkenlights :-)

Tweet This! submit to reddit Digg! Tags: | 10 comments | no trackbacks

See also:

Arduino based Midi Trigger box for analog synths
YesNoBot
from now on you shalt be called miditron
Midified Monotron first track
RadioPI - debugging

Trackbacks

Comments

Leave a response

  1. Bruce 2009-12-31T00:01:02+00:00

    Sweet! I've been wanting to do this but the other approaches I've seen were based on creating a shield. I knew there had to be an easier way.

  2. Mick 2010-01-30T11:40:02+00:00

    Just wanted to say thank you for this great note. I tried it with an ATTINY13V-10SU and it worked perfectly. On Windows I used -P COM3 instead of -P /dev/ttyUSB2

  3. André 2010-05-29T02:33:35+00:00

    I've built a shield for this to make it easier to burn ATtiny's. I've got a couple of ATtiny25's and 2313, I know the 2313 will work according to some other doc's, but do you know if the 25 will work ?

  4. Nikolaus Gradwohl 2010-05-29T06:46:52+00:00

    I haven't tried a ATtiny25/45 yet, but they use the same pin layout as the attiny13 chips and as far as i can see from the specs i think they should work.

  5. sagio 2011-04-30T16:23:27+00:00

    With Attiny13, i am getting the error define PAGEL and BS2, looking for some help here.

  6. daniel 2011-10-02T21:46:09+00:00

    Nice. Got tiny13 working on a breadboard - a simple shield is next. Latest ArduinoISP file adds useful Err and Tx indicator signals on pins 7 & 8. WinAVR version of avrdude worked better than the one with Arduino IDE. Thanks.

  7. lukas 2011-12-10T17:45:38+00:00

    Nice !!! but for the tiny13 it`s possible to program it with 3 simple resistors (dasa) I think thats much esier if your arduinos are in use for other projects XD

  8. Christel 2013-04-02T12:03:43+00:00

    I just could not depart your site before suggesting that I extremely enjoyed the standard info a person provide to your guests? Is gonna be back often to investigate cross-check new posts

  9. Lyn 2013-07-30T16:01:41+00:00

    Wow, marvelous blog format! How lengthy have you ever been blogging for? you make running a blog glance easy. The entire glance of your site is excellent, let alone the content material!

  10. Trent 2013-07-30T17:30:55+00:00

    Thanks for some other informative web site. The place else may I am getting that kind of info written in such an ideal manner? I have a challenge that I'm simply now running on, and I've been at the look out for such information.

Leave a comment