Skip to main content

CAN Bus

Hardware

One CAN FD bus is integrated into the AutomatePro with a max data rate of 8Mbs. A 120ohm termination resistor should be placed between CAN_H and CAN_L at both ends of the CAN network.

Connector Pinout

CAN Specifications

ParameterValue
TransceiverTCAN3413DDFR
CAN FDYes
Max data rate8Mbs
Integrated 120ohm termination resistorNo
CAN H and L input protection< +-58V

Software

To utilize the network, it is necessary to configure the interface properties. For instance, to set the network interface with a bus bit rate of 500 kbps, use the following commands:

sudo ip link set can0 up type can bitrate 500000 berr-reporting on

Install CAN utilities for testing:

sudo apt-get install can-utils

This command transfers a packet to can0 with CAN ID 123 and data 'abcdabcd':

cansend can0 123#abcdabcd

This command receives packets from any CAN node connected to the bus:

candump -x any

For more information about the use of cansend, enter this command:

cansend --help

You can use other tools, such as cangen, for different filtering options.

Troubleshooting

Loopback test

You can perform a loopback test to determine whether the controller is working.

Ensure the CAN drivers are loaded. To check if the drivers are loaded use the following command:

lsmod | grep mttcan

If the drivers are not loaded, enter this command:

sudo modprobe mttcan

To perform a loopback test, run the following commands:

sudo ip link set can0 type can bitrate 500000 loopback on
sudo ip link set can0 up
candump can0 &
cansend can0 123#abcdabcd

If the loopback test is successful, the last command displays this:

can0 123 [4] AB CD AB CD
can0 123 [4] AB CD AB CD

Other Methods

Additional debugging techniques to consider:

  1. If a loopback test shows that the controller is working correctly and you are still not able to send or receive packets, try reconnecting the transceiver and confirm that the connections are correctly made.

  2. Check if the mttcan driver is loaded.

  3. Connect an oscilloscope to analyze the bus signal integrity and verify proper operation.

  4. If the device logs a No buffer space available message during send, enter this command to use the polling mechanism:

    cangen -L 8 can0 -p 1000