HEllo
I'm trying make two arduino communicate. Well, it sound easy with I2C. But I would like to know if it's possible to make them speak trhough SPI (cause I think can be faster data exhancge). DOes anybody tried this ?
Thanks for your answer.
Cool Thanbsk for this example I better look more of the thread before asking
Now, I've another question. I'm use with I2c Communication with another controler (oopic) witch has limited communication (and comunication speed ability) speed ability.
Well spi communication from one of my arduino to another get well. the source code (from other thread) has kommentar in swedish... witchis a few obscur for me.
so I manage to make my 1st arduino send data to the the 2nd one.
But now, let imagine I I wanna send do this : from the main arduino I send 2 byte. 1st byte is treated by the 2nd arduino (located 10 cm (wired not board) ) . and the 2nd arduino send the other one byte to a 3rd arduino). Is it possible with connecting all clock pin together and 1s arduino out pin to second in, second out pin to 3rd in pin .all with same clock pin. or It's better to say 1sr arduino send one byte to the second and one byte to the 3rd ( I may be get wire lenght trouble).
In the example (of the other thread),I didn't really understood the slave select pin function really well... So I can't figure out how the master can send to one or more then one slave.(in I2C each slave got an adress maybe it's not possible with spi )
Maybe it's really better (or simply only possible) do with I2C ?
if I can do with SPi commun (clock pin)k that 1st send to 2 and 2 send to 3....how much can I go (10, 50, 100). and other question. WIth 2 arduino it's easy to wire the pin....with 3 Can I wire commun clock (pin 13) Slave select (pin10) and just 1st out to 2nd in, 2nd out to 3rd in). like a chain or a kind of repeater but at better speed than I2C ?
Well, thanks to read all of my question, in my bad english.any answer or advice will be welcome. I'm new with the arduino (progammed oopic) but i'm amazed of it's possibility
In the example (of the other thread),I didn't really understood the slave select pin function really well...
There is one slave select (SS) line for each slave device. Two devices, two different SS lines on the master.
how much can I go (10, 50, 100).
You've got 2 limits with SPI - the length of the lines, and the number of slave select pins available on the master. The latter can be increased by using IO expander ICs. I don't know what limits are on the MISO/MOSI/SCK lines, but SPI is meant to be a PCB level protocol, and the actual limits would depend on the specific ICs in question.
If you need longer distances, the slower speed of I2C may actually work in your favor.
Cheers, that's very fast. So that would be useful for a/v applications and the like?
I've never had a need to venture beyond 9600 because that's fast enough for moving small packets of data. But I was curious why comparisons with i2c and spi seemed to revolve around speed, and what applications might require such an incremental leap considering the lean storage capacity of a micro, especially a 168.
I dunno about others, but my only "speed" concerns are things like missing a short-lived event, or getting bogged down when there is lots of IO or work to do. e.g., if I'm bit-banging PWM to drive a servo, I'd like for the sensor read to take place in a short enough time that I can effectively do it between pulses. For an actual project I'm working on, I want to multiplex data from a minimum of four RS232 ports, and with the corresponding overhead of packetizing and putting all the data on the same link, I am concerned that poking about at I2C speeds could be a bottleneck. Still gotta do some math (after I figure out my algorithms and protocols) and see if that concern is valid.
IMO, on the microcontroller side the speed advantage is to hurry up and get back to whatever it is you are doing. On the peripheral side, you want to be fast enough to keep up with the microcontroller.
Standard SPI is up to 25MHz, there are some vendor-specific implementations I've seen rated at 50MHz.
Of course, max on the Arduino will be 16MHz.
-j
The maximum speed of the hardware SPI on the Arduino is actually 8Mhz. The clock is set by the last two bits of SPCR (SPR1 and SPR0), with the maximum being the oscillator frequency divided by 4 (when both bits are zero). You can double that (giving the clock speed divided by 2, or 8Mhz) by setting the SPI2X bit, which is bit 0 of SPSR.