The is a Raspberry Pi 3 Compute based industrial Linux box.
It runs Raspbian with some additions.
There's a set of industrial hardware extensions. In this blog I review the isolated CAN port.
The gateway has a physical CAN driver. That's a piece of hardware that's not available on the standard Raspberry Pi family.
On a Pi, the CAN protocol itself is implemented in Linux/HW and you have access to the Tx and Rx signals on logic level.
The physical layer of the CAN protocol (driver IC and isolation/protection circuit) is something you add when you want to connect the Pi to a CAN BUS.
The CAN signals are available on a terminal block. An internal jumper (J23) configures the termination resistor.
If this is the first or last device on the bus, you place the jumper. Else you remove it.
Driver, isolation and protection circuit
On the gateway, the driver is a TI .
Input protection is done with a DF2S6.8FS,L3M on both signal lines.
- Voltage - Reverse Standoff (Typ): 5V (Max)
- Voltage - Breakdown (Min):6.4V
- Voltage - Clamping (Max) @ Ipp: 9V (Typ)
- Current - Peak Pulse (10/1000µs): 1A (8/20µs)
AVNET specifies an isolation level between bus and the rest of the gateway of 2kV.
The CAN terminal block has the typical 3 connections: CAN Hi, CAN Lo and Ground.
The Ground is not shared with any other ground on the gateway.
When connecting the gateway to a CAN bus, you have to use a twisted pair for the two signal wires. the photo in the header of this post shows an example.
The ground signal is a straight wire.
There is no defined colour code convention for CAN wiring. I've used the SAE J1939-11 colours.
I used a Microchip CAN BUS Analyser as "the other device on the bus".
Because my test bus has only two devices, both are end-of-line devices and need to have the termination resistors enabled.
On the analyser, this is done via the GUI. As mentioned before, you have to place jumper J23 on the gateway.
You connect Ground to Ground, Hi to Hi and Lo to Lo.
The software CAN driver is a Linux component. It's designed to be as similar as possible to other Linux network drivers.
You have to enable that CAN network in Linux before you can communicate over the bus.
This is done by removing the comment in front of the can0 section in /etc/network/interfaces.
In this experiment, I'm using the Linux candump and cansend utilities to for sending and receiving data.
In the send scenario, the analyser's GUI is used to display the result.
For reading, the GUI is used to let the analyser inject a payload on the bus
Receive scenario - listen to the bus and log all traffic
Transmit scenario - generate traffic and inject into the bus
cansend can0 01a#11223344AABBCCDD
As you can see in both captures, the test are successful. The infrastructure works.