ATtiny85, Arduino as ISP

This was my project for today.
I uploaded the preliminary ArduinoISP sketch to the DMN. (Still using Arduino0022.)
Then I U/L 'Blink' (having selected ATtiny85 with Arduino as ISP)
and I get a bunch of errors:

Blink.cpp:8:22: error: WProgram.h: No such file or directory
Blink.cpp: In function 'void setup()':
Blink:10: error: 'OUTPUT" was not declared in this scope
Blink:10: error 'pinMode' was not declared in this scope
Blink.cpp: In function 'void loop()':
Blink:14: error: 'HIGH' was not declared in this scope
Blink:14: error: 'digitalWrite' was not declared in this scope
Blink:15: error: 'delay' was not declared in this scope
Blink:16: error: 'LOW' was not declared in this scope

Is that the problem?

I found WProgram.h on my HDD

Where (where else?) is it supposed to be at?

Which core are you using?

I’m sorry, but,…
What’s a “core”? (Yes, it’s that bad.)
It’s ATtiny85, yes?

DMN = Duemilenove

What's a "core"? (Yes, it's that bad.)

I don't understand why not knowing what a core is would be bad. None of use are born knowing what one is. You simply have not yet learned that bit of trivia.

A core is a set of source files that implement the Arduino / Wiring API.

You downloaded a "core" (probably a ZIP file) and extracted the contents to either the {ArduinoIDERoot}\hardware\ folder or the {ArduinoSketchRoot}\hardware\ folder. You probably got the ZIP file from the MIT website or from the Arduino Tiny website. Where did you get the ZIP file?

OK, thanks for that, and bearing with me.
I grabbed the ZIP from HLT (mit), took a look at that, and placed it where the IDE's Preferences told me its Sketchbook is located.
So, now it can successfully compile, but I'm getting a different error --
stk_getsync(): not in sync:resp=0x15

Got out the logic probe.

+5 and Gnd = OK
D10 is Hi and gets a LO pulse
D13 is LO and gets a HI pulse
D11, D12 are floating, no activity or ext. brief

The usual culprit is that auto-reset on the the Duemilenove (the "programmer") has not been disabled. Did you connect a 120 ohm resistor between RESET on +5V on the Duemilenove?

D10 is Hi and gets a LO pulse

D10 is SS (Slave Select) / RESET. It should go hi-to-lo when the ArduinoISP sketch communicates with the target processor.

D13 is LO and gets a HI pulse

D13 is SCK (SPI clock). It should go lo-to-hi with each bit of data transferred between the programmer (Duemilenove running ArduinoISP) and the target.

D11, D12 are floating, no activity or ext. brief

Are the two data lines. They should have "ext. brief" activity as data is transferred.

It appears everything is working up-to the target which means the most likely culprit is that you do not have the programmer wired correctly to the target. Very carefully check the wiring between the Duemilenove and the ATtiny85.

I'm super certain regarding the wiring of D10-D13.

The usual culprit is that auto-reset on the the Duemilenove (the "programmer") has not been disabled. Did you connect a 120 ohm resistor between RESET on +5V on the Duemilenove?

No, I haven't done anything not mentioned in the Make/HLT presentation/s.
The mentioned a 10uF cap when using a Uno.
Is there supposed to be a 120? resistor pulling up the Reset on the Duem.?

Yes. There are details here...

You disable auto-reset immediately after uploading the ArduinoISP sketch.

OK -- that worked.
I triple-checked the Make article and the HLT tutorial and there's no mention of the 120? resistor. I have a bunch of 240? resistors for LM317s, I used two in parallel.
Good deal.
Thank you for your assistance and kind consideration, CB!

You are welcome. I'm glad you have it working.

I've never had to disable auto reset but I was using avrdude directly. I do not know if it makes a difference.

I was going to rig up the circuit on a perfboard and run flying leads to the Arduino, but I was at RadioShack and saw a “proto shield” on a shelf. So, I decided to go for it and got it all situated on that, brilliant.
Switching ICs back and forth and re-routing wires gets irksome quickly. This makes things go smoothly.
Picture attached.


I will put that in the “why didn’t i think of that category”! The only thing I would like to add is the led’s for heart beat and error.

For myself a ZIF connector for the 328 would be ideal. Of course then I would need the crystal and such.

Show us your attiny programming shield???

Here’s mine :slight_smile:

I’ve since added headers for 5v and gnd

Nicely done! Looks like you put so time and thought into that shield! If you had more room you could do other chips too. I like the idea of the movable SPI wire set and the on board status and blink LED's.

Thanks. I leapt into the deep end with the Attiny and wanted to do a programming shield for it straight away but knew there would be lots of wasted shield space for it.

I have always wanted to operate the atmega328 outside of the arduino boards and there was just enough space so I decided to add that in too but I needed to make sure that they wouldn't interfere with each other.

The trick was trying to figure out how to switch 5 lines between the two and it wasn't until I spotted the jumper cable headers in the electronics shop that I realised I had my solution.

The pinouts for the attiny were an after thought but have proven invaluable.
The same goes for the LED's for the ArduinoISP heartbeat, programming and error pins; they are essential I have discovered as sometimes the ArduinoISP programs stalls and needs resetting and seeing the programming light come on means that the programming step is working where as not seeing it come on means I've probably got the wrong board selected.
Without them there is no way to know that it's not working.

Having the extra test LED on the board means I can quickly load in the blink test to confirm that it's all working without having to pull the chip and put it in a breadboard.