Embedded Electronics Blog

Configuring AVR Fuse Bits for clock selection

VIMP NOTE:
fuse bit = 0 => fuse bit is PROGRAMMED
fuse bit = 1 => fuse bit is UN-PROGRAMMED

Fuse bits configuration is required when one has to change default factory setting of clock (internal/external) to desired setting. This is most important thing and setting fuse bits incorrectly may render microcontroller useless. Let us see which different fuse bits are available for different AVRs and their uses. We will use PonyProg2000 for configuring fuse bits. PLEASE NOTE that discussion on this page is limited only for configuring AVR fuse bits for clock source selection.

There are different clock sources available for AVR. They are : internal RC oscillator, external crystal/ceramic resonator, external clock. Mostly we need either internal RC oscillator or external crystal hence we will only concentrate on that. Once you understand the process u can configure for other options with the help of datasheet.

Internal RC oscillator :

Many AVRs (like ATmega8, ATmega16, ATmega32) have internal RC oscillator. It is calibrated for 1,2,4 or 8 MHz. It has +-3% accuracy. Frequency of oscillator gets affected by VCC and temperature. If you are not performing any time critical operations in your system, then this is best option to go with. Following table shows how to set CKSEL fuses for different frequencies. This table can be found in corresponding AVRs datasheet. CKOPT fuse should always be unprogrammed while using this option.

CKOPT
CKSEL3…0
Freq
1
0001*
1.0MHz
1
0010
2.0MHz
1
0011
4.0MHz
1
0100
8.0MHz

*If your AVR has internal RC oscillator then, device is shipped with this option.

Crystal oscillator:

Crystal oscillator should be used when u need accurate frequency of operation. CKSEL3,2,1 fuses should be configured as follows for crystal oscillator. If you want to use crystal of frequency more than 8MHz then CKOPT should be programmed. NOTE : setting of CKOPT depends on speed grade of your AVR. However please note that CKSEL0 fuse along with SUT0,1 is used for startup time selection in this mode. Refer datasheet for more info.

For AVR with 8PI or 8PU (i.e. max frequency of operation is 8MHz)

CKOPT
CKSEL3..1
Freq (MHz)
Decoupling Capacitor
1
101*
0.4 – 0.9
1
110
0.9-3.0
33pf
1
111
3.0-8.0
33pf
0
101,110,111
1.0
33pf

For AVR with 16PI or 16PU (i.e. max frequency of operation is 16MHz)

CKOPT
CKSEL3..1
Freq (MHz)
Decoupling Capacitor
1
101*
0.4 – 0.9
1
110
0.9-3.0
33pf
1
111
3.0-8.0
33pf
0
101,110,111
1.0 – 16.0
upto 8MHz : 33pf
more than 8MHz : 27pf

*This setting is only for ceramic resonators

You can get more information about crystal oscillator from datasheet.

I have put ready-made snap shots of fuse bit settings for different AVRs :

Exit mobile version