3.1. Introduction

Controller area network (can) is a kind of serial communication network which can effectively support distributed control or real-time control. Can bus is a bus protocol widely used in automobile, which is designed as the communication of microcontroller in automobile environment.

Notices:The CAN FD bit filling function of RK3568 is different from the CAN FD standard protocol, and CAN FD is not recommended.

3.2. Hardware Connection

Connection between two CAN devices, only need CAN_H to CAN_H, CAN_L to CAN_L.

3.3. DTS Configuration

  • Common arch/arm64/boot/dts/rockchip/rk3568-firefly-port.dtsi

     
  • Board arch/arm64/boot/dts/rockchip/rk3568-firefly-aioj.dtsi

     

the nodes on the hardware interface corresponding to the software are:

3.4. Communication

3.4.1. CAN communication test

Use the “candump” and “cansend” tools directly to send and receive messages, push tool into /system/bin/ . Tools “candump/cansend” download from Officail link or github.

 

3.5. More Command

3.6. FAQS

Summarize several problems and solutions encountered during debugging.

3.6.1. Check if the CAN_H and CAN_L lines of the bus are loose or connected in reverse.

The receiving end only successfully received the message once, and then no longer received the message.

3.6.2. Configuration about clock rate

3.6.2.1. CAN

If the bitrate of CAN is 1M, it is recommended to modify the CAN clock rate to 300M to make the signal more stable. If the bitrate is lower than 1M, the clock rate can be set to 200M.

3.6.3. Change clock rate

Note:

  • under some clock rate frequencies, the bitrate of CAN cannot obtain accurate rate. We can adjust the assigned clock rates to solve it
  • Check bitrate