Login to device
To check for the can0 node run the 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 the below command
root@imx8mq-trux-q01:~# ip link set can0 up type can bitrate 125000
CAN can be tested using 2 ways
- Device to device
- Device to Host PC
1. Connect both devices over CAN
On device A run the following command
$ candump can0
On device B run the following command
$ root@imx8mq-trux-q01:~# cansend can0 500#DEADBEEF
2. To test CAN, connect the host PC with the device via CAN to USB converter and run the following command
root@imx8mq-trux-q01:~# cansend can0 500#DEADBEEF
Check the PC terminal whether data is received. The received data will look as below
Frame ID: 0500, Data: ef be ad de