This example demonstrates the MYD-AM335X series of the same type of two development board how to use Linux APIs to send and receive data from CAN bus, please refer to the source code for detail.
U16 7,8 Pin were connected to the same type of development board 7,8 Pin
CON2 1,2 Pin were connected to the same type of development board 1,2 Pin
Disconnect jumper cap JP7,Shorted JP4, J17 1,2 Pin were connected to the same type of development board 1,2 Pin
Software Preparation:
Linux Kernel 4.1.18
can_test application
ip link applicatoin
Board Type
MYD-AM335X
MYD-AM335X-Y
MYD-AM335X-J
Operation node
can1
can1
can0
Test Steps:
Copy cross compiled <WORKDIR>/Examples/can/can_test to /usr/bin directory of the MYD-AM335x series development board, run can_test application as below:
1 2 3 4 5 6 7 8 9 10
# can_test --help Usage: can_test [options]
Version 1.0 Options: -d | --device name can device name: can0 -b | --baudrate baudrate set baudrate, default baudrate:50000 -l | --loop operate circularly, default not operate circularly! -w | --write frame frame string with format ID#MESSAGE. such as: 123#112233445566 -h | --help Print this message
1 2 3
# 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:
近期评论