# ATmega fuses for external crystal oscillators greater then 8 MHz

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):

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?

-
add comment

## 2 Answers

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

-
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). –  PetPaulsen Sep 9 '11 at 10:29
add comment

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 =)

-
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. –  PetPaulsen Aug 10 '11 at 9:59
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. –  PetPaulsen Aug 10 '11 at 10:03
@PetPaulsen I would say 111 seems right then –  NickHalden Aug 10 '11 at 15:41
add comment