So the transfer does not need to be limited to one byte.Īlso, the master SPI peripheral can raise an interrupt when the transfer of a byte is complete, so an interrupt service routine could send multiple bytes of data from an in-RAM buffer with a relatively small overhead. So there is a way to inform the slave that data is ready.įurther, the slave SPI peripheral can raise an interrupt when a byte has been received, so an interrupt service routine running on the slave can copy the byte into an in-RAM buffer. The slave SPI will set a flag when a byte has been received. The clock can stopped while there is no data to transfer. The ATmega SPI peripheral is synchronous, and so has a clock signal, generated by the master. The ATmega's SPI peripheral transfers 8 bits at a time, which looks comparable to your solution outline. Flow-control would be handled in software, and not by the SPI peripheral. Or an extra pin could be used to send data back from the slave, Arduino 2, to the master, Arduino 1 to control the transmission rate. If the transfer might sometimes be faster or earlier than the slave, Arduino 2, can use the data, then a buffer would be some RAM in the receiving (slave, Arduino 2) ATmega. It is the same number of pins as would be used by any synchronous shift-register based solution using external chips the ATmegas on-board SPI peripheral is designed to implement the same mechanism. This requires at least two pins, clock and MOSI, between Arduino 1 and Arduino 2. The simplest solution is to connect the Arduinos' ATmega SPI peripherals together, Arduino 1 as master, and Arduino 2 as slave. You're outline diagram suggests that there is only a small amount of data in each transfer, but even that is not clear. over what distance is the transfer going to happen, inches (cm),.Sender and receiver, is 20% available, or 10µs/byte, can either orīoth ends 'block' waiting for a transfer? how much CPU overhead is acceptable to achieve the data rate on.how many Arduino pins are available to implement the transfer.Possibility that it will be unavailable or could lose data, and so will the 'slave' always be ready to receive data, or is their a can either end initiate a transfer can Arduino 2 request data, is the transfer one way or are their some use-cases which require.
![double buffered parallel to serial converter. double buffered parallel to serial converter.](https://cdn.sparkfun.com/assets/d/1/f/5/b/50e1cf30ce395fb227000000.png)
- is the data bit or byte orientated, and is it arbitrary binary?.
- latency - how long can the delay be between sending and receiving data?.
- Data rate - how fast does the data need to be transferred?.
-
Some examples of the type of detail which may be important, in no particular order, to answer the question: However, outlining one of the options might help you understand the detail that an answer needs.
As Andy Aka's comment says, there is very likely more to this than a single pin for sending and receiving data, and currently the question is missing important detail.