If you describe your project fully it will be easier to give useful advice.
So to give some more details, let me try and explain what I am trying to create here.
- I will have 1 master chip, which controls synchronization across slaves, controls high level state, etc
- I will have at least one slave chips in a 2D matrix (probably close to 20 when its all said and done). These chips may be wired to their neighbors, and they connect to various peripherals using SPI (they act as masters to their own peripherals in this situation)
- Commands will be executed in parallel and generally affect all slaves (except for some specific commands). Sometimes slaves will need to transmit and receive data between their neighbors in order to complete the command, and this data transmission will be synchronized with the same master clock (e.g. in bit 7 of the command, slave 1,2 sends a bit to 2,2)
- Some commands, notably a mode selection command, will cause some slaves to enter an invalid state. In this case, I need to know if at least one slave has an error, so that I can recover and move back to the last valid mode.
If your master can control things so that only one slave talks at any one time and so that the master knows which slave is talking then you could easily transfer the data on a single line.
I think this might be possible, but it might dramatically slow down the rate at which I can send commands. In most of the scenarios, a command will simply be telling each slave to perform some action with no response. In some cases, the master will send a command and specify which slave should respond (just by sending bits over the standard mosi line), and then that slave could respond over miso. However, there are a few commands which will need to know if one of the slaves has failed it, but it doesn't really matter which one or how many failed. Theoretically I think I could run the command, then request from each slave the result, though this is pretty slow.
Why not use the built-in SPI or I2C systems? Or maybe even Serial?
I am not using SPI because each slave is already using the built-in SPI pins in order to interact with other SPI peripherals that are attached (each device controls some other SPI devices - like SD card, TFT display, etc).
I was looking into I2C but I'm not sure if it will meet my needs. One issue is that the commands need to be send to all slaves at the same time as they need to be synchronized and execute in parallel.
Additionally, using my own method here lets me send commands that are not multiples of 8, which is nice, but not 100% necessary.