Comparison of CAN bus and RS485

Recently, the overall scheme of a project was designed as a distributed system, so the communication was entangled in CAN bus or RS485. Therefore, I searched some information about RS485 and CAN bus on the Internet. In addition to further understanding the communication characteristics of RS485, I learned about the characteristics of CAN bus and its comparison with RS485. The summary is as follows:

 

Note: The following is a summary from an online search.

 

CAN bus features:

1. International standard industrial-grade field bus, reliable transmission and high real-time performance;  
2. Long transmission distance (up to 10Km) and fast transmission rate (up to 1MHz bps); 
3. A single bus can connect up to 110 nodes, and can It is convenient to expand the number of nodes;  
4. Multi-master structure, the status of each node is equal, it is convenient for regional networking, and the bus utilization rate is high;  
5. High real-time performance, non-destructive bus arbitration technology, no delay for nodes with high priority  
; . The faulty CAN node will automatically close and cut off the connection with the bus, without affecting the communication of the bus;  
7. The message is a short frame structure and has hardware CRC check, the probability of being disturbed is small, and the data error rate is extremely low;  
8. Automatic Detect whether the message is sent successfully or not, it can be automatically retransmitted by hardware, and the transmission reliability is very high;  
9. The hardware message filtering function only receives the necessary information, reducing the burden on the CPU and simplifying the software preparation;  
10. The communication medium can be used with ordinary twisted pair 11. The CAN  
bus system has a simple structure and high cost performance.

 

Standard features of RS485 interface:

(1) Electrical characteristics of RS-485: logic "1" is represented by the voltage difference between the two lines as +(2-6)V; logic "0" is represented by the voltage difference between the two lines as -(2-6)V Express. The interface signal level is lower than that of RS-232-C, so it is not easy to damage the chip of the interface circuit, and the level is compatible with the TTL level, which can be easily connected with the TTL circuit.
(2) The maximum data transmission rate of RS-485 is 10Mbps
(3) The RS-485 interface adopts a combination of a balanced driver and a differential receiver, and the anti-common mode interference ability is enhanced, that is, the anti-noise interference is good.
(4) The standard value of the maximum transmission distance of the RS-485 interface is 4000 feet, which can actually be up to 3000 meters. In addition, the RS-232-C interface only allows one transceiver to be connected to the bus, that is, single station capability. The RS-485 interface allows up to 128 transceivers to be connected on the bus. That is, it has multi-station capability, so that users can easily establish a device network using a single RS-485 interface. But only one transmitter can transmit on the RS-485 bus at any time.
(5) The RS-485 interface has the advantages of good anti-noise interference, long transmission distance and multi-station capability, which makes it the preferred serial interface. 
(6) Because the half-duplex network composed of RS485 interface generally only needs two wires, so the RS485 interface adopts shielded twisted pair transmission. 

 

Comparison of CAN bus and RS485:

1. Speed ​​and distance: The distance between CAN and RS485 at a high speed of 1Mbit/S does not exceed 100M, which is similar to the distance on high speed. However, when the CAN is 5Kbit/S at low speed, the distance can reach 10KM, and the low speed of 485 can only reach about 1219 meters (there is no relay). It can be seen that CAN has an absolute advantage in long-distance transmission.

2. Bus utilization: RS485 is a single master-slave structure, that is, there can only be one host on a bus, and all communications are initiated by it. It does not issue commands, and the following nodes cannot be sent, and it must be sent and answered immediately after receiving the reply. , the host only asks the next node, this is to prevent multiple nodes from sending data to the bus, resulting in data confusion. The CAN-bus is a multi-master-slave structure. Each node has a CAN controller. When multiple nodes are sent, they will automatically arbitrate with the sent ID number, so that the bus data can not be messed up, and when one node is sent, the other A node can detect that the bus is idle, and send it immediately, which saves the inquiry of the host, improves the utilization of the bus, and enhances the speed. Therefore, in systems with high physical requirements such as automobiles, CAN bus or other similar buses are used.

3. Error detection mechanism, RS485 only specifies the physical layer, but not the data link layer, so it cannot identify errors unless some physical errors such as short circuits. This is easy to cause a node to be destroyed, desperately sending data to the bus (always sending 1), which will cause the entire bus to be paralyzed. So once RS485 fails a node, the bus network will hang. The CAN bus has a CAN controller, which can detect any errors on the bus. If there are more than 128 errors on the bus, it will be automatically blocked. Protect the bus. If other node errors or their own errors are detected, error frames will be sent to the bus to remind other nodes that the data is wrong. Everyone be careful. In this way, once the CAN bus has a node CPU program running away, its controller is automatically blocked. Protect the bus. Therefore, in the network with high security requirements, CAN is very strong.

4. Price and training cost: The price of CAN device is about twice that of 485. In this way, the communication of 485 is very convenient from the software. As long as you understand serial communication, you can program, while CAN requires the underlying engineer to understand the complex layers of CAN. , To write the software of the host computer, it is also necessary to understand the CAN protocol. The training cost is high.

5. The CAN bus is connected to the physical bus through the two output terminals CANH and CANL of the CAN controller interface chip 82C250, and the state of the CANH terminal can only be a high level or a floating state, and the CANL terminal can only be a low level or a floating state. This ensures that in the RS-485 network, when there is an error in the system, when multiple nodes send data to the bus at the same time, the bus will be short-circuited, thereby damaging some nodes. Moreover, 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, and the bus is in "deadlock" due to problems with individual nodes. condition.

6. CAN has a complete communication protocol, which 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 incomparable to RS-485, which only has electrical protocols. .

 

   characteristic

RS-485

CAN-bus

single point cost

low

slightly higher

system cost

high

lower

bus utilization

Low

high

Network Features

single master network

multi-master network

data transfer rate

Low

high

fault tolerance

without

Reliable error handling and error detection mechanism

Communication failure rate

high

very low

Effects of Node Errors

lead to the paralysis of the entire network

no impact

Communication distance

<1.5km

Up to 10km (5kbps)

network debugging

difficulty

very easy

Development difficulty

Standard Modbus protocol

Standard CAN-bus protocol

Post-maintenance cost

high

Low

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325805896&siteId=291194637