For a while now I’ve been programming AVR chips with the GPIOs on my Raspberry Pi. It’s very useful to me and I thought I’d documet it here as I will probably mention it in future blog posts too.
Wiring it up
It’s not as complicated as it looks. Connect the RPi to the chip as in the following table. The pin numbers for the AVR chips refer to the PDIP package (the kind that goes in breadboard).
|Raspberry Pi Pin (P1 Header)||AVR Pin Name||ATtiny25/V, ATtiny45/V, ATtiny85/V||ATmega48, ATmega88, ATmega168, ATmega328||ATtiny2313, ATtiny4313|
|Ground (6)||Ground||4||8 & 22||10|
|3.3V (1)||Vcc||8||7 & 20||20|
Power the AVR chip up with a 3.3V supply, using 5V will probably damage your Raspberry Pi. You can use the 3.3V pin from the Raspberry Pi as shown in the table above but you will have to make sure you don’t exceed the 50mA current limit. If all that is connected is the chip you want to program, that is fine. If you have anything else running off the Pi’s 3.3V pin you may want to use a separate power supply instead.
Installing the software
You will need to install a custom version of avrdude available at http://project-downloads.drogon.net/files/ . Install it with the commands
sudo dpkg -i avrdude_5.10-4_armhf.deb
sudo dpkg -i avrdude-doc_5.10-4_all.deb
There it is done. Use the programmer name gpio (-c switch to avrdude) in your projects.