- Category: Shack Talk
- Published on Thursday, 06 September 2012 03:57
- Written by David L Norris, KG9AE
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:
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 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.
Open the ArduinoISP Sketch by selecting File -> Examples -> ArduinoISP
- Locate 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.
- Upload this modified sketch to your Arduino ISP programmer board.
- Edit your programmers.txt file to communicate with "Arduino as ISP" programmers using 9600 baud.
- You may now upload sketches to your attiny microcontrollers! Try the blink sketch as described on the HLT website.