Comprehensive Understanding of CAN bus protocol

Source: Internet
Author: User

When it comes to bus, it is always reminiscent of Computer wires that are intertwined. How can these wires work? This must be used together with the management of bus protocols. So today we will introduce the CAN bus protocol. Let's take a look at the meaning and application of this Protocol.

1. Basic concepts of CAN bus protocol:

(1), message: The information on the bus is sent in different formats, but the length is limited. When the bus is open, any connected unit can start to send a new packet 。

(2) Information routing: In the CAN system, a CAN node does not use any information about the system structure. Here there are some important concepts: system flexibility-nodes can change any software or hardware without requiring all nodes and their application layers, is connected to the CAN network. Packet communication-the content of a packet is named by its identifier ID. The ID does not indicate the purpose of the packet, but describes the meaning of the data, so that all nodes in the Network may use packet filtering to determine whether to activate the data. Group-all nodes can accept packets due to packet filtering, and is activated by the same message at the same time. Data compatibility-in the CAN network, the message CAN be accepted by all nodes or no node at the same time. Therefore, the data compatibility of the system is achieved through grouping and error processing 。

(3) Bit Rate: the data transmission rate of CAN is different in different systems, and a fixed rate in one system 。

(4) Priority: During bus access, the identifier defines the static priority of a packet 。

(5) Remote Data Request: by sending a remote frame, the node that needs the data can request another node to send the corresponding data frame, the data frame and the corresponding remote frame are named with the same identifier ID 。

(6) Multi-master station: when the bus is open, any unit can start to send packets. Units with the highest priority will win access to the bus 。

(7) Arbitration: when the bus is open, any unit can start to send packets. If two or more units start to send packets at the same time, the bus access conflict will be governed by the one-by-one arbitration rule, using the identifier ID, this arbitration rule can eliminate any loss of information and time. If a data frame with the same identifier is sent at the same time as a remote frame, the data frame takes precedence over the remote frame, during the arbitration period, each transmitter compares the send bit level with the level detected on the bus. If it is the same, the Unit can continue sending. When sending a recessive level, when the dominant electrical frequency is detected on the bus, the unit is withdrawn from arbitration and no subsequent transmission is performed 。

(8). Security: in order to achieve the highest possible data transmission security, the CAN bus protocol provides a powerful measure for error detection, calibration, and self-inspection in each CAN node. detection measures include: sending self-check, cyclic Redundancy check, bit filling, and packet format check 。

(9) Error mark and recovery time: damaged packets are marked by the faulty node. Such packets are invalid and automatically resend. If no new error occurs, recovery from an error detected to the next packet can take up to 29 digits 。

(10) fault definition: CAN nodes CAN identify permanent faults and temporary disturbances, and CAN automatically close faulty nodes 。

(11) connection: the CAN serial communication link is a bus that CAN be connected to many units. Theoretically, the number of units is infinite. In fact, the total number of units is limited by the delay time and the electrical load of the bus 。

(12) response: all receivers check the compatibility of received packets, answer a compatible packet, and mark an incompatible packet 。

2. Features of CAN: it is a serial communication network.

(1) flexible communication methods. Work in multiple master-slave mode. Any node on the network can send information to other nodes at any time, no master-slave node. No station address or other node information. can form a multi-machine backup system 。

(2) node information on the CAN network is divided into different priorities, which CAN meet different real-time requirements 。

(3) CAN adopts non-destructive bus arbitration technology. When multiple nodes send messages at the same time, nodes with low priority will actively quit sending 。

(4) CAN be transmitted and received through packet filtering in several ways, such as point-to-point, point-to-point, and global broadcast without scheduling 。

(5) The maximum direct communication distance of CAN is 10 KM (5 kb/s), and the maximum communication rate is 1 Mb/s (40 M )。

(6) At present, the number of nodes on CAN reach 110, and the number of message identifiers CAN reach 2032 (CAN2.0A), while the number of CAN2.0B message identifiers is almost unrestricted 。

(7) CAN communication adopts the short frame format, short transmission time, strong anti-interference, and excellent error detection effect. Each frame CAN be up to 8B enough to meet the control requirements and will not take too long bus time, strong real-time performance 。

(8) each frame of CAN has CRC verification and other error verification measures 。

(9) The interface integrates the physical layer and data link layer of the CAN bus protocol 。

(10) The communication medium of CAN be twisted pair wires or coaxial cables and optical fiber cables 。

(11) The CAN node CAN automatically disable the output function in case of serious errors 。

3. Basic Rules of the CAN bus protocol:

(1) bus access: Multiple accesses are monitored by the carrier. When the bus is idle, the CAN controller CAN listen to at least three idle bits (hidden bits) on the network) when hard synchronization is adopted, all controllers are synchronized to the front of the starting frame. after a certain period of time, the controllers are re-synchronized 。

(2) Arbitration: when each node generates electricity to the bus, it also reads the bus level and compares the level sent by itself. If the level is the same, it sends the next bit, if the message frames with higher priority are being sent, the transmission is stopped and the competition is terminated 。

(3) encoding/decoding: the starting domain of the frame, the arbitration domain, the control domain, the data domain, and the CRC sequence are all encoded using the bit filling technology, that is, insert one of the five consecutive levels in the same State to the level that is supplemented with it. During restoration, the level after each of the five levels in the same State is deleted 。

(4) Error MARK: When an error is detected, the filling error, form error, or response error occurs, the CAN controller that detects the error condition will send an error mark 。

(5) overload labels. Some controllers send one or more overload frames to delay the transmission of the next data frame or remote frame 。

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.