Rescuing an Atmel chip with invalid Oscillator fuse settings

I thought this would be a useful post to anyone else who has come up against this problem.

Atmel Chips, like the ATMEGA328, have various "fuse" settings that specify different conditions of operation. These settings are set in the bootloader, and, if the wrong settings are chosen, can make prevent the chip from working, and prevent another bootloader from being loades, essentially "bricking" the chip.

One of the easiest ways, I have found, to cause a problem with the fuses is to do what I did, and specify incorrect oscillator settings in the bootloader. Atmel chips like the Atmega328 have several different kinds of oscillator that they can use, from 1 MHZ to about 16 MHZ. This is essentially the "speed" of the processor. Some value must be chosen for the oscillator in the bootloader, and if the wrong value is chosen, the chip may look for an oscillator that is not there, and be unable to boot.

The Atmega328 contains an internal oscillator that is capable of operating at 1MHZ or 8MHZ, and also supports external oscillators, such as crystal oscillators. Usually a 16MHZ Crysal oscillator is used.
I was using a 16MHZ crystal oscillator, like I normally do, and set the bits accordingly. However, while debugging, I burned a bootloader with the 16MHZ oscillator fuses onto another chip. Later, after I had already soldered my last Crystal and Capacitors into my other project, I found that I couldn't upload to the second '328 chip, and I now had no oscillator to connect to the circuit, so I couldn't change the fuses back to the internal oscillator.
Fixing this would be a simple matter of buying a new crystal and some capacitors, but I needed this second chip for another project, and time was short, so I wanted a fast solution.

It turns out, there is one. The Atmel chips need an oscillation source, but it doesn't matter where it comes from. If you have access to a signal generator, you can simple create a 16MHZ signal and feed it directly into the clock pin of the AVR. Then you can burn a bootloader as you normally would, specifying the internal oscillator as the clock source, and you are then free to disconnect the signal generator.

I however, don't have a bench signal generator. I do have an AD9850 signal generator chip, which has a range of 1-40 MHZ. Connecting this to my Arduino Due, I was able to produce a 16MHZ clock signal, which allowed me to upload a bootloader to the chip which set it's fuses to use the internal 8MHZ clock. These AD9850 chips are cheap, and very useful, they can eliminate the need for an expensive signal generator for many small projects.

It would also be very easy to turn one of these into a self-contained unit by replacing the Arduino with a chip, and adding some simple 7 segment LED's.

You must be a member of this blog to see the comments. Log in now!