This article is mainly about the related introduction of CAN bus, and focuses on the detailed description of CAN bus network distance and terminal resistance distance. CAN is the abbreviation of Controller Area Network (CAN). It was developed by the German company BOSCH, which is known for its research and development and production of automotive electronic products, and eventually became an international standard (ISO 11898), which is the most widely used internationally One of the field buses. In North America and Western Europe, the CAN bus protocol has become the standard bus for automotive computer control systems and embedded industrial control local area networks, and has the J1939 protocol designed specifically for large trucks and heavy machinery vehicles with CAN as the underlying protocol. CAN is the abbreviation of Controller Area Network (hereinafter referred to as CAN), and is a serial communication protocol standardized by ISO. In the automotive industry, various electronic control systems have been developed for the requirements of safety, comfort, convenience, low pollution, and low cost. Because the data types and reliability requirements for communication between these systems are not the same, there are many situations where multiple buses are formed, and the number of wiring harnesses also increases. In order to meet the needs of "reducing the number of wiring harnesses" and "high-speed communication of large amounts of data through multiple LANs", in 1986, the German electric company Bosch developed the CAN communication protocol for automobiles. Since then, CAN has been standardized through ISO11898 and ISO11519, and has become a standard protocol for automotive networks in Europe. CAN's high performance and reliability have been recognized, and it is widely used in industrial automation, shipbuilding, medical equipment, industrial equipment, etc. Fieldbus is one of the hotspots of technology development in the field of automation today, and is known as the computer local area network in the field of automation. Its appearance provides strong technical support for the distributed control system to realize real-time and reliable data communication between nodes. Advantage CAN belongs to the category of fieldbus, which is a serial communication network that effectively supports distributed control or real-time control. Compared with many RS-485 distributed control systems based on the R line, the CAN bus-based distributed control system has obvious advantages in the following aspects: Strong real-time data communication between nodes in the network First of all, the CAN controller works in a variety of ways. Each node in the network can compete to send data to the bus based on the bus access priority (depending on the message identifier) ​​by means of bit-by-bit arbitration with a lossless structure, and the CAN protocol is abolished Instead of encoding the station address encoding, the communication data is encoded, which allows different nodes to receive the same data at the same time. These characteristics make the data communication between the nodes of the CAN bus network have strong real-time performance and easy construction Redundant structure improves the reliability and flexibility of the system. However, the use of RS-485 can only constitute a master-slave structure system, and the communication method can only be carried out in the manner of polling by the master station, and the real-time performance and reliability of the system are poor; Short development cycle The CAN bus is connected to the physical bus through the two output terminals CANH and CANL of the CAN transceiver interface chip 82C250, and the state of the CANH terminal can only be high or floating, and the CANL terminal can only be low or floating. This ensures that there will be no phenomenon in the RS-485 network, that is, when the system has an error and multiple nodes send data to the bus at the same time, the bus will be short-circuited and some nodes will be damaged. In addition, the CAN node has the function of automatically shutting down the output in the case of serious errors, so that the operation of other nodes on the bus is not affected, so as to ensure that there will be no problems in the network, causing the bus to be "deadlocked" due to problems with individual nodes. status. Moreover, CAN's complete communication protocol can be realized by the CAN controller chip and its interface chip, which greatly reduces the difficulty of system development and shortens the development cycle. These are unmatched by RS-485 with only electrical protocols. Fieldbus that has formed an international standard In addition, compared with other field buses, CAN bus is a field bus that has formed an international standard with many characteristics such as high communication rate, easy implementation, and high cost performance. These are also important reasons why the CAN bus is used in many fields and has strong market competitiveness. One of the most promising fieldbuses CAN stands for Controller Area Network, which belongs to the category of industrial fieldbus. Compared with the general communication bus, the data communication of CAN bus has outstanding reliability, real-time and flexibility. Because of its good performance and unique design, the CAN bus has attracted more and more attention. It is the most widely used in the automotive field. Some famous car manufacturers in the world have adopted CAN bus to realize the data communication between the car's internal control system and various detection and actuators. At the same time, due to the characteristics of the CAN bus itself, its application range is no longer limited to the automotive industry, but to automatic control, aerospace, navigation, process industry, machinery industry, textile machinery, agricultural machinery, robots, CNC machine tools, medical equipment and Development of sensors and other fields. CAN has formed an international standard and has been recognized as one of the most promising field buses. Its typical application protocols are: SAE J1939/ISO11783, CANOpen, CANaerospace, DeviceNet, NMEA 2000, etc. development of CAN-CONTROLLER AREA NETWORK is a multi-host local network launched by BOSCH for modern automotive applications. Due to its high performance, high reliability, real-time and other advantages, it has been widely used in industrial automation, A variety of control equipment, transportation, medical equipment, construction, environmental control, and many other departments. The local controller network will be rapidly popularized in China. With the rapid development of computer hardware, software technology and integrated circuit technology, industrial control systems have become the most dynamic branch in the field of computer technology applications and have made great progress. Due to the high requirements for system reliability and flexibility, the development of industrial control systems is mainly manifested as: control is diversified, and the system is decentralized, that is, load dispersion, function dispersion, danger dispersion, and geographical dispersion. Distributed industrial control system is developed to meet this need. This type of system is based on a microcomputer as the core, and is the product of the close integration of 5C technology-COMPUTER (computer technology), CONTROL (automatic control technology), COMMUNICATION (communication technology), CRT (display technology) and CHANGE (conversion technology). It has obvious advantages over decentralized instrument control systems and centralized computer control systems in terms of adaptability, scalability, maintainability, and anti-failure capabilities. A typical distributed control system consists of field equipment, interface and computing equipment, and communication equipment. Fieldbus (FIELDBUS) can meet the needs of process control and manufacturing automation at the same time, so fieldbus has become the most active field in the field of industrial data bus. The research and application of field bus has become a hot spot in the field of industrial data bus. Although the research on fieldbus has not yet proposed a complete standard, the high-performance price of fieldbus will certainly attract the adoption of many industrial control systems. At the same time, just because the fieldbus standard has not yet been unified, the application of the fieldbus can be used in an eclectic manner, and it will provide a richer basis for the improvement of the fieldbus. The controller local network CAN (CONTROLLER AERANETWORK) came into being under this background. As CAN is adopted and promoted in more and more different fields, the standardization of communication messages in various application fields is required. To this end, PHILIPS SEMICONDUCTORS formulated and released CAN technical specifications (VERSION 2.0) in September 1991. The technical specification includes two parts, A and B. 2.0A provides the CAN message format defined in CAN technical specification version 1.2, which can provide 11-bit addresses; while 2.0B provides standard and extended two message formats, which provide 29-bit addresses. Since then, in November 1993, ISO officially promulgated the international standard (ISO11898) for road transportation vehicles-digital information exchange-high-speed communication controller local network (CAN), which paved the way for the standardization and standardized promotion of the controller local network. Features CAN bus is a serial data communication protocol developed by German BOSCH company in the early 1980s to solve the data exchange between numerous control and test instruments in modern cars. It is a multi-master bus, and the communication medium can be dual Stranded wire, coaxial cable or optical fiber. The communication rate can reach up to 1Mbps. Complete framing of communication data The CAN bus communication interface integrates the physical layer and data link layer functions of the CAN protocol, which can complete the framing of communication data, including bit filling, data block coding, cyclic redundancy checking, priority discrimination and other tasks. Make the number of nodes in the network unlimited in theory One of the biggest features of the CAN protocol is to abolish the traditional station address coding, and instead encode the communication data block. The advantage of using this method allows the number of nodes in the network to be theoretically unlimited. The identifier of a data block can be composed of 11-bit or 29-bit binary numbers, so 2 or more different data blocks can be defined. This way of encoding according to data blocks can also enable different nodes to receive the same data at the same time, which is very useful in distributed control systems. The length of the data segment is up to 8 bytes, which can meet the general requirements of control commands, working status and test data in the general industrial field. At the same time, 8 bytes will not occupy the bus for too long, thus ensuring real-time communication. The CAN protocol adopts CRC inspection and provides corresponding error handling functions to ensure the reliability of data communication. CAN's outstanding characteristics, extremely high reliability and unique design are particularly suitable for the interconnection of industrial process monitoring equipment. Therefore, it has received more and more attention from the industry and has been recognized as one of the most promising fieldbuses. Can realize free communication between nodes The CAN bus adopts a multi-master competitive bus structure, and has the characteristics of a serial bus with multi-master operation and decentralized arbitration and broadcast communication. Any node on the CAN bus can actively send information to other nodes on the network at any time without distinction of priority, so free communication between nodes can be achieved. The CAN bus protocol has been certified by the International Organization for Standardization, the technology is relatively mature, the control chip has been commercialized, and the cost performance is high. It is especially suitable for data communication between distributed measurement and control systems. The CAN bus plug-in card can be arbitrarily inserted into the PC AT XT compatible machine to easily form a distributed monitoring system. Simple structure Only 2 wires are connected to the outside, and the error detection and management module is integrated inside. Transmission distance and rate CAN bus characteristics: (1) Data communication is not divided into master and slave. Any node can initiate data communication to any other (one or more) nodes. The order of communication is determined by the priority of each node's information. High priority nodes Information is communicated in 134μs; (2) When multiple nodes initiate communication at the same time, the one with low priority will avoid the one with high priority and will not cause congestion on the communication line; (3) The communication distance can be as long as 10KM (the rate is lower than 5Kbps) The rate can reach 1Mbps (communication distance is less than 40M); (4) CAN bus transmission medium can be twisted pair, coaxial cable. CAN bus is suitable for large data volume short-distance communication or long-distance small data volume, with high real-time requirements, multi-master and multi-slave or equal use in the field of each node. The bus first satisfies the linear topology, that is, the distance from any point in the topology to the trunk is less than the distance between the two terminals of the topology. The distance from point C to point A and point C to point B in the three-node network is smaller than the distance between AB, so The AB plus terminal resistance network is stable, the distance does not exceed 40M, and your node is a high-speed non-fault-tolerant CAN. Vulgar fault tolerance is different. According to the ISO 11898 specification, in order to enhance the reliability of CAN-bus communication, the two end points of the CAN-bus network usually need to add terminal matching resistance (120Ω). The size of the terminal matching resistance is determined by the characteristic impedance of the transmission cable. For example, if the characteristic impedance of a twisted pair is 120Ω, the two terminals on the bus should also be equipped with 120Ω terminal resistance. In addition, in long-distance communication, the resistance of the terminal resistance sometimes needs to be increased to ensure normal communication. Below is a recommended topology diagram of a CAN bus device connection in a "CAN to serial port" device manual I used, which shows the installation location of the terminal resistor. The application of CAN bus seems to be more and more extensive now. Our equipment has been upgraded from the initial ARM9 and ARM7 platforms to the CortexA8 and Cortex M3 platforms, and then to the current Cortex M4 platform. A series of product developments have been carried out around CAN. Development, the stability of the CAN bus is beyond doubt. CAN bus physical structure and characteristics CAN bus network The CAN bus network is mainly hung on CAN_H and CAN_L. Each node realizes the serial differential transmission of signals through these two lines. In order to avoid signal reflection and interference, it is also necessary to connect a 120 ohm terminal resistance between CAN_H and CAN_L, but why Is it 120 ohms? That's because the characteristic impedance of the cable is 120 ohms. CAN transceiver The role of CAN transceiver is to be responsible for the conversion between logic level and signal level. That is, the logic level is output from the CAN control chip to the CAN transceiver, and then the logic level is converted into a differential signal through the internal conversion of the CAN transceiver and output to the CAN bus. The nodes on the CAN bus can decide whether they need data on the bus. . The specific discipline definition is as follows: Signal representation The CAN bus uses a non-return-to-zero code bit filling technology, which means that the signal on the CAN bus has two different signal states, which are Dominant logic 0 and invisible logic 1, each time the signal is transmitted There is no need to return to the logic 0 (dominant) level after that. Bit filling rule: As long as the transmitter detects that there are 5 consecutive bits with the same value in the bit stream, it will automatically insert supplementary bits in the bit stream. It can be seen in the above figure that when the first segment is recessive, the levels of CAN_H and CAN_L are almost the same, that is to say, when the levels of CAN_H and CAN_L are very close or even equal, the bus is recessive, and the two lines When the point position difference is large, it is manifested as dominant, according to the definition: CAN_H-CAN_L <0.5V is recessive, and the logic signal appears as "logic 1"-high level. CAN_H-CAN_L》 It is dominant at 0.9V, and the logic signal appears as "logic 0"-low level. The following table summarizes the corresponding relationship between differential signal and explicit recessiveness: status Logic signal voltage range Dominant 0 CAN_H-CAN_L》 0.9 Recessive 1 CAN_H-CAN_L << 0.5 From the above analysis, we can know: The CAN bus adopts the "wire and" rule for bus punching. That is, 1&0=0; so 0 is dominant. The implication of this sentence is that if only one node on the bus pulls the bus to a low level (logic 0), it is a dominant state, and the bus is a low level (logic 0), that is, a dominant state regardless of the bus. How many nodes are in the transmission recessive state (high level or logic 1), only when all nodes are high (recessive), the bus is high, that is, recessive. Communication speed and communication distance The maximum communication distance here refers to the distance between two nodes on the same bus. It can be seen that the lower the speed, the longer the communication distance, which means that the communication distance of the CAN bus is inversely proportional to the baud rate. When the bit rate is 5 kilobits per second, the maximum transmission distance is 10 kilometers. Among them, the communication rate of 500K per second is more commonly used in general engineering. This rate is also very reliable in actual testing. If you want a longer transmission distance (more than 10 kilometers); you can consider using multiple CAN controller connections or adding other communication protocols (such as 485 or TCP/IP) interface chips to form a device, so that you can achieve long Distance communication needs. This is the end of the related introduction about CAN bus. Please correct me if there are any deficiencies. Related reading recommendations: CAN bus wiring specifications Related reading recommendations: Detailed explanation of common problems and correct design schemes of CAN repeater principle Dongguan SOLEPIN Electronics Co., Ltd , https://www.wentae.com