Introduction: Using the 8Pin ATTINY Programming Shield With an External Clock

Picture of Using the 8Pin ATTINY Programming Shield With an External Clock

Instructables author extraordinaire Randofo created a great programming shield to use your Arduino to program 8 pin ATTINY processors. He was even generous enough to give 50 copies of it out to people who authored instructables using AVR processors.
It works great on brand new ATTINYs and any chip that is programmed to use it's Internal clock. There's one small problem. If you are using an external clock source such as a crystal or ceramic resonator, the chip will not be reachable as it is expecting something to keep it's heart beating from outside.

In this instructable I'll show you how to talk to attinys using an external clock source.

Step 1: Fuses and Connecting an External Clock Source

Picture of Fuses and Connecting an External Clock Source
AVR microcontrollers have two configuration bytes in their internal memory that control various aspects of how the processor is initially configured and run. These are called FUSE bits for obscure reasons, and if you get them wrong, you can render the processor inoperable (or bricked!) These can be reset with a special high voltage programmer. One Fuse bit, the clock source, is initially set to use the chip's internal oscillator. For many applications, this is fine, but if critical timing is necessary it's necessary to use an external crystal or oscillator. These are much more temperature stable and precise.

The 8 pin programming shield doesn't use an external oscillator. You can program the rest of the flash of an ATTINY with the programming shield as long as it's Clock fuse is set to internal. You can even write the Fuse bits if you don't change the clock, and you can even write that ONCE! After that, if you don't have whatever kind of clock you've selected available, the chip just won't function, even for programming.

For example, I have a hack for the TV-B-Gone that turns it into a Super Camera Remote. The TV-B-Gone uses an external 3 pin ceramic resonator like the one pictured here. If you take the processor that comes with the TV-B-Gone, or program the fuses using the makefile in the open source firmware package, you'll get  this error:
avrdude: Device signature = 0xfff000
avrdude: Expected signature for ATtiny85 is 1E 93 0B
Double check chip, or use -F to override this check.
Fortunately, Randofo  includes female headers as a breakout of all the pins. Get one of these 3 pin resonators and connect the middle pin to Ground (pin 4) and the other two to pins 2 and 3.

If you do this, you can reprogram, including going back to internal clock!

Here, I used a breadboard, but it would also be easy to take a little strip of protoboard and make a little header to plug right in.


Step 2: Command Lines for Burning the Fuses.

Randofo's example uses the Arduino software to program.

Here's an example of using avrdude command line for burning the tv-b-gone code.
avrdude -p attiny85 -P com18 -c arduino -b 19200 -B 1 -U flash:w:tvbgone.hex

And to burn the fuses:
avrdude -p attiny85 -P com18 -c arduino -b 19200 -B 250 -u -U lfuse:w:0xfd:m -U hfuse:w:0xdf:m

replacing com18 with whatever port yours shows up as.

Comments

About This Instructable

16,378views

33favorites

License:

Bio: I'm a technology professional, photographer, interactive sculpture artist and all around geek! I love making things and teaching others to create.
More by osbock:Using the 8Pin ATTINY programming shield with an external clockTurn a TV-B-Gone into a super camera remote!
Add instructable to: