My project will have:
Main board with 32u4 talking to a PC via USB.
Two sensor boards with ATTINY24(?) doing 8channels of analog read.
The sensor boards will be my custom design eventually, but before that I will prototype the system first using Nano's instead of ATTINY (and then with ATTINY dev board if necessary)
The sensor boards need to do the following every approx 1ms:
Look for mode change instruction from the main board (single integer).
Do 8 channels of Analog to digital.
Do some calcs.
Send a message (single integer) to the main board.
The main board has to:
Maintain contact with the PC on USB.
Send occasional mode change instructions to the sensor boards.
Receive message every 1ms from each sensor.
What protocol should I be looking at?
I see that the MOSI/MISO/SCK channels on the TINY24 are the same pins as the ADC channels, does that affect things? ie do I need to use the digital pins instead for my comms.
The only serial comms I've ever done is to receive a character over USB.
That is a lot to do in 1ms. Each analogRead takes about 100us. Are the calcs floating point? How long is the message that is sent (number of characters)?
You can use those pins for either ADC or SPI, not both.
Since the 32u4 has only 1 serial port it is not easy to use serial for comms. You could use I2C or SPI if you have those pins free on the TINYs and the boards are not too far apart.
hmm.. I've just realised that 3 bits would just enough for the message (in both directions) so I should be able to use 4 pins on each device, 3 for the message and 1 to say whether sending or receiving.
The sensor board would check the state of the control channel to see if the main board was sending a mode change, and read it if necessary. Otherwise the sensor board will output the message.