Header Ads

Configuring AVR Fuse Bits for clock selection

I am just working on ATMega16 for some project, and i need 16MHz Speed, for that just program fuse bits using pony prog. and... wrong fuse bits was set by me.. it is
in this case my major mistech is i did not set the CKOPT bit. then i realize i have to clear this things..

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 diffrent fuse bits are available for diffrent AVRs and their uses. PLEASE NOTE that discussion on this page is limited only for configuring fuse bits for clock source selection. We will use PonyProg2000 for configuring fuse bits.
There are diffrent 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 crsytal 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. Follwing table shows how to set CKSEL fuses for diffrent 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 oscilator from datasheet.
I have put ready-made snap shots of fuse bit settings for diffrent AVRs :

  • ATmega8 – internal 1MHz RC , fast rising power
  • ATmega8 – external crystal 3.0 – 8.0 MHz, fast rising power

  • ATmega16/32 – external xtal upto 16MHz, full oscillator swing, slow rising power (65ms), JTAG disabled


AddThis Social Bookmark Button

No comments:

(C) Arshad Pathan. [Do not copy any contain without permission]. Powered by Blogger.