5.1 Selecting the Clock Source in the AVR MCU

The clock source used by the AVR devices are selected by setting the appropriate fuses. However, for the AVR XMEGA family, the clock source is configured using software. Most ISP and parallel programmers can program the fuses for selecting a clock source. The fuses are not erased when the AVR device memory is erased and the fuses must only be programmed if the fuse settings should be altered. Programming the fuses each time the device is erased and reprogrammed is thus not necessary. The clock options that are relevant for this document are:
  • External low-frequency crystal
  • External crystal oscillator
  • External ceramic resonator

Several sub-settings related to the start-up time of the AVR device can be selected, but the three clock options mentioned are the fundamental settings that should be focused on. The clock options can vary across different AVR devices, as not all devices support external oscillators. Refer to the device-specific data sheet to determine the available clock options.

The AVR device may not run if a different clock source other than the clock source actually configured is selected. The oscillator circuits are activated internally in the AVR device, based on the configured clock option. The fuses are not cleared by a memory erase. Hence, it can cause problems if incorrect settings are selected.