2x RevPi Core via PiBridge

Topics about the Software of Revolution Pi
Post Reply
mrwinter
Posts: 7
Joined: 28 Aug 2020, 15:30

2x RevPi Core via PiBridge

Post by mrwinter »

Hi, I suppose this is a software question.

The idea is to isolate the cutomer network from the internet (LTE router), but still log data from it.

On the left side, you have the Edge device, connected to the cloud via LTE, on the right side, you have a data logger, communicating with the local network.

In between, there should be a restricted communications interface, such that,
a) someone who gains full access to the Edge cannot access the customer network and,
b) someone who gains full access to the data logger cannot access the cloud or credentials.

So why not connect two RevPi Cores with a PiBridge??
At least it would look tidy.

I have never used the PiBridge, but I notice it has and "Ethernet" interface via SPI on the RevPi Core.

What software is involved in the communication via PiBridge (I have never used this before)?
Is this "Ethernet" in the classical sense, that it could be used to bridge straight to the customer network?
If I had full access to the RevPi on one side of the bridge, could I use the PiBridge to connect into the RevPi on the other side of the bridge?

If I get desperate, another option could be to cut or drill out some pin connections leaving only RS485.

Thanks!
User avatar
lukas
Expert
Posts: 186
Joined: 13 Feb 2017, 10:29

Re: 2x RevPi Core via PiBridge

Post by lukas »

Yes that is possible, there are some brief notes in the stretch 3/2019 release announcement (search for "PiBridge networking"). Basically you need to comment out piControl in /etc/modules, connect the two Cores with a PiBridge plug and boot them. They will assign themselves IP addresses in the APIPA range 169.254.0.0/16 and can ping each other. Please note that throughput is limited to about 1 or 2 MByte/s because the Ethernet chips are attached with SPI to the Raspberry Pi SoC, not via USB.
mrwinter
Posts: 7
Joined: 28 Aug 2020, 15:30

Re: 2x RevPi Core via PiBridge

Post by mrwinter »

Hi lukas, thanks for the answer!

I guess I now have the problem that the Ethernet connection via PiBrige works *too* well.
The original idea of isolating the two networks will not work because I have a chain of Ethernet connections between the internet and the cusomer network.

I guess one optoin would be to make the LAN-side RevPi so lame it can only log data and do Modbus-TCP, however this setup would be much less convincing.

Alternately I could remove the Ethernet pins, or cut away part of the Pi-Bridge and rely on RS485 for the data exchange.

Is the are similar setup possible for two RevPi Cores via the PiBridge and RS485?
Last edited by mrwinter on 01 Sep 2020, 12:49, edited 1 time in total.
User avatar
lukas
Expert
Posts: 186
Joined: 13 Feb 2017, 10:29

Re: 2x RevPi Core via PiBridge

Post by lukas »

How about configuring netfilter rules to set up a firewall on the PiBridge Ethernet?

You should also be able to talk to a neighboring Core with RS485 by opening /dev/ttyAMA0 on each of them with miniterm or something like that.
Instead of cutting away the Ethernet pins, you can just shut down the pileft/piright interfaces on each machine. Note: There are systemd units which probe for a carrier on boot and bring pileft/piright up or down, see "man pibridge-shutdown". You may need to disable those systemd units if you would like to always bring pileft/piright up or down.
mrwinter
Posts: 7
Joined: 28 Aug 2020, 15:30

Re: 2x RevPi Core via PiBridge

Post by mrwinter »

Hello,

RS485 seems to work easliy between two RevPi Cores using the PiBidge.
I notice the termination resistance is connected to GPIO40 and I assume contolled by software.

Given that I have disabled piControl in /etc/modules on all RevPi Cores, is there a good (recommended) way to control the termination resistance?
User avatar
dirk
KUNBUS
Posts: 2174
Joined: 15 Dec 2016, 13:19

Re: 2x RevPi Core via PiBridge

Post by dirk »

Hi mrwinter, on the RevPi Core you can control the GPIOs like usual
https://www.raspberrypi.org/documentation/usage/gpio/

After a review on the schematics of the RevPi Core 3 "RS485_TERMINATION" is on GPIO 41:
Schematics Revpi Core 3 RS485_TERMINATION
Schematics Revpi Core 3 RS485_TERMINATION
2020-09-16 15_02_26-SchematicPrintsRevPiCore.pdf und 1 weitere Seite - Geschäftlich – Microsoft​ Edg.jpg (54.69 KiB) Viewed 8024 times
Here is a quickhack for a proove

Code: Select all

sudo su
sudo chmod 222 /sys/class/gpio/export /sys/class/gpio/unexport
echo "41" > /sys/class/gpio/export
cat /sys/class/gpio/gpio41/direction
#out
cat /sys/class/gpio/gpio41/value
#0
echo 1 > /sys/class/gpio/gpio41/value
cat /sys/class/gpio/gpio41/value
#1
mrwinter
Posts: 7
Joined: 28 Aug 2020, 15:30

Re: 2x RevPi Core via PiBridge

Post by mrwinter »

Thanks Dirk, pins it is then.

I will give it a try soon, expecting 120Ohms or high impedance on the A/B pins depending on the output settings of GPIO 41.
mrwinter
Posts: 7
Joined: 28 Aug 2020, 15:30

Re: 2x RevPi Core via PiBridge

Post by mrwinter »

Works!

Code: Select all

sudo chmod 222 /sys/class/gpio/export /sys/class/gpio/unexport
echo "41" > /sys/class/gpio/export
cat /sys/class/gpio/gpio41/direction
echo "out" > /sys/class/gpio/gpio41/direction
echo 1 > /sys/class/gpio/gpio41/value
Changes the resistance between the A/B pins from ~ 200kOhms to 128Ohms.
Note: the RS485 pins are at the BACK of the pi-bridge.
User avatar
dirk
KUNBUS
Posts: 2174
Joined: 15 Dec 2016, 13:19

Re: 2x RevPi Core via PiBridge

Post by dirk »

Hi mrwinter, thank you for your positive feedback!
Post Reply