[AIOT] CanBus for Tinker Board 3N

The Linux CAN is depending on the SocketCAN:

http://en.wikipedia.org/wiki/SocketCAN

 

1. Run the CAN testing script (CAN loopback mode) and reboot device after running script:

Please use the bellowing command with root privilege by “sudo su” command in Debian and “adb root” in androids

Note: The testing files: can_loopback.sh, can_tx.sh, can_rx.sh

CAN_test_scripts.zip

~/code/CAN/CAN_test$ sudo ./can_loopback.sh
[sudo] password for asus:
Start can tx/rx loop with iface can0 !
candump: no process found
20:21:51.967: can0 send 001#0011223344556677
  can0  001   [8]  00 11 22 33 44 55 66 77
  can0  001   [8]  00 11 22 33 44 55 66 77
20:21:51.975: can0 receive can packet
….
~/code/CAN/CAN_test$ sudo reboot  
 

2. Use two devices A (Sender) and B (Receiver)

In B device (Receiver): refer can_rx.sh

# ip link set can0 down
# ip link set can0 up type can bitrate 125000
# candump can0
 

In A device (Sender): refer can_tx.sh

# ip link set can0 down
# ip link set can0 up type can bitrate 125000
# cansend can0 001#0011223344556677
 

3. Then we can see the dump message in B device

can0  001   [8]  00 11 22 33 44 55 66 77
can0  001   [8]  00 11 22 33 44 55 66 77