NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Fuses for External Crystal

July 02, 2012
by dgikuljot
dgikuljot's Avatar

Hey guys, Lately I have been programming blank avr's such as attiny2313's and so on with USBAsp. I have no problem using usbasp to program a micrcontroller, but one thing I have not been able to figure out is how to set the fuses to use an external crystal when programming a blank avr. Do i simply wire the crystal in and then set the correct frequency in the makefile, or is there a more complicated way to set the fuse to use the external crystal.

Thanks, Kuljot Dhami

July 03, 2012
by Rick_S
Rick_S's Avatar

The fuses must be changed to use an "External Oscillator". If no fuses are changed, the microcontroller will default to the internal 8MHz oscillator with the divide by 8 turned on meaning you only get a 1MHz clock. The internal oscillator can be perfectly good for many applications, but time sesative things like RS232 communications, may not work well because it isn't as accurate as a crystal oscillator.

Check the datasheet for the micro you are programming. Toward the back where the fuse settings are broken down, you'll find the ones that need toggled for external oscillator.

Alternatively, download and install the free version of BASCOM. That is a basic compiler for AVR. The fuse settings can be a bit simpler with that because it is gui driven and has pull downs for the various settings.

Lastly, if you do change from internal to external, make sure your setup has a crystal connected in the circuit, otherwise once the fuses are set, the micro will not communicate. That is because with no crystal, you have no clock, thus the micro will freeze until a crystal is connected.


Post a Reply

Please log in to post a reply.

Did you know that you can use a transistor to interface between different voltage levels of digital logic? Learn more...