CAN bus introduction

This article describes the CAN protocol is used, most of the content from the know almost: breath from zero to read the CAN bus reprint.

0 Summary

Since the 1980s, there have been more and more automotive ECUs, such as ABS, electronically controlled doors and windows, and electronic fuel injection devices. If the conventional point-to-point wiring method is still used, that is, one end of the wire is connected to the switch and the other end is connected to the electrical equipment, it will lead to a sharp increase in the number of wires on the car, which will bring about the redundancy of the wiring harness and the increase of maintenance costs. This puts forward higher requirements for the wiring harness distribution and information communication of automobiles. Bus technology can realize the real-time sharing of information, and solve the problems of many wire harnesses, difficult wiring, and high cost in traditional wiring methods. CAN (Controller Area Network) bus technology emerged at the historic moment.

Point-to-point communication & bus communication

1 Introduction

The CAN bus was developed by the German company BOSCH, which is famous for its research and development and production of automotive electronic products, and eventually became an international standard (ISO11519), which is one of the most widely used field buses in the world. CAN bus is a multi-master (Multi-Master) bus system. Traditional bus systems such as USB or Ethernet realize the transmission of large amounts of data from node A to node B under the coordination of the bus controller. The CAN network message is broadcast, that is, the data detected by all nodes on the network at the same time is the same. It is a serial communication bus based on the message broadcast mode.

CAN bus example
Many advantages of CAN bus make it widely used, such as transmission speed up to 1 Mbps, communication distance up to 10 km, lossless bit arbitration mechanism, and multi-master structure.

2 CAN bus standard

The CAN bus standard specifies the physical layer and the data link layer, and the application layer needs to be customized by the user. Different CAN standards differ only in the physical layer.

  • Physical layer and data link layer: ISO11898
  • Application layer: different application areas use different application layer standards

CAN bus standard

3 CAN physical layer

3.1 CAN topology network

The devices connected to the CAN bus are called CAN Nodes. The topology of the CAN network is generally linear. The most commonly used wire harness is twisted pair, and the wire transmission is a symmetrical differential level signal. The figure below is a schematic diagram of the CAN bus network. The nodes mainly include Host, controller and transceiver. The Host is often integrated with a CAN controller, which is responsible for processing protocol-related functions to reduce the burden on the Host. The CAN transceiver connects the controller to the transmission medium. Usually the controller and the bus transceiver are isolated by optocoupler or magnetic coupling, so that even if the transceiver is damaged by overvoltage on the bus, the controller and Host device can be protected.

When sending data, the CAN controller sends the binary code to be sent to the CAN transceiver through the CAN_Tx line, and then the transceiver converts this ordinary logic level signal into a differential signal, and outputs it to the CAN bus through the differential lines CAN_High and CAN_Low The internet. The process of receiving data is the opposite. Using differential signals can achieve better electromagnetic compatibility effects. Therefore, the physical transmission medium of the CAN bus only needs two wires .
CAN topology network

Note: ECU (Electronic Control Unit) electronic control unit, also known as "travel computer", "vehicle computer", etc.

The highest signal transmission rate of the high-speed CAN bus is 1 Mbps, and the longest distance is 40 m. ISO11898-2 requires the installation of termination resistors RL on the two sections of the high-speed CAN bus (termination resistance is generally 120 Ω, because the characteristic impedance of the cable is 120 Ω, in order to simulate an infinite transmission line.) to eliminate reflections. The maximum speed of low-speed CAN is only 125 Kbps, so ISO11898-3 has no termination requirements.

CAN-bus terminal resistance connection
Because the greater the transmission distance, the greater the signal delay, in order to ensure the correct sampling of the message, the signal rate on the bus should be reduced accordingly. The following figure shows the relationship between the recommended signal rate and distance.

The relationship between signal rate and distance

3.2 CAN transceiver

The CAN bus is divided into high-speed CAN and low-speed CAN, and transceivers are also divided into high-speed CAN transceivers (1 Mbps) and low-speed CAN transceivers (125Kbps). Low-speed CAN is also called Fault
Tolerance CAN, which means that even if a wire on the bus fails, the bus can still communicate. Just as the MAX3232 in the serial port is used for level conversion, the role of the CAN transceiver is to convert logic signals into differential signals.
CAN transceiver

3.3 Difference signal

The CAN bus adopts differential signal transmission. Normally, only two signal wires are needed for normal communication. In differential signals, logic 0 and logic 1 are represented by the voltage difference between two differential signal lines. When at logic 1, when the voltage difference between CAN_High and CAN_Low is less than 0.5 V, it is called a recessive level; when at logic 0, when the voltage difference between CAN_High and CAN_Low is greater than 0.9 V, it is called a dominant level (Dominant) .

  • High-speed CAN
    High-speed CAN
  • Low-speed fault-tolerant CAN (Fault Tolerance CAN) The
    Insert picture description here
    CAN bus follows the "wire-AND" mechanism: the "dominant" bit can cover the "recessive" bit; only when all nodes send the "recessive" bit, the bus is in the "recessive" state. This "wire-and" mechanism makes the CAN bus show a dominant priority.
    CAN wire and mechanism

3.4 CAN bus connector

The physical interface of the CAN bus connector is as follows:
CAN bus connector

Guess you like

Origin blog.csdn.net/zztiger123/article/details/106640602