-h | --help Print this message
# ip link set can1 down
# ip link set can1 type can bitrate 50000 triple-sampling on
# ip link set can1 up
The previous processes are no need to be executed manually. During running
can_test
, it will be set automatically. One board is used as sender, the other is
used as receiver, they communicate with can_test application as below:
# chmod 777 /usr/bin/can_test
# can_test -d can0 -w 123#112233445566
[ 5783.823623] c_can_platform 481cc000.can can0: setting BTR=1c1d BRPE=0000
[ 5786.888723] can: controller area network core (rev 20120528 abi 9)
[ 5786.895565] NET: Registered protocol family 29
[ 5786.952090] can: raw protocol (rev 20120528)
====== write frame: ======
frame_id = 0x123
frame_len = 6
frame_data = 0x11 0x22 0x33 0x44 0x55 0x66
===========================
Execute the following command at other board to receive data as below:
# chmod 777 /usr/bin/can_test
# can_test -d can1 -l
[ 5888.821956] c_can_platform 481d0000.can can1: setting BTR=1c1d BRPE=0000
[ 5891.884726] can: controller area network core (rev 20120528 abi 9)
[ 5891.898711] NET: Registered protocol family 29
[ 5891.952878] can: raw protocol (rev 20120528)
can1 0x123 [6] 0x11 0x22 0x33 0x44 0x55 0x66
-l option is used for operating circularly.
Note: In case of the following error, please modify the value of "tx_queue_len"
as below:
# can_test -d can0 -w 123#112233445566
can raw socket write: No buffer space available
# echo 1000 > /sys/class/net/can0/tx_queue_len
42