The AVR Mega128 is a great chip, but this little problem can be a bit of a pain. If you accidently program the fuse bits to tell the Mega128 to run from an external clock, and there’s not actually an external clock, then the chip is “dead”. Well, it’s not really dead, it’s just that it can’t be reprogrammed until it actually gets that external clock. The programmer itself (the Kanda dongle or the AVRISP programmer) doesn’t provide a clock; the programmer only provides reset and data. So without a clock, the Mega128 will just still there lifelessly until an external clock is provided, at which point the fuse bits can be reprogrammed correctly.
This tends not to happen too often using PonyProg, because its fuse setting GUI lets you control the fuse bits individually. However the AVRISP programming software in AVR Studio has a different interface. Instead of letting you set & clear the clock fuse bits individually, you choose from a long list which combination of clock fuse bits you want. If you click on the wrong combination and program, this problem can result. The AVR Programming page describes the correct fuses combination to select.
You need to feed the AVR an external clock. To keep things easy, this clock should be in the range of 500 kHz to 2 MHz. A value of 1 MHz is typical. It needs to be a 3.3 to 5 volt square wave. Do not exceed 5.5 volts or you could damage the AVR.
If you already have a function generator you could probably use that. With a function generator it’s wise to check its output on an oscilloscope before connecting it to the AVR; you want to make absolutely sure the output level is correct so you don’t damage anything.
However, most people won’t have a function generator and ‘scope, nor do you necessarily need one. Instead you can use a cheap small oscillator can. This is typically a small metal can with 4 leads: power, ground, output, and the 4th lead is either no-connect or shutdown. For example, from Digikey in the US:
http://dkc3.digikey.com/PDF/T042/0687.pdf
or from Radiospares in Europe:
www.radiospares.fr
radiospares ref number : 165-7685
description : Kony 1MHz oscillator
Any 5V oscillator can with a suitable frequency will do. Power the oscillator with 5 volts. An easy place to get it is the +5V (red) and GND (black) wires on the harddrive power connector.
Connect the output of the oscillator can to the non-grounded side of C22. Take a look at C22 (or use a multimeter) to determine which side is tied to ground, and wire the oscillator output to the other side. If you look at the schematic you’ll see this is connected to pin 24 of the AVR.
Once the board is powered up, the AVR will be receiving the output of the oscillator as its external clock. You can now program the AVR normally; naturally the first thing will be to reprogram the fuse bits! Once the fuse bits are set properly you can remove the oscillator pack. You won’t need it again. And congratulate yourself! It was a bit of a pain, but you managed to correct your “external clock” problem. And that’s not trivial.