Apex Dual Orin CAN Usage#

Hardware Connection#

Function Label

Pin Label

Hardware Specification#

Item

Specification

Isolation voltage

3000V

Isolation Pin

CAN_L, CAN_H,CGND

Functions and device nodes#

Function

Description

Device Node

M_CAN0

Master Orin CAN0 (isolated)

can0

M_CAN1

Master Orin CAN1 (isolated)

can1

S_CAN0

Master Orin CAN0 (isolated)

can0

S_CAN1

Master Orin CAN1 (isolated)

can1

  • Use Port 1, connect to PC.

  • Use Port 2, connect to CAN corresponding CAN signal.

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