I am not sure what your level of experience with ATmegas is (though reading the datasheet is a good sign!), so I'll start with something very basic, skip down if this is useless:
The term "programmer" in this context can refer to two different things:
- Software. In your case it is avrdude.
- Hardware. The piece of hardware that sits between the software programmer (avrdude, in this case) and your ATmega. Some examples of these are USBtinyISP, USBasp, Pocket AVR programmer, AVRisp, etc. To program the chip, including the fuses, you need both, and to say exactly what the avrdude command should be we need to know which hardware programmer you have.
If you are indeed new to AVR development, take a look at Lady Ada's AVR tutorial as Kurt E. Clothier points out.
The go-to site for me for fuse settings is the Engbedded Fuse Calculator. On that page, after you enter in your desired fuse settings, you will see the arguments you must provide to avrdude
to burn the fuses correctly. For instance, to set default fuse settings, plus disable the ATmega103 compatibility mode use the following:
-U lfuse:w:0xc1:m -U hfuse:w:0x99:m -U efuse:w:0xff:m
You want to add the fuse commands to a regular avrdude
command line that specifies the (hardware) programmer, MCU, etc. For me for instance, the base avrdude
call (without an actual command) looks like this:
/usr/local/bin/avr/bin/avrdude.exe \
-p m328pu \
-C C:\\cygwin\\home\\angelatlarge\\arduino\\arduino-1.0\\hardware\\tools\\avr\\etc\\avrdude.conf \
-c usbtiny
(ignore the stupid Windows-style path to avrdude.conf in a Unix-type command line. On cygwin, only the Windows version of avrdude works, AFAIK. On most systems avrdude can find its conf file without the -C parameter anyway )
Where
- The first line is the path to avrdude
- The
-p
option specifies the MCU you are programming. For you it will be -p m128
- The
-C
parameter specifies the location of avrdude.conf
file. Only necessary on stoopid systems like mine (cygwin running Windows version of avrdude).
-c
is the name of the (hardware) programmer you are using. Depending on the (hardware) programmer, you might also need to specify a serial port using the -P
option. If I want to program an AVR chip over bluetooth, for instance, I use -P COM18
.
To this we add the command to program the fuses, the result, for my setup, is as follows:
/usr/local/bin/avr/bin/avrdude.exe \
-p m128 \
C:\\cygwin\\home\\angelatlarge\\arduino\\arduino-1.0\\hardware\\tools\\avr\\etc\\avrdude.conf \
-c usbtiny \
-U lfuse:w:0xc1:m -U hfuse:w:0x99:m -U efuse:w:0xff:m