Jetson/L4T/peripheral/CAN

= CAN Loopback test =

Steps to verify
$ sudo /opt/nvidia/jetson-io/jetson-io.py
 * 1) Configure pinmux for CAN bus through Jetson IO
 * 2) *Run Jetson-IO

Configure Jetson 40pin Header -> Configure header pins manually -> Enable can0/can1 as following -> Back -> Save pin changes -> Save and reboot to reconfigure pins -> Enter [*] can0          (29,31) [*] can1          (33,37)
 * 1) *Enable can0 and can1

$ sudo busybox devmem 0x0c303018 //can0_din - 0xC454 $ sudo busybox devmem 0x0c303010 //can0_dout - 0xC400 $ sudo busybox devmem 0x0c303008 //can1_din - 0xC454 $ sudo busybox devmem 0x0c303000 //can1_dout - 0xC400
 * 1) * Check pinmux register

$ sudo modprobe can => can: controller area network core $ sudo modprobe can_raw => can: raw protocol $ sudo modprobe mttcan => net canX: mttcan device registered (regs=00000000b6e0395a, irq=51)
 * 1) 2. Enable CAN
 * 2) *2-1 Load kernel modules

$ sudo ip link set can0 up type can bitrate 500000 dbitrate 1000000 berr-reporting on fd on $ sudo ip link set can1 up type can bitrate 500000 dbitrate 1000000 berr-reporting on fd on
 * 1) *2-2 Setup interface

$ ifconfig can0: flags=193 mtu 72 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 51 can1: flags=193 mtu 72 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 52
 * 1) *2-3 Check can interface

$ candump -x any &
 * 1) 3. Test
 * 2) *3-1 Run candump for all interface in background

$ cansend can0 123#abcdabcd can1 RX - -  123   [4]  AB CD AB CD  can0  TX - -  123   [4]  AB CD AB CD
 * 1) *3-2 Run cansend from can0-TX, and you will see it receive the same data from can1-RX