Making a multiheaded ICSP

I have gotten into projects that use two and even three Arduino chips of one flavor another all at the same time. That means that I often have to work incrementally on the code in more than one processor. Now if you're using a MAC, you know how every now and then, a USB port seems to disappear, and maintaining three at once can be a pain.

So here's my idea. The ICSP interface uses ISP, and apparently the "chip select" in this case is accomplished by holding the reset pin low on the target processor. So, if I hooked three processors up, with common MOSI/MISO/CLK, and used three arduino pins to control the resets of the targets, could't I ship code to each one, provided I had my reset control lines set right? Then I'd only need one USB port back to the computer. Actually, you could upload once, and send the same code to many targets also, if you chose an ICSP platform with enough memory.

But, here's what I know nothing about. If I upload code to an Arduino via the IDE, I'm sending code, not the text of the program. I don't know if it starts with a preamble, has check sums, or anything else. What programming would this take? Do I just write a sketch for my ICSP platform that hands the incoming serial bit stream out to the ISP interface, or is their more to it than that?

Thanks in advance for any insights.

I don't think that will work unless SCK/MOSI/MISO on the other devices are only inputs. If any had pins programmed as outputs, and they weren't reset and responded to the programming signals from the programmer driving SCK/MOSI/MISO then the programming would be hosed.
I think you could do this as an alternative - hold Reset low to all devices, so none were on the SPI "bus", and then control which one received the SCK signal.

Ok, thanks. Good point.

Now, does anyone know of documentation as to what the precise format of a program download? I know with normal IDE programming through the USB connector, it looks like the code flows in, then something (maybe a copy of the code?) flows back, probably as a check process. and I assume that with ICSP, the code stream is laid into the target starting at the bottom of memory, and run serially upward?

So just use a big 3-position switch. Why does it have to be complex?

I think other people have achieved multiple simultaneous programming by connecting RX to only one of the targets and assuming that the other (identical) target processors would have sent the same thing.

But he's programming different chips with different programs, using ICSP vs Serial (Rx/Tx).

Nick Gammons; hex file uploader

does file uploading via ICSP.
My standalone programmer runs that code if you want something that you can take to the field without having to use a laptop/PC.
http://www.crossroadsfencing.com/BobuinoRev17/