CAN Bus Specifications and Troubleshooting¶
The CAN bus is a robust field bus that is used in IDCP for communication between the IOC and motor control devices, power supplies and temperature sensors.
Cabling¶
We use a shielded twisted pair cable with 9 pin D-Sub plugs.
This is the pin-allocation as we use it here:
Pin |
Signal |
Description |
---|---|---|
2 |
CAN_L |
CAN bus signal (dominant low) |
3 |
CAN_GND |
CAN ground |
7 |
CAN_H |
CAN bus signal (dominant high) |
Topology¶
All participants on the CAN bus must be connected in bus topology. You must not have branches on your network.
Termination¶
With our standard cable the CAN bis must be terminated with 120 Ohm at both ends.
VME-CAN4 Interface card¶
For VME bus IOCs we use mostly the VME-CAN4 interface card for CAN Bus communication.
Manual¶
The hardware manual can be found here:
VME-CAN4 diagnostic LEDs¶
There are three rows with 4 LEDs each:
Column A |
Column B |
Column C |
Column D |
---|---|---|---|
LED1:A |
LED1:B |
LED1:C |
LED1:D |
LED2:A |
LED2:B |
LED2:C |
LED2:D |
LED3:A |
LED3:B |
LED3:C |
LED3:D |
LED states:
LED |
LED off |
LED on |
---|---|---|
LED 1:A |
SYSFAIL not active. |
SYSFAIL active |
LED 1:B |
No VMEbus access |
Access from VMEbus to |
LED 1:C |
No VMEbus interrupt |
The VMEbus-interrupt |
LED 1:D |
From PCB version >= BAxxxx on, this LED is no longer |
|
LED2:A…D |
The respective CPU |
The initialization of |
LED 3:A…D |
The error flag of |
The error flag of the |
CAN Cable lengths¶
With the CAN bus, the baud rate limits the maximum cable length.
Bit rate |
Typical values of reachable |
CiA recommendations |
---|---|---|
1000 |
37 |
25 |
800 |
59 |
50 |
666.6 |
80 |
|
500 |
130 |
100 |
333.3 |
180 |
|
250 |
270 |
250 |
166 |
420 |
|
125 |
570 |
500 |
100 |
710 |
650 |
66.6 |
1000 |
|
50 |
1400 |
1000 |
33.3 |
2000 |
|
20 |
3600 |
2500 |
12.5 |
5400 |
|
10 |
7300 |
5000 |
Troubleshooting¶
If you don’t have a connection check the following.
Termination¶
The CAN bus must have termination of 120 Ohm at both ends. Without termination it only works for very short cable lengths in the region of 1m.
A common problem is that the termination resistor is missing at one or both ends.
The VME-CAN4 card sometimes has a termination resistor directly on the card.
In newer installations we use D-Sub connections with a built-in resistor that can be switched on and off.
If the termination resistors are in the connector you can unplug all CAN devices and measure the resistance between PIN 2 and 7. With correct termination at both ends you should measure 60 Ohm.
Connectors¶
Open connectors and check that PINs 2, 3 and 7 are connected to the correct wires. Make sure that CAN_H and CAN_L are not swapped.
Ports¶
The VME-CAN4 card has 4 CAN Bus ports. Make sure that the cable is plugged to the right port.
This is the current CAN Port use with IDCP, note that we start counting with zero here:
CAN Port |
Usage |
Baud rate |
---|---|---|
0 |
Connection to monochromator |
500 kBit |
1 |
Connection to Collectior IOC |
66 kBit |
2 |
Connection to motor controllers (UniDrive) |
1 MBit |
3 |
Connection to power supplies and temperature modules |
1 MBit |
Connecting the cable to the wrong port disrupts communication between all other participants if the Baud rate doesn’t match.
Diagnose with a Linux Notebook¶
Any Linux notebook with a CAN-USB interface that is supported by the Linux kernel can be used to diagnose problems further.
First you have to initialize the CAN interface with the correct baud rate before you connect it to your CAN bus line. The baud must be an integer between 10000 and 1000000, the transfer speed in Bit/sec.
Enter:
sudo ip link set can0 type can bitrate BAUDRATE
sudo ip link set can0 txqueuelen 1000
sudo ip link set up can0
You can see your can interface with:
ip link show type can
You must have the program ‘candump’ installed. Usually this is part of a package named “can-utils”.
You start a simple diagnose with:
candump -t A can0
candump has many options, see also candump -h
.
CAN line to the monochromator¶
Diagnose with LED¶
As described at VME-CAN4 LEDs in the third row of LEDs there is an LED for each CAN port.
If the first LED in the third row is red, there is a CAN communication problem with the monochromator detected by the CAN bus card. The CAN bus card can detect if there isn’t any receiver on the CAN bus line. If the VME CAN interface card on the monochromator is set up with the correct baud rate and connected to the undulator and the CAN cable termination is correct, you shouldn’t see a red LED.
Diagnose with channel access¶
For an undulator with name DEVICENAME enter:
watch -n 1 caget -a DEVICENAME:BaseStatIStat
If you see TIMEOUT
or TIMEOUT invalid
the undulator didn’t get a response
from the monochromator.
Diagnose with Linux notebook¶
When you use a Linux notebook as described at Linux notebook.
Ensure that the baud rate of the CAN bus interface of the linux notebook is correct. Baud rates are shown here Baud rates. Usually the baud rate here is 500 kBit.
Caution
A wrong baud rate on the Linux notebook will disrupt all CAN communication.
You should see, among others, the CAN objects shown below. The undulator IOC sends the outgoing CAN objects at least every 5 seconds:
Variable |
outgoing CAN object |
incoming CAN object |
length |
remarks |
---|---|---|---|---|
Gap status [1] |
724 |
660 |
5 |
stop: 1 run: 3 |
980 |
916 |
5 |
increasing counter |
Now you can do the following to locate the problem:
Check if the Undulator IOC has a problem¶
Connect the Undulator IOC directly to the Linux notebook, remove the CAN cable to the monochromator. Ensure that the CAN termination is still correct. If you see that the Undulator IOC sends CAN objects, this shows than the CAN bus card in the Undulator IOC works and the Undulator software works. If not, the problem is with the Undulator IOC hardware or software.
Check if the cable prevents the sending of CAN objects¶
Keep the Linux notebook connected but attach the CAN bus cable to the monochromator, too. Ensure that the termination is still correct. This shows if the problem comes from the cable or something at the monochromator IOCs. Look if the Undulator gets replies from the monochromator.
Check if one of the monochromator IOCs causes the problem¶
Unplug all monochromators from the cable. If you see that the Undulator IOC now sends CAN objects, it shows that the cable and it’s termination are okay.
Connect each of the monochromators separately, this shows which monochromator causes the problem.