Monday, 25 August 2014

ATTiny85 with Arduino Uno as ICSP

Well, that was frustrating. I received 5 bright shiny new ATTiny85 from eBay while I was away on a business trip so I couldn’t play with them straight away. That was one minor piece of irritation.

I returned to my apartment where I have all of my electronics gear and got ready to play with the ATTiny85 (I also received 5 x ATTiny84 and 2 x ATMega328P … so there are lots of new toys to play with) and started to play.

I followed a couple of tutorials online and connected my Arduino Uno to my ATTiny85 and then attempted to load the blink sketch (the “Hello World” of physical programming), only to receive the cryptic and unhelpful “avrdude stk500_getsync() not in sync resp=0x00” message in the IDE.

Of course, I searched the Interweb for solutions to this problem but there wasn’t much that was helpful. Many opinions about the wrong USB driver, the chip inserted incorrectly, the presence (and absence) of a capacitor to expiate the Reset on the Uno … all useful for the specific problems that others were facing, I guess. I then stumbled upon an instructable by mr_mac3 (Turn Your Arduino Into and ISP) where the author, very helpfully, includes the step that I was missing. The step, you may ask? Which Step? Well, dear reader, the step where you make your Arduino an ISP (or ICSP if you want).

The step that I was missing was simply that, before you can program the ATTiny85 from the Arduino UNO, you have to load the Arduino ISP sketch onto the Arduino UNO. Holy Schemolly, what an ass basket! Once this step was completed, the Arduino UNO worked as an ICSP.

I had a couple of other issues, like rather than routing the power and ground via the +/- rails on the prototype board, I ran them straight to the correct pins of the ATTiny85 (that also made a difference). With the UNO that I’m using and the version of the IDE, there wasn’t any need to bypass the reset … that happens in the Arduino ISP sketch.

ATTiny85_01

ATTiny85_02

After the Arduino ISP sketch was loaded, I loaded the new sketch (the example Blink)I changed the Board to ATTiny85 with Internal 1 MHz clock and left the programmer on AVR ISP and changed the LED pin to 0. Next, I compiled the sketch and uploaded the sketch to the ATTiny85. I received the obligatory “avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85” message that I happily ignored and then connected my 2x2 SMD LED to ground and to the ATTiny85 pin 0 and, presto … blinky goodness was found.

Next, I loaded my sinusoidal fade sketch (modified from another tutorial) and ran it on the ATTiny85 … again, success! Woot!

Now that I have succeeded in loading a sketch onto the ATTiny85 from the Arduino UNO it’s on to the PCB version of the rats nest.

No comments:

Post a Comment

Paypal Donations

Donations to help me to keep up the lunacy are greatly appreciated, but NOT mandatory.