In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
Message format of CAN
The message transmitted in the bus consists of seven parts per frame. The CAN protocol supports two message formats. The only difference is that the length of the identifier (ID) is 11 bits in the standard format and 29 bits in the extended format.
In the standard format, the starting bit of the message is called the beginning of the frame (SOF), followed by an arbitration field consisting of an 11-bit identifier and a remote request bit (RTR). The RTR bit indicates whether it is a data frame or a request frame, and there are no data bytes in the request frame.
The control field includes an identifier extension (IDE) indicating whether it is a standard format or an extended format. It also includes a reserved bit (ro) for future expansion. Its last four bits are used to indicate the length of data in the data field (DLC). The range of the data field is 080 bytes, followed by a cyclic redundancy check (CRC) that detects data errors.
The response field (ACK) includes a response bit and an answer delimiter. The two bits sent by the transmitting station are both hidden levels (logic 1), and the receiving station that correctly receives the message sends the main control level (logic 0) to cover it. In this way, the sending station can ensure that at least one station in the network can receive the message correctly.
The end of the message is marked by the end of the frame. There is a short interval between two adjacent messages. if there is no station for bus access, the bus will be idle.
As shown in figure 11, a specific person or persons will be described in more detail below.
Figure 11 CAN bus message structure
Data frame
Data frame is the most widely used frame, which is composed of seven segments, which can be divided into standard frame (CAN2.0A) and extended frame (CAN2.0B) according to the length of ID code of arbitration segment.
The data frame is composed of: frame start, arbitration break, control terminal, data segment, CRC segment, ACK segment and frame end.
As shown in figure 21 (the specific frame structure is described in more detail below).
Figure 2-1 data frame type and structure
Frame start and frame end
Frame start: it consists of a single dominant bit. When the bus is idle, the sending node sends the start of the frame, and other receiving nodes synchronize with the start bit of the frame.
End of frame: consists of 7 consecutive stealth bits.
(note: the dominant level and the recessive level are the differential signal levels relative to CAN_H and CAN_L, not the high and low levels on the TTL level, which should be noted) as shown in figure 2-2.
Figure 2-2 frame start and frame end
Arbitration section
How does CAN-bus solve the problem that multiple nodes send data at the same time, that is, bus competition? The answer to this question is given by the arbitration paragraph.
CAN-bus does not specify the priority of nodes, but specifies the priority of data frames through the arbitration segment frame ID. According to the standard version of CAN2.0, frame ID is divided into 11-bit and 29-bit. As shown in figure 23
Figure 2-3 data frame structure
As shown in figure 24, while sending data, the CAN controller monitors whether the level of the data line is the same as the corresponding level of the transmitted data, and if it is different, stop the transmission and do other processing.
Figure 2-4 Arbitration processing
Suppose nodes A, B, and C all send frames of the same format and type, such as standard format data frames, and they compete for the bus as shown in figure 16:
Figure 2-5 Arbitration mechanism
The conclusion from the analysis process is that the smaller the frame ID value is, the higher the priority is.
The same is true for the same extended format data frame, standard format remote frame and extended format remote frame
Control section
The control segment of the standard frame consists of the extended frame flag bit IDE, the reserved bit R0 and the data length code DLC, while the extended frame control segment consists of IDE, R1, R0 and DLC as shown in figure 17.
Figure 2-6 data frame structure
Data segment
The amount of data transmitted by a data frame is 08bytes. This short frame structure makes CAN-bus very real-time, which is very suitable for automobile and industrial control applications, as shown in figure 27.
Figure 2-7 data segment
The utility model has the advantages of small amount of data, short sending and receiving time, high real-time performance, low probability of interference and strong anti-interference ability.
CRC segment
CAN-bus uses CRC check for data error detection, and the CRC check value is stored in the CRC section. The CRC check segment consists of a 15-bit CRC value and a 1-bit CRC delimiter, as shown in figure 28.
Figure 2-8CRC section
ACK segment
When there is no error between the beginning of the frame and the CRC segment received by a receiving node, it will send an explicit level in the ACK segment as shown in figure 29.
Figure 2-9 ACK paragraph
Remote frame
Compared with the data frame, the remote frame structure has no data segment and consists of six segments, which are similarly divided into standard format and extended format, and the RTR bit is 1 (hidden level) as shown in figure 31.
Figure 3-1 remote frame structure
As shown in the following figure, because the RTR bit of the data frame is dominant, the RTR bit of the remote frame is implicit.
So when the frame format and frame ID are the same, the priority of the data frame is higher than that of the remote frame, as shown in figure 32:
Figure 3-2 data frame to remote frame arbitration mechanism
Figure 3-3 remote frame comparison of data frames
The difference between a data frame and a remote frame is shown in figure 33.
Error frame
Although CAN-bus is a highly reliable bus, errors can still occur; there are five error types for CAN-bus (figure 41).
Figure 4-1 error frame type
When one of the five error types occurs, the sending or receiving node sends the error frame. The structure of the error frame is as follows, in which the error identification is divided into active error identification and passive error identification as shown in figure 42.
Figure 4-2 error frame level structure
In order to prevent the node which can not receive normally for some reason keeps sending error frames and interferes with the communication of other nodes, CAN-bus specifies three states of the node and its behavior as shown in figure 43.
Figure 4-3 error handling mechanism
(note: these error handling mechanisms are done independently by the hardware. The purpose of this is as long as the CAN receives the correct data.)
Overloaded frame and frame interval overloaded frame
When a receiving node is not ready to receive the next frame of data, an overloaded frame is sent to notify the sending node; the overloaded frame consists of an overload flag and an overloaded frame delimiter as shown in figure 51.
Figure 5-1 overloaded frame structure
Due to the fact that multiple nodes are overloaded at the same time and there is a time difference in the transmission of overloaded frames, there may be more than 6 bits after the overload flag is superimposed as shown in fig. 52.
Figure 5-2 specific structure of overloaded frame
Frame interval
Frame intervals are used to separate data frames or remote frames from their previous frames, but frame intervals are not inserted in front of overloaded frames and error frames.
After the frame interval, if no node sends the frame, the bus goes idle.
After the frame interval, if the passive error node wants to send the frame, the transmission delay of 8 hidden levels is sent first, and then the frame is sent.
The general process of sending CAN bus
The flow of data processed by the entire link layer of CAN-bus is shown in figure 61:
Figure 6-General process of 1CAN bus transmission
references
Project driver-basic course of CAN-BUS fieldbus-Zhou Ligong, Huang Xiaoqing.
Fieldbus Technology and its Application second Edition-Tsinghua University Press.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 207
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.