EVO ONX CAN Usage#

CAN Usage#

#

CAN Pin Definition#

Pin

Signal

Description

1

CANFD_0 L

CAN0 L

2

CANFD_0 H

CAN0 H

3

CANFD_1 L

CAN1 L

4

CANFD_1 H

CAN1 H

Function and Device Node#

Function

Device Node

CAN_0

CAN0

CAN_1

CAN1

Usage#

CAN Configuration#

Preparation#

PC

#Install
sudo apt-get install can-utils -y
 
#After connecting the USB to CAN (PCAN) device to a PC, execute the command and the output result will be the name of the CAN interface.
ls /sys/class/net/ | grep -E 'can[0-9]+' | sort -V | tail -n 1
 
#Configuration
sudo ip link set can0 up type can bitrate 500000 sjw 4

Receive-Send test#

The device sends data and the PC receives it.

Device

#Execute command to send data.
sudo cansend can0 123#abcdabcd

PC

#Execute command to receive data.
sudo candump can0
#If the following message is printed, it indicates that the data has been successfully sent from the device side.
can0  123   [4]  AB CD AB CD

PC sends data and the device receives it.

PC

#Execute command to send data.
sudo cansend can0 123#abcdabcd

Device

#Execute command to receive data.
sudo candump can0
#If the following message is printed, it indicates that the data has been successfully sent from the PC side.
can0  123   [4]  AB CD AB CD

Troubleshooting#

When you are unable to receive data, experiencing packet loss, or communication interruptions, you can use the following command to view the status information of can0.

ip -d -s link show can0
# Check if 1 is the same as the previously set value.
# Check if 2 and 3 are both 0.
# If 1, 2, and 3 are all fine, check the hardware connection.
# If there are issues and you cannot identify the problem, please contact technical support for further investigation.

Reference#

https://www.kernel.org/doc/html/latest/networking/can.html

linux-can/can-utils