
Note: You can send command by console!
Note: Test code execution is complete!
Example: The following example shows the usage log after running the
sdo
command without any parameters.
SDO Command:
sdo
usage: sdo -type index subindex nodeid data
type = "r"(read), "w"(write), "b"(block)
index = 0~0xFFFF,unsigned short
subindex = 0~0xFF,unsigned char
nodeid = 1~127,unsigned char
data = 0 ~ 0xFFFFFFFF
13.3.5 Running the Socketcan commands
This section describes the steps for running Socketcan commands that can be performed on either of the boards (LS1021A-IoT
or LS1021ARDB). These commands are executed on Linux. The standard Socketcan commands are the following:
1. Open the can0 port.
$ ip link set can0 up
2. Close the can0 port.
$ ip link set can0 down
3. Set the baud rate to 500K for the can0 port
$ ip link set can0 type can bitrate 500000
4. Set can0 port to Loopback mode.
$ ip link set can0 type can loopback on
5. Send a message through can0.
002
(HEX) is node id, and this value must be 3 characters.
2288DD
(HEX) is a message,
and can take a value up to 8 bytes.
$ cansend can0 002#2288DD
6. Monitor can0 port and wait for receiving data.
$ candump can0
7. See can0 port details.
$ ip -details link show can0
The third and fourth commands are valid when the state of can0 port is closed.
NOTE
13.3.6 Testing CAN bus
Below is the sample code for testing the CAN bus on LS1028ARDB.
[root@OpenIL:~]# ip link set can0 down
[root@OpenIL:~]# ip link set can1 down
NXP Semiconductors
FlexCAN
Open Industrial User Guide, Rev. 1.8, 05/2020
User's Guide
176 / 199