@cisco, I have one more potential TODO: Connect the 16u2 and the 256rfr2 using SPI. In the current 1.1 schematic, we added a few I/O lines for status info (USB openend yes/no, USB powered yes/no). We considered using I2c instead, for more flexibility (this could allow more info to be exchanged, flow control to be added, the 256rfr2 to control auto-reset behaviour, automatic baudrate switching, all at least in theory if the software is written). However, the 16u2 does not have hardware I2c, and SPI seemed to complicate ICSP.
I've given this a bit more thought, and I think using SPI might be a good idea after all. The extra flexibility is nice, but it would also enable flashing the 256rfr2 through ICSP (letting the 16u2 work as an ISP programmer, essentially). I suspect this can end up speeding up uploads, and removes the need for auto-reset on serial open, which is also nice.
In terms of pin conflicts, I think there are four usecases:
- Normal operation. 256rfr2 is SPI master, 16u2 is slave.
- 16u2 -> 256rfr2 ICSP operation. 16u2 is slave and by pulling reset low, forces 256rfr2 as slave.
- 256rfr2 external ICSP. 256rfr2 is forced to slave by pulling reset low, 16u2 is slave by default, its CS pin keeps it off the bus (needs a pullup).
- 16u2 external ICSP. 16u2 is slave by pulling its reset pin low. The 256rfr2 is SPI master, so this might cause conflicts.
The last case can be tricky, but this is solvable. The 256rfr2 must be taken off the bus, to prevent a second master. Pulling reset low doesn't work, because then it will be an active ICSP slave. Uploading an empty sketch (at least a sketch that doesn't use SPI) would be sufficient to keep the rfr2 off the SPI bus. This isn't terribly convenient, but you won't be flashing the 16u2 often.
To implement this, you would connect MISO, MOSI, SCK together, and two additional wires for SS and an interrupt signal (which doesn't need to be on an interrupt pin, it's mostly that polling a single pin is easier than doing a full SPI transaction).
I was hoping to be able to test all this (including the 16u2 always powered setup) by soldering up one of my scouts, but I've been too terribly busy to spend any time on this at all. Not sure if that improves soon, but at least now you know what I've been thinking. What do you think?