umardastgir
Posts: 26
Joined: Thu Jan 25, 2018 8:23 pm

Pi to Pi communication

Mon Sep 10, 2018 7:22 pm

I have a stack of 4 raspberry Pi's and I have a GPS with I2C and serial output. I have to make sure that all 4 Raspberry pis get the GPS output. Recently, I tried setting up the GPSD and it worked pretty well. However, I recently found out that I should not use any network based solution (no routers or the internet).
I tried shorting the RX pins on 4 Pis and connecting them to the GPS pin TX. Unfortunately, it gives me a kernel panic on Pi startup, as the voltage levels might be different on RX pins of different pis at different times.
Is there any hardware based solution I can try out? Is there any way I can multiply the signal by 4 and feed it to all raspberry pis separately? Please note that communicating via network is not an option (this includes setting up one raspberry pi as an access point). Thanks

DirkS
Posts: 10018
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Pi to Pi communication

Mon Sep 10, 2018 10:42 pm

umardastgir wrote:
Mon Sep 10, 2018 7:22 pm
However, I recently found out that I should not use any network based solution (no routers or the internet).
Network based <> no router or the internet
You can have a LAN without routers/internet. So what exactly is the requirement?

klricks
Posts: 6624
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Pi to Pi communication

Mon Sep 10, 2018 11:56 pm

umardastgir wrote:
Mon Sep 10, 2018 7:22 pm
I have a stack of 4 raspberry Pi's and I have a GPS with I2C and serial output. I have to make sure that all 4 Raspberry pis get the GPS output. Recently, I tried setting up the GPSD and it worked pretty well. However, I recently found out that I should not use any network based solution (no routers or the internet).
I tried shorting the RX pins on 4 Pis and connecting them to the GPS pin TX. Unfortunately, it gives me a kernel panic on Pi startup, as the voltage levels might be different on RX pins of different pis at different times.
Is there any hardware based solution I can try out? Is there any way I can multiply the signal by 4 and feed it to all raspberry pis separately? Please note that communicating via network is not an option (this includes setting up one raspberry pi as an access point). Thanks
1. The GPS TX must be 3V3 TTL. If 5V TTL or RS232 levels then all 4 RPI's will be destroyed if they haven't been already. If not 3V3 then you will need level shifter circuits between the GPS and RPi.
2. There must be common grounds between the GPS and all RPi.
3. I would use a 1-IN 4-OUT line driver.

You mention Pi to PI communication but only talk about GPS to RPi?
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

Heater
Posts: 13916
Joined: Tue Jul 17, 2012 3:02 pm

Re: Pi to Pi communication

Tue Sep 11, 2018 3:38 am

umardastgir,

Given that your serial connections are quite short it should be perfectly possible to connect a serial Tx to the Rx on four other devices. Be sure they are all working at 3.3v else you will probably damage something otherwise.

You will need all the ground pins connected together as well.

There is no way this kind of connectivity should cause a kernel panic. Sounds like you made an error in your connections or something is using 5v or worse still RS232 signal levels. Or you have some other problem in your system.

I presume you have configure the serial ports on your Pi s correctly and have tested this works with just one Tx and one Rx.

A more robust and professional way to so this would be to use some serial line driver chips. Perhaps a multi-drop RS422/RS485 set up. https://www.youtube.com/watch?v=9O_NgoU1CUc this will help protect your Pi from damage and allow faster data rates over longer distances.
Memory in C++ is a leaky abstraction .

bask185
Posts: 120
Joined: Thu Mar 09, 2017 11:39 am
Location: Netherlands

Re: Pi to Pi communication

Tue Sep 11, 2018 5:54 am

klricks wrote:
Mon Sep 10, 2018 11:56 pm

1. The GPS TX must be 3V3 TTL. If 5V TTL or RS232 levels then all 4 RPI's will be destroyed if they haven't been already. If not 3V3 then you will need level shifter circuits between the GPS and RPi.

