Trucrux Inc

Testing CAN

Login to device

To check for can0 node run following command

root@imx8mq-trux-q01:~# ifconfig

Search for below log

can0: flags=193<UP,RUNNING,NOARP> mtu 16 metric 1
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 10 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 73

if not enabled, enable it by running below command

root@imx8mq-trux-q01:~# ip link set can0 up type can bitrate 125000

CAN can be tested using 2 ways

  1. Device to device
  2. Device to Host PC

1. Connect both devices over CAN

On device A run following command

root@imx8mq-trux-q01:~# cansend can0 500#DEADBEEF

On device B run following command

$ candump can0

2.  To test CAN, connect host PC with device via CAN to USB converter and run the following command

root@imx8mq-trux-q01:~# cansend can0 500#DEADBEEF

Check PC terminal whether data is received. The received data will look as below

Frame ID: 0500, Data: ef be ad de