Externally clocking (and overclocking) AVR MCUs
People familiar with AVR boards such as Arduinos likely know most AVR MCUs can be clocked from an external crystal connected to 2 of the pins. When the AVR does not need to run at a precise clock frequency, it is also common to clock them from the internal 8Mhz oscillator. Before CPUs were made with internal oscillators or inverting amplifiers for external crystals, they were clocked by an external circuit. Although you won’t see many AVR projects doing this, every AVR I have used supports an external clock option. One (extreme) example of a project using an external clock is Brad’s Quark85 video game platform. Some AVRs such as the tiny13a and the tiny88 do not support an external crystal, so the internal oscillator or an external clock circuit are the only options. The 4-pin metal can pictured above is a clock circuit hermetically sealed for precision and stability. They can be bought from Asian sources for under $2.
A common reason for needing an external clock for an AVR MCU is from accidentally setting the fuses for an external clock. Once the fuses are set to external clock, they cannot be reprogrammed without providing an external clock signal. Wiring the oscillator is simple; connect power and ground, then connect the output to the CLKI pin of the MCU. On the ATtiny13a, this is pin 2 (PB3). On the ATmega328-AU, this is pin 7 (PB6).Although the connection is simple, it’s not foolproof. During my experimentation, I accidentally plugged my oscillator backwards (connecting 5V to Gnd and Gnd to 5V), which quickly fried it. Now I’ll be extra careful with the M-Tron 40Mhz oscillator so I don’t kill that too!
AVRs are known for being easy to overclock, but I was uncertain whether an ATtiny13a rated for 20Mhz would work when overclocked to more than double it’s rated speed. I experienced no problems flashing code with avrdude and running my bit-bang UART at either 40 or 44.3Mhz with a 5V supply. At 3.3V it crashed most of the time, only running OK occasionally.
For more detail: Externally clocking (and overclocking) AVR MCUs