What has to be taken into account concerning a proper CAN bus wiring as the base of a reliable CAN bus communication?
There are some important points which have to be taken into account by the wiring of a CAN bus network. The main important ones are:
- A CAN bus termination (of 120 Ohm each) must be present at the two physical end points of the CAN network.
- The CAN network has to be connected from one node to the other with a bus termination for each of the two end points. A CAN network has no(!) ring topology and there should be no(!) stub lines present.
- At least one CAN device must have a fixed CAN bit rate configured. If more than one CAN device has a fixed CAN bit rate configured, it must be the same for each of these CAN devices.
- Each CAN node ID must be unique in the CAN network, i.e. all CAN slaves must have a different CAN node ID configuration.
CAN bus termination
Each CAN bus network must have bus terminators with 120 Ohm at both end points of the physical network.
The bus termination might be installed by external 120 Ohm resistors placed in between the "CAN High" and "CAN Low" wire at both end points of the network (like shown by the picture above). Some CAN devices offer internally installed bus terminators which can be switched on / off easily. In case of an EPOS2 or EPOS4 "Compact" type or in a housing the bus termination can be easily activated by a DIP switch. Please find the information in the "Hardware Reference" of your concrete EPOS product type.
There should be cables with twisted wires ("CAN High" and "CAN Low") in use. The "CAN GND" has to be connected too. If there is an extended CAN network in use or there is the risk of some EMI (by inductive loads resp. motors of a machine), it is highly recommended to use special CAN bus cables and connect the cable's shield to Earth like shown in this linked document:
How to connect a cable's shielding to Earth potential?
It is important that there are just two bus termination resistors installed or configured in a CAN network. This can be checked easily by powering down all CAN devices and measuring the resistance in between the "CAN High" and "CAN Low" wires. The measured resistance must be approximately 60 Ohm. Any value lower than 60 Ohm indicates that there are probably more than two 120 Ohm bus termination resistors present (resp. configured). A value bigger than 60 Ohm typically indicates that there is at least one bus termination resistor missing or the bus terminators have a wrong resistance value.
Finally the proper placement of the two bus terminators of 120 Ohm at both end points of the network has to be checked visually.
CAN Bus Topology
A correct CAN network topology is important to avoid CAN communication errors caused by signal reflection or disturbance.
- The CAN cable always has to connect one CAN device with the next one and so on.
- A CAN bus is no(!) ring structure.
- Any stub lines have to be avoided or should not be longer than 30 cm.
- The maximum possible CAN Bitrate depends on the total CAN bus cable length:
-> 1 Mbit/s: max. 40 m
-> 500 kBit/s: max. 100 m
-> 125 kBit/s: max. 500 m
Examples of proper CAN bus wirings:
- CAN bus topology with the CAN master as one end point of the network:
Bus termination is done by external resistors placed at both end points of the network.
- CAN bus topology with the CAN master placed somewhere in between the network:
Bus termination by this example is done by external resistors placed at both end points of the network.
CAN bit rate
Some CAN devices (like the maxon controllers EPOS2 or EPOS4) offer the possibility to configure a so-called "Automatic bit rate detection" which listens to the bit rate of other CAN devices present by the network and adjust to it then. In this case it is important that at least one CAN device is configured for a fixed CAN bit rate. Typically the CAN master or an EPOS CAN gateway of such systems is configured for a fixed CAN bit rate.
If more than one CAN device has a fixed CAN bit rate configured, it has to be ensured that all CAN devices with a fixed CAN bit rate configuration have the same setting present.
CAN node ID
Every CAN slave in a CAN network must have a unique CAN node ID configured. If there are CAN bus collisions and CAN communication error states present, please ensure that none(!) of the CAN slaves use the same node ID. A CAN node ID of '0' is also not valid.
The CAN node ID is typically configured by DIP or HEX switches. In this case the configuration can be checked easily visually.