Categories
08 Project Management Fab Academy Providence -Year I - Student Projects Tutorials

Very Basic Beginner Assembly Tutorial III: How to Use Avrdude

First – If you have not already compiled your program

See the Very Basic Beginner Assembly Tutorial: How to Use Gavrasm to Compile a .asm File

If you have compiled your program (created a .hex file)

*Note: If you do not yet have avrdude installed or if you are a windows user and need avr studio – see Lady Ada’s tutorials for detailed information on how to download, setup, configure and use these programs. Lady Ada’s AVR software installation tutorial

Once your AVR software tools are installed:

Again – Lady Ada has excellent detailed tutorials on how to use avrdude check the out for details on what the all the commands are and what they do – I will just give the very basics here to help you program a chip.

1. Open your command line interface and navigate to the directory that contains the file you want to flash to the microcontroller.

2. Connect your AVR programmer to your computer – I prefer the usbtiny (also created by Lady Ada and available at a reasonable price from adafruit studios).

3. If your board has an resonator / external clock you will need to set the fuses first before attempting to program the microcontroller. You must do this first. However, once the fuses are set – you do not have to do it again. The fuses are set only once. You can reprogram the microcontroller as many times as you want after the fuses are set.

example to set fuses:

avrdude -p t44 -c bsd -U lfuse:w:0x7E:m

parts used in this example:
– 20 MHz clock
– bsd cable programmer
– microcontroller – attiny44

You need to change the parts in the code above to match the parts you are using in order for it to work. Ask you instructor if you are confused.

example to set fuses:

avrdude -p t45 -c usbtiny -U lfuse:w:0x7E:m

parts used in this example:

– 10 MHz clock
– usbtiny programmer
– microcontroller – attiny45

4. If you have set the fuses already or if your board does not have an external clock – here is how to flash / program the microcontroller.

generic example to flash microcontroller:

avrdude -p microcontroller -c programmer -U flash:w:program.hex

example with actual data:

avrdude -p t44 -c usbtiny -U flash:w:freqrx3.hex

parts used in this example:

– usbtiny programmer
– microcontroller – attiny44