Troubles with Arduino on the 'Tiny85

The attiny85 and family are excellent little microcontrollers fit for many simple uses like lamp dimmers and other simple automation tasks.  The folks at MIT Media Labs "High-Low Tech" group have put together board definitions for various "tiny" AVR chips including the attiny44, attiny45, attiny84 and attiny85.  You can read all about programming and interfacing these chips at their website:

http://hlt.media.mit.edu/?p=1695

What's Going Wrong?

However, many folks including myself have been plagued by a simple problem when attempting to program the attiny85.  During upload you get the following error and your red LED error light may illuminate:

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: stk500_cmd(): protocol error

I have seen a million reasons for this and some people don't seem to want to state the exact cause in various forums.  So I hope this article finds those who need to resolve this issue.

Why?

Why does this occur?  Quite simply, the Arduino 1.0 IDE sets the baud rate of the ISP sketch to 19,200 bps and the attiny is way slower than that.  Two simple modifications will resolve the issue.

  1. Open the ArduinoISP Sketch by selecting File -> Examples -> ArduinoISP

  2. Arudino as ISP ModificationLocate the setup() function in the code and change the Serial.begin() to 9600 from the default 19200 and save the sketch to your custom sketches folder.
  3. Upload this modified sketch to your Arduino ISP programmer board.
  4. Edit your programmers.txt file to communicate with "Arduino as ISP" programmers using 9600 baud.
  5. You may now upload sketches to your attiny microcontrollers!  Try the blink sketch as described on the HLT website.  
  6. Enjoy!

Modify programmers.txt file accordingly