Sunday, September 16, 2012

Programming the ATTiny25 with Ubuntu

SETUP 
To get all of the libraries and packages necessary to put a basic program on your AVR chip, run the following command.
sudo apt-get install gcc-avr avrdude avr-libc

ATTiny25 is plugged into a 40 pin ZIF socket, which is wired for HVSP mode. See this video for ZIF socket installation instructions https://www.youtube.com/watch?v=yJo29VMXt90

Other programming modes for AVR chips include PP and ISP - see this [PDF] link for pin wiring in order to program various AVR chips.

FULL COMPILATION COMMANDS
avr-gcc -Os -o hello.elf -mmcu=avr25 hello.c
avr-objcopy -j .text -j.data -O ihex hello.elf hello.hex
sudo avrdude -p t25 -c dragon_hvsp -P usb -e -B10 -U flash:w:hello.hex

If wired for ISP or PP mode, you should replace dragon_hvsp in the last step with dragon_isp or dragon_pp .

If you see this error:
jtagmkII_close(): bad response to GO command: RSP_ILLEGAL_EMULATOR_MODE

This error is actually OK - apparently HVSP mode shouldn't respond to this command, but avrdude sends it in ALL programming modes - see this link

ADDITIONAL INFO
/etc/avrdude.conf has a lot of (specific) information about each supported chip.


MORE LINKS
http://www.instructables.com/id/Getting-started-with-ubuntu-and-the-AVR-dragon/
http://tldp.org/HOWTO/Avr-Microcontrollers-in-Linux-Howto/x207.html
http://www.nongnu.org/avr-libc/user-manual/using_avrprog.html
http://www.homebuilthardware.com/index.php/avr/linux-avrdragon-tutorial-1/

No comments:

Post a Comment