Robostix fuses

The ATMega128 uses fuse bits to configure the chip. One of the first things you'll need to do is setup the correct set of fuses.

AVR Studio GUI

 * 1) Start AVR Studio
 * 2) Press escape, or click Cancel when presented with the "Welcome to AVR Studio 4" dialog.
 * 3) Plugin the AVRISP into the ISP connector on the Robostix. Note that the cable from the AVRISP has a red stripe on one side. Is is very important to ensure that the red stripe lines up with pin 1 on the ISP connector. You'll find the ISP label silkscreeened onto the board, along with a 1 at one corner.
 * 4) Plug in the power to the Robostix. You should see the LED on the AVRISP flash a few times and then go solid green. This indicates that the AVRISP is now ready for programming.
 * 5) Back in AVRStudio, click on the Tools menu, then on the STK500/AVRISP/JTAG ICE sub-menu, and finally the STK500/AVRISP/JTAG ICE... item. After a short while, you should see a dialog like this:



What's important is to read the text at the bottom of the dialog to ensure that the AVRISP was detected fine.
 * 1) From the Device drop down list, choose ATmega128.
 * 2) Click on the Fuses Tab. Note that fuses are referred to as programmed or unprogrammed. A programmed fuse (i.e. check box is checked) has a value of zero. This is all rather confusing.
 * 3) Uncheck ATmega103 Compatability Mode [[M103=0]
 * 4) Uncheck JTAG Interface Enabled [[JTAGEN=0] (with the JTAG enabled, ADC4/5/6/7 will be unavailable)
 * 5) Check Brown-out detection enabled [[BODEN=0]
 * 6) Check CKOPT fuse [[CKOPT=0]
 * 7) Scroll all the way to the very end, and click the last entry Ext. Crystal/Resonator High Freq.; Start-up time 16K CK + 64 ms; [[CKSEL=1111 SUT=11]

Carefully check all of the settings, and then press the Program button. You should see something like the following (again, take note of the text at the bottom of the dialog):



You're done. The fuses should now all be set properly, and you can download a program.

uisp on Linux
Dave has done a great job explaining the how and why above. Here is how to do the same thing with the uisp command line tool on Linux.

Debian Sarge has uisp available as a package. It is also a candidate for the buildroot once it is hacked to work with SPI.

I have a STK300 parallel port programmer attached to my laptop. Change -dlpt and -dprog to suit your programmer according to the uisp documentation.

The command to set the fuses as above is:

uisp -dprog=stk200 -dlpt=/dev/parports/0 --wr_fuse_l=0xbf --wr_fuse_h=0xc9 --wr_fuse_e=0xff

PonyProg2000
PonyProg2000 is the programmer which is recommended for use with the AVR-PG1B programmer (made by Olimex and sold by SparkFun). I used v2.05a to make the following screenshot. Select the ATMega128 from the Device->AVR micro menu. Then bring up the Command->Security and Configuration Bits... dialog. The fuse settings should be modified to look like:



Make sure you click Write to program the ATMega128.

Each row corresponds to a fuse byte. If you consider checked = 0, unchecked = 1 and look at the bottom 3 rows, you'll get the following pattern (treat the grayed out SPIEN as being checked): 11111111 = 0xFF 11001001 = 0xC9 10111111 = 0xBF You'll notice that this corresponds to the fuse settings shown in the examples above.

IMPORTANT: Make sure that the version of PonyProg2000 is at least version v2.06fBETA. Otherwise, there are some .hex files which PonyProg doesn't read properly.