# AVR and external crystals

I have an atmega16 which I need to clock to at least 16MHZ. How do I know what fuses to set? The fuse calculator gives you a choice of low, medium and high frequency. What does that mean?

Is there a limit to how fast the chip can go despite you put a crystal in?

-
 I do not understand the second part of your question. Could you explain it a little bit more? – jpc Mar 24 '11 at 12:10

I'd call 16 MHz high frequency, in terms of setting the AVR fuses. Details are in the data sheet, in the System Clock and Clock Options section. Note the startup time options, you shouldn't use 6 CK for a 16 MHz clock.

Your last question is meaningless. The processor speed is determined by the oscillator frequency, up to the maximum frequency specified (16 MHz).

-
 Good point about the startup time. In general one should always verify all one's fuse bit settings with the datasheet. – jpc Mar 24 '11 at 12:16

The low, medium and high frequencies are explained in the datasheet. For ATmega16 this is in Table 4 on page 26:

The fuse setting descriptions come from Atmel and they sometimes contain the MHz ratings but this depends on the processor model.

In general you should read the information about fuse settings in the datasheet since there is a lot of information there that just did not fit into short descriptions shown to you by the fuse calculator (they are more of a quick remainder then a reference).

-
 I always found it kind of interesting that there seems to be a lower bound in this table at 400kHz... – vicatcu Mar 24 '11 at 12:39 AFAIK the chip will work find down to 1 or 0Hz (it is a fully static design) but the oscillator circuit may not. And then there is an option with CKOPT = 0. It may be difficult to test thou since the only really low frequency crystal I am aware of is the 32kHz watch crystal so you cannot really verify 2Hz operation. ;] – jpc Mar 24 '11 at 12:47

I've had good luck with this online AVR Fuse Calculator in the past. Might be useful for ya.

-

Yes, 16MHz is definitely a "High Frequency" setting. Also If you don't have a good reason not to I usually just pick the longest startup time (SUT fuses) option to give everything time to settle at startup. This would be the should be the 16K CK + 64ms option for the ATMega16.

-