beta-tester
Posts: 1385
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

connecting multiple PIs together over I2C ?

Fri Jan 11, 2013 8:33 pm

hello,
my question is, is it possible to connect 8 or more Pi boards together over their I2C ports and let them communicate like with TCP/IP protocol ? (speed doesn't matter - the communication is not heavy)
i mean as very cheap intercommunication over I2C connectors (physically a simple bus) and in the programs running on the Pi boards will see it as an additional Ethernet adapter.
i don't know how to call it - maybe something like an physical I2C to virtual TCP/IP ethernet converter/adapter/stack/kernel driver?
do you think, is it possible - or better, does it already exist?
{ I only give negative feedback }
RPi B (256MB), B (512MB), B+, ZeroW; 2B; 3B, 3B+; 4B (4GB)

User avatar
PeterO
Posts: 5958
Joined: Sun Jul 22, 2012 4:14 pm

Re: conneting multiple PIs together over I2C ?

Fri Jan 11, 2013 8:42 pm

I believe the i2C hardware in the PI is designed to run only as a master not a slave, so the answer to your question is no.
If you want to use tcp/ip why not use the ethernet ? Get a 8 port hub and off you go :-)
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

beta-tester
Posts: 1385
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: conneting multiple PIs together over I2C ?

Fri Jan 11, 2013 9:19 pm

i don't want use a big network hub/switch - needs too much space and extra power supplies and in case of type A boards, i don't have an internal ethernet port and a 3 wire parallel flat cable + connectors are way cheaper than all other solutions i guess.

what will happen, when i connect multiple I2C masters together - does that brick the board?
as i was reading i thought the I2C has a broadcast possibility - is it not possible that multiple masters can communicate by using only broadcast "messages" ?

is the Pi physically branded to an I2C master, or is it logically only - maybe there are kernel drivers somewhere around here...?

are there other bus'es pins protocols available, to realize cheap & lightweight intercommunication?

