Go Down

Topic: Using Arduino as ISP: a bit of a concern (Read 756 times) previous topic - next topic

JimboZA

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?
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

Coding Badly

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...

1. 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!

2. 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.

Quote
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.

Quote
Any advice on the safest way to do this please?


220 ohm to 1k ohm resistors on the SPI lines (MISO, MOSI, SCK).

JimboZA

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.
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

Coding Badly

#3
Jun 27, 2014, 09:53 am Last Edit: Jun 27, 2014, 11:04 pm by Coding Badly Reason: 1
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.

Quote
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.

Peter_I

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)

"Nothing is foolproof to a sufficiently talented fool"

Go Up