ATtiny2313 System Clock Selection

Created on: 25 April 2013

Part 7 of the ATtiny2313 Tutorial

The system clock for the ATtiny2313 can be selected from a number of different sources: from an external clock source, internal 4MHz RC oscillator, internal 8MHz RC Oscillator, watchdog internal 128kHz oscillator or an external crystal / ceramic resonator.

Selecting the Clock Source

The clock source can be selected by programming fuse bits in the microcontroller so that the desired clock source will be used by the microcontroller at startup.

Atmel Studio can be used to program the clock source selection bits. There is also a fuse bit that can be programmed in order to divide the clock source by 8 – the CKDIV8 fuse bit.

The system clock can be output on pin 6 of the ATtiny2313 by setting the CKOUT fuse bit.

CKOUT pin on the ATtiny2313 microcontroller

Default Clock Fuse Settings

The image below shows part of the Device Programming dialog box from Atmel Studio – the default clock settings can be seen.

ATtiny2313 default clock fuse settings

A new ATtiny2313 will have the default factory settings of the clock fuses set as follows:

  • CKOUT fuse bit unprogrammed – the system clock will not be available on pin 6
  • CKSEL fuse bits – set to use the internal 8MHz RC oscillator for the system clock
  • CKDIV8 fuse bit – set to divide the system clock by 8
  • SUT fuse bits – start-up time set to 14CK + 65 ms

This means that the system clock is set to 1MHz by default: 8MHz ÷ 8 = 1MHz.