(PS.: i don't have 8 or more boards... but maybe in the future but tree i own already)
{ I only give negative feedback }
RPi B (256MB), B (512MB), B+, ZeroW; 2B; 3B, 3B+; 4B (4GB)

User avatar
aTao
Posts: 1093
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: conneting multiple PIs together over I2C ?

Fri Jan 11, 2013 9:35 pm

The peripheral crib sheet describes BSC (Broadcom Serial Controller) a "proprietary bus compliant with the Philips® I2C bus/interface version 2.1 January 2000"
Bus master is available on GPIO 0,1 or 2,3 or 28,29 or 44,45. Slave is available on GPIO 18,19.
Speeds of up to 400kBps are supported.
>)))'><'(((<

Peter247
Posts: 56
Joined: Wed Nov 21, 2012 12:29 am

Re: conneting multiple PIs together over I2C ?

Fri Jan 11, 2013 11:43 pm

You could use SPI ?
@Tao gpio 18 and 19 ?

I know the Primary and Secondary I2C ports are 0, 1 or 28 and 29 , but not heard of 18 , 19 for I2C.
http://www.peter224722.blogspot.co.uk/

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13210
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: connecting multiple PIs together over I2C ?

Fri Jan 11, 2013 11:55 pm

according to the schematic, GPIO 18 is routed out of the SoC as GPIO_GEN1, but GPIO 19 is not routed out, so isn't used, and cannot be used.

Perhaps you can use a homebrew RS-485 network using the PI's UART. I'm sure it would be a much better solution than trying to use the I2C bus.
http://en.wikipedia.org/wiki/RS-485

Peter247
Posts: 56
Joined: Wed Nov 21, 2012 12:29 am

Re: connecting multiple PIs together over I2C ?

Sat Jan 12, 2013 12:08 am

I guess it all depend on how many , how long , how fast .

You could have a chain of Pis using SPI each one getting data in one port and sending it out of the other and making a round robin .
http://www.peter224722.blogspot.co.uk/

beta-tester
Posts: 1385
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: connecting multiple PIs together over I2C ?

Sat Jan 12, 2013 8:39 pm

thank you all for the many suggestions...

if i would use SPI, than i have to reserve for every additional board an additional pin to select - is this right? than i loose too many GPIO pins.

damn, why is there the limitation to one master multiple slaves environment only? it would be the absolute perfect solution to me, if the pi board and its linux kermel would support multi masters...it would block only two pins of the GPIO and nothing else were needed for. :cry:
{ I only give negative feedback }
RPi B (256MB), B (512MB), B+, ZeroW; 2B; 3B, 3B+; 4B (4GB)

gragib
Posts: 99
Joined: Sat Dec 22, 2012 8:09 pm
Location: Calgary, AB, Canada

Re: connecting multiple PIs together over I2C ?

Sat Jan 12, 2013 9:29 pm

If you want to dip your toes into somewhat not-entry-level electronics, you could use a serial mux/demux chip like the 74HC4052 to hook-up up to 5 Raspberry Pis together using the 2 RX/TX GPIO pins on each Pi, and 2 more GPIO pins on the "master" Pi.

THomy
Posts: 2
Joined: Fri Feb 01, 2013 3:24 pm

Re: connecting multiple PIs together over I2C ?

Fri Feb 01, 2013 3:38 pm

Hi All!

I am absolutely new here and for real do not have any PI yet.
But I am planning to start a little project using TWO PIs.

Me too want to connect these two PIs together and thought also about a connection via their GPIOs. But also would like if not require to have a TCP/IP stack on this connection as i want to allow communications on this for standard OS applications as lets say routing purpose of the OS for example. The origin ETH ports of the PIs shall be connected to two different Ethernets where also the communication btween the two PIs shall not go on the same hardware layer as the two seperated networks.

The only alternative I were able to think about would be to enhance both PIs with an USB2Ethernet adapters and connect them over those. But ofcourse this is too expensive.

So my question would be if there exists a (simple) solution for this as I only want to connect two PIs over this conection. And if possibly there is a HowTo for that?

Thanks in advance for any information on this.

Regards
THomy

THomy
Posts: 2
Joined: Fri Feb 01, 2013 3:24 pm

Re: connecting multiple PIs together over I2C ?

Fri Feb 01, 2013 4:02 pm

Hi All!

I am absolutely new here and for real do not have any PI so far.

But I am thinking about a project where I would like to connect TWO PIs via their GPIOs. Also my project would require to have TCP/IP stack running on this connection as it should be usable on OS like a standard ethernet. The reason not to use the etheret-ports of the PIs is, that they shold be connected to different networks allowing each PI communicate in another network and using the PI-Internal connection for communication between the two networks (somehow like a several purpose routing device).

My question is: Do someone of you can imagine a (simple) solution to achieve this and may probably provide a HowTo on this?

Thanks in advance for any helpful information.

Regards
THomy

planeta9999
Posts: 13
Joined: Wed Dec 26, 2012 10:39 pm

Re: connecting multiple PIs together over I2C ?

Fri Feb 01, 2013 7:10 pm

beta-tester wrote: if i would use SPI, than i have to reserve for every additional board an additional pin to select - is this right? than i loose too many GPIO pins.
May add one decoder chip like 74HC259, then with only 3 pins decode 8 new chip select pins.

Jökull
Posts: 5
Joined: Thu Jan 03, 2013 9:55 am
Location: Zurich, Switzerland

Re: connecting multiple PIs together over I2C ?

Fri Feb 01, 2013 9:09 pm

You could perhaps do a daisy-chain of UARTs?

http://geodesicsphere.blogspot.com.au/2 ... tions.html

For TCP/IP, you perhaps could use something like SLIP?

http://en.wikipedia.org/wiki/Serial_Lin ... t_Protocol

Wild ideas, perhaps ;)

Return to “Interfacing (DSI, CSI, I2C, etc.)”