
19
ATtiny40 [DATASHEET]
8263B–AVR–01/2013
6.2.1
Calibrated Internal 8 MHz Oscillator
The calibrated internal oscillator provides an approximately 8 MHz clock signal. Though voltage and temperature
This clock may be selected as the main clock by setting the Clock Main Select bits CLKMS[1:0] in CLKMSR to
0b00. Once enabled, the oscillator will operate with no external components. During reset, hardware loads the cal-
ibration byte into the OSCCAL register and thereby automatically calibrates the oscillator. The accuracy of this
When this oscillator is used as the main clock, the watchdog oscillator will still be used for the watchdog timer and
6.2.2
External Clock
To use the device with an external clock source, CLKI should be driven as shown in
Figure 6-2. The external clock
is selected as the main clock by setting CLKMS[1:0] bits in CLKMSR to 0b10.
Figure 6-2.
External Clock Drive Configuration
When applying an external clock, it is required to avoid sudden changes in the applied clock frequency to ensure
stable operation of the MCU. A variation in frequency of more than 2% from one clock cycle to the next can lead to
unpredictable behavior. It is required to ensure that the MCU is kept in reset during such changes in the clock
frequency.
6.2.3
Internal 128 kHz Oscillator
The internal 128 kHz oscillator is a low power oscillator providing a clock of 128 kHz. The frequency depends on
supply voltage, temperature and batch variations. This clock may be select as the main clock by setting the
CLKMS[1:0] bits in CLKMSR to 0b01.
6.2.4
Switching Clock Source
21. When switching between any clock sources, the clock system ensures that no glitch occurs in the main clock.
6.2.5
Default Clock Source
The calibrated internal 8 MHz oscillator is always selected as main clock when the device is powered up or has
been reset. The synchronous system clock is the main clock divided by 8, controlled by the System Clock Pres-
caler. The Clock Prescaler Select Bits can be written later to change the system clock frequency. See
“SystemEXTERNAL
CLOCK
SIGNAL
CLKI
GND