Hi experts,
We plan to have setup a system with 9 Arduino Dues for example. (may have even more number).
One of the Due is like master, the rest are slave. The data exchange could be bi-directional.
And we want to hit highest data rate in order to save time.
Due to the large number of slave Dues, we might not able to use the native SPI interface (enough for slave, but not enough for master), or native I2C interface (maybe can, but it is slower).
Do you have any recommendation of any lib which can support highest comm?
Thank you.
SPI - have one master, multiple slaves. Slaves can interrupt master to request attention, or master can query slaves for status.
CrossRoads:
SPI - have one master, multiple slaves. Slaves can interrupt master to request attention, or master can query slaves for status.
Thanks, however, SPI don't have the address info, so we have to leave each slave a pin for selection purpose, am I right?
How about the highest speed it can achieve?
SPI don't have the address info, so we have to leave each slave a pin for selection purpose, am I right?
Yep.
How about the highest speed it can achieve?
I can't find this in the data sheet but "bloody fast" can be assumed, maybe 20MHz +.
EDIT: I still can't find it spelt out but SPI slave read seems to be the slowest and that's 33MHz AFAICT.
Note that at these speeds the chips had better be pretty close together. Can you provide more information about the physical setup?
Rob
I've tried the I2C example at play ground, insert some timer as well, and noticed that,
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600); // start serial for output
}
void loop()
{
Wire.requestFrom(2, 6); // request 6 bytes from slave device #2
unsigned long timer_start = micros();
unsigned long timer_start_ms = millis();
while(Wire.available()) // slave may send less than requested
{
char c = Wire.read(); // receive a byte as character
}
unsigned long timer_end = micros();
unsigned long timer_end_ms = millis();
unsigned long delta = timer_end - timer_start;
unsigned long delta_ms = timer_end_ms - timer_start_ms;
Serial.print(" ");
Serial.print(delta);
Serial.print(" ");
Serial.println(delta_ms);
delay(500);
}
Surprisingly, I get the result as below,
when read 6 byte the delta 24 - 28 uSec, which is 2 Mbps, is it too fast??
Thank you.