Sunday, September 16, 2012

Programming the ATTiny25 with Ubuntu

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

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

avr-gcc -Os -o hello.elf -mmcu=avr25 hello.c
avr-objcopy -j .text -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

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


No comments:

Post a Comment