Electronic – ATmega fuses for external crystal oscillators greater then 8 MHz

atmegafuse-bits

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?

Best Answer

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