How to ISP on daisy chained devices

I'm trying to program multiple Nano boards connected in a daisy chain via the ISP pins from an UNO board.

Just as a sanity check, I started by loading the example ArduinoISP sketch into the Uno, and wiring a single Nano to the SPI pins as described in many examples found on the Internets. Using this setup I'm able to program the Blink sketch into Nano as expected.

Next I wired up a second Nano (Nano-B) in a daisy chain with the first (Nano-A).

My connections:

Programming Uno      Nano-A       Nano-B
----------------------------------------
D10 (reset out)      RST          RST
SCK                  SCK          SCK
MOSI                 MOSI
                     MISO         MOSI
MISO                              MISO

I then modified the ArduinoISP sketch to transmit two copies of everything so they end up in both Nanos:

uint8_t spi_transaction(uint8_t a, uint8_t b, uint8_t c, uint8_t d) {

  // First copy for Nano-B
  SPI.transfer(a);
  SPI.transfer(b);
  SPI.transfer(c);
  SPI.transfer(d);

  // First copy for Nano-A
  SPI.transfer(a);
  SPI.transfer(b);
  SPI.transfer(c);
  return SPI.transfer(d);
}

This of course doesn't work or I wouldn't be posting here, but it seems like sound logic. I get a device signature 0f 0x000000 which points to a wiring problem (?).

I've searched the world over and haven't found an example of daisy chaining Arduino SPI programming. If you can point me to some rock I haven't looked under, or correct me on my approach please do so.

That is all.

When Reset is taken Low, both devices react to SCK and MOSI, so both will see the same program at the same time.
Only bring MISO back from one so the programmer sees correct programming responses.

It seems the answer is that you cannot daisy chain Arduinos. I have found several sites posting pretty diagrams showing how to connect them into a daisy chain, but I don't see how they can work that way. In the SPI daisy chains I've seen, you shift commands out of the master until all the slaves in the chain have latched (shifted in) a command, then take CS high on the devices that you want to execute their command. But it seems the Nanos are responding to the command as soon as it is shifted in (based on the clock count I presume).

Seems the only solution is to tie them all in parallel (programming them all at once) and use separate CS signals to access individual slaves during operation, but you cannot daisy chain them.

Am I wrong here?

Probably need mods to the programmer software to daisychain them.
Or to support control of multiple independent Reset lines.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.