You mention Pi to PI communication but only talk about GPS to RPi?
Just for my information, are the GPIO pins of the rpi protected with a internal diode circuit as convention uControllers are??

Usually if I connect Tx and Rx pins of a 5V and a 3V3 device, all I use is one 100ohm resistor between the 5V's Tx and the 3V3's Rx to limit the current.

But ofcourse without this resistor............

User avatar
rpdom
Posts: 15600
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Pi to Pi communication

Tue Sep 11, 2018 6:16 am

bask185 wrote:
Tue Sep 11, 2018 5:54 am
Just for my information, are the GPIO pins of the rpi protected with a internal diode circuit as convention uControllers are??
No. There are some diodes in there, but they are not designed to handle over-voltage situations. Put much more than 3.3V or less than 0V into a GPIO and you can burn out the entire bank. This may not happen instantly.

Use one of the gpio pintest utilities to check if your GPIOs are still working.

umardastgir
Posts: 26
Joined: Thu Jan 25, 2018 8:23 pm

Re: Pi to Pi communication

Tue Sep 11, 2018 5:59 pm

I have double checked the connection but still, I seem to get kernal panic. Below is a list of my connections:

1) The 3.3V of all the Raspberry Pis have been connected (shorted out), and connected to the Vcc of the GPS
2) The ground pins of all the Raspberry pis have been shorted out.
3) The RX pins of all the Raspberry Pis have been shorted out and connected to the TX of the GPS
4) Although this isn't really needed, I have also shorted out the 5V pin of all 4 Pis.

Upon startup, the system seems to crash. It keeps on printing out memory segments. I have checked and GPS module seems to get 3.3 Volts. I have no idea what I am doing wrong. If I disconnect the GPS TX pin with the raspberry pis RX pins (while keeping all 4 Raspberry Pi RX pins shorted), the Pies boot up properly and everything goes fine. Can anyone point out what I am doing wrong?

EDIT: I am using Raspberry Pi Zero W and a Raspbian Jessie Image

klricks
Posts: 6624
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Pi to Pi communication

Tue Sep 11, 2018 7:34 pm

umardastgir wrote:
Tue Sep 11, 2018 5:59 pm

1) The 3.3V of all the Raspberry Pis have been connected (shorted out), and connected to the Vcc of the GPS
I would not connect all the 3V3 together. Only connect 3V3 from one RPi to the GPS.
What is the current draw specification of the GPS? Link to data sheet?
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

umardastgir
Posts: 26
Joined: Thu Jan 25, 2018 8:23 pm

Re: Pi to Pi communication

Tue Sep 11, 2018 8:31 pm

I have connected 3.3 Volts together to supply each pi with power.
One thing which I have noticed is that all four raspberry pi's were crashing on startup, but once I disable the serial console port, everything seems to be working fine now. How does disabling the serial console makes the raspberry pi work?

The GPS module I am using is:
https://www.banggood.com/Ublox-NEO-7M-F ... PbEALw_wcB

The max current is 35mA and the max current supplied by the 3.3V pin is 80mA, so I think thats not the problem

Andyroo

Re: Pi to Pi communication

Tue Sep 11, 2018 8:48 pm

Only thing I can think of is that the serial port is still configured somewhere as the console and the input data is being taken as commands and causing the error.

I know it took me a couple of goes to be able to use the TX/RX pins as serial and I think I ended booting the GUI to do it!

User avatar
davidcoton
Posts: 4259
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Pi to Pi communication

Tue Sep 11, 2018 9:23 pm

First, as others have said, do not connect the 3V3 supplies. Each Pi will generate it's own 3V3, if they are not exactly the same (and they probably aren't) they will fight, which can crash a Pi. Just supply the GPS from one Pi.

Second, do not connect the 5V supplies. At best unnecessary if each Pi runs from one common PSU, at worst the separate PSUs will fight. And in the process you bypass the onboard power protection.

Third, check what @Andyroo says. That seems the most likely source of a kernel panic.
Signature retired

Return to “General discussion”