Currently I am trying to figure out what the correct fuse settings for my ATmega8 are, when I want to use an external crystal oscillator with a frequency greater then 8 MHz.

I have found the following table in the Atmel ATmega8 datasheet (p. 27):

enter image description here

CKOPT has to be programmed (set to 0). But what about CKSEL3..1?

For a 16 MHz oscillator I would probably set them to 111, because it is the highest possible value (compared with 8 MHz, if CKOPT is unprogrammed (set to 1) ).

How would you choose CKSEL3..1 for example a 10 MHz, 12 Mhz or 14 Mhz oscillator?

Simply comparing with the ranges as depicted for CKOPT = 1 seems wierd. (my calculation: e.g.: (.4/8*16)MHz=.8MHz, etc.):

  • CKSEL3..1 = 101 for .8 - 1.8 MHz
  • CKSEL3..1 = 110 for 1.8 - 6 MHz
  • CKSEL3..1 = 111 for 6 - 16 MHz

So do I always choose 111? If I should, in which case would the others be more appropriate?


2 Answers 2


Based on the table - if CKOPT is 0 in the next column CKSEL3..1 lists all 3 values (101, 110 and 111) so that suggests they are equivalent, and that is used for frequencies over 1 MHz (and up to 16MHz as far as I can see that's maximum supported).

As per DataSheet for CKSEL = 0 oscillator has greater output swing thus supports higher frequency. CKSEL = 1 offers smaller frequency range but significantly lessens power consumption and this is probably why you have support for 0.9-3MHz to have even smaller consumption.

So my interpretation of this would be: CKOPT = 1 and CKSEL3..1 = 111 for frequencies 3-8MHz if you can help it (because of power consumption), and CKOPT = 0 and CKSEL3..1 = 111 for frequencies 8+MHz - 16MHz

  • \$\begingroup\$ Thank you for your answer. For the projects I did the last month I have selected CKSEL3..1 = 111 and had no problems with any of the frequencies I tried (12 and 16 MHz). \$\endgroup\$
    – PetPaulsen
    Sep 9, 2011 at 10:29

The CKOPT bit enables higher power mode for the oscillator amplifier. I think this is mainly useful if you want to drive a second microcontroller from the same crystal.

This old post from avrfreaks tells you that the available ranges for >8MHz is apparently just to determine start up characteristics (time it takes the AVR to execute first instruction after powering on)... It also tells you where to look in the datasheet in case I'm misinterpreting that answer.

BTW: depending on what programming environment + programmer you're using, it might choose the fuse bits for you by just selecting what type of crystal you're using. You should look into that because it makes things much easier =)

  • \$\begingroup\$ The startup time is selected with the CKSEL0 and SUT1..0 fuses (Table 5), so this wouldnt help. The post you have linked to says "CKSEL3:1 may take on any of three equivalent values, namely '101', '110', or '111'". Are they realy equivalent? The datasheet doesnt say so, so I am not sure. \$\endgroup\$
    – PetPaulsen
    Aug 10, 2011 at 9:59
  • \$\begingroup\$ I am using AVR Studio 5 with AVRISP mk II. Here I have to manually select the CKOPT fuse and CKSEL3..1 CKSEL0 and SUT1..0 is a drop down. Here it says low, medium and high frequency oscillator. As I wrote in my question I would probably select the high frequency oscillator (CKSEL3:1 = 111), but I am not 100% sure. \$\endgroup\$
    – PetPaulsen
    Aug 10, 2011 at 10:03
  • \$\begingroup\$ @PetPaulsen I would say 111 seems right then \$\endgroup\$
    – NickHalden
    Aug 10, 2011 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.