Main Content

ATtiny85 20MHz Internal Clock

The ATtiny85 is rated at a maximum clock speed of 20MHz at 4.5 – 5.5V. For some applications it would be nice to get the maximum speed without needing to buy a 20MHz crystal, or tie up two I/O lines driving the crystal. Here’s how to do it.

To test it I toggled an output at the clock frequency, and measured it with a frequency meter:

The reading of 10MHz implies a clock frequency of 20MHz.

Introduction
The ATtiny85 is almost unique among the AVR chips in having an internal PLL (Phase-Locked Loop) that can multiply up the internal 8MHz clock by a factor of 8 to 64MHz, for use by Timer/Counter1. By programming a fuse you can choose to use the PLL divided by four as the system clock, giving a clock speed of 16MHz.

Looking at the ATtiny85 datasheet we see that there’s an OSCCAL register that allows you to adjust the internal clock frequency to between almost -50% and +100%:”

Link to article