CAN
CAN (Controller Area Network) bus, namely Controller Area Network bus, is a serial communication network for effective distributed control or real-time control.
Warning
The CAN on the expansion pins is the chip's native interface and does not go through a CAN transceiver. An external CAN transceiver module is required for use.
The expansion pin CAN information for Rockchip platforms is as follows:
| Board | SoC | Expansion Pins |
|---|---|---|
| K1 | RK3568 | CAN X2 |
| K1B | RK3568 | None |
| K3 | RK3562 | None |
| K7 | RK3576 | CAN X1 |
| K7C | RK3576 | CAN X1 |
| K8 | RK3588 | CAN X1 |
DTS Node Configuration
The following is an example configuration for CAN device 0 node on Rockchip platforms:
Driver Files
The CAN bus driver path for RK3568/RK3588 platforms is as follows:
The CAN bus driver path for RK3562 platform is as follows:
The CAN bus driver path for RK3576 platform is as follows:
Query Current CAN Devices
Query current network devices:
Operation Example:
console$ ifconfig -a
...
can0 Link encap:UNSPEC Driver rk3576_canfd
NOARP MTU:16 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:0 TX bytes:0
Interrupt:63
...
CAN Configuration
Disable CAN:
Set can0 to a bitrate of 500Kbps and disable CAN FD mode:
Set can0 arbitration segment to 1M baud rate, data segment to 3M baud rate, and enable CAN FD mode:
View can0 configuration information:
Enable CAN:
CAN Send
Send (Standard frame, Data frame, ID:123, data:DEADBEEF):
Send (Standard frame, Remote frame, ID:123):
Send (Extended frame, Data frame, ID:00000123, data:DEADBEEF):
Send (Extended frame, Remote frame, ID:00000123):
CAN Receive
Enable printing and wait for reception: