I took this thread off topic, for which I apologise, and thought I'd raise my concern here.
When using an Arduino as an ISP, to program say an atTiny, I'm concerned about the target still being connected to the Arduino when the target's sketch fires up. Is there any danger? For example an Arduino pin may be low, and a target's pin high as output, causing a short to ground as soon as the target sketch fires up. Peter_I says he uses resistors in the programming lines to prevent dead shorts.
I'm going by this Instructable, whose steps imply that you connect the atTiny to the Arduino, attach the atTiny's LEDs or whatever for its sketch, then upload the sketch via the Arduino. The Instructable is silent on my concern of the atTiny still being connected to the Arduino when its (the atTiny's that is) sketch fires up.
Any advice on the safest way to do this please?
JimboZA:
When using an Arduino as an ISP, to program say an atTiny, I'm concerned about the target still being connected to the Arduino when the target's sketch fires up. Is there any danger?
Assuming a third device is not involved, there are two possible failures...
-
Bug in the ArduinoISP sketch. If the sketch is working correctly, the connected pins are all changed to INPUT (high impedance) before the target is released (RESET not asserted). I've looked over the sketch twice and have not found any such bug. However, that is by no means a guarantee!
-
Wiring. If you failed to wire the two correctly or there is a loose connection it is possible the target could run while the sketch is active.
Peter_I says he uses resistors in the programming lines to prevent dead shorts.
That is excellent advice. Think of it as a second measure of safety that cannot possibly fail.
Any advice on the safest way to do this please?
220 ohm to 1k ohm resistors on the SPI lines (MISO, MOSI, SCK).
Thanks...
And the procedure?- should I disconnect the target from the Arduino while I test its sketch? That's a bit of a pain I reckon, while messing about and uploading revisions over and over.
JimboZA:
should I disconnect the target from the Arduino while I test its sketch?
I don't. #
If the ArduinoISP sketch works correctly and the wiring is correct then the Arduino essentially disappears from the circuit when the target runs.
Or, if the ArduinoISP sketch does not work correctly or the wiring is not correct then the series resistors ensure nothing gets damaged.
And the procedure?
Add three resistors. Enjoy the freedom to upload and test at will.
# Exactly the opposite. I never disconnect the SPI lines so I can use Knock-Bang over the MISO line for debugging.
I use 330 Ohm (because they were in reach and range.
There is a picture of my (old) "programming board" here:
http://forum.arduino.cc/index.php?topic=151860.15
The one I use now is a re-build of the one in the picture, but with pins on the edge to make it plug into the uno.
(I got tired of the test leads)