Can is the abbreviation of controller area network (can). It was developed by Bosch Company in Germany, which is famous for developing and producing automotive electronic products, and finally became the international standard (iso11898). It is one of the most widely used Fieldbus in the world. At the beginning of its establishment, can bus is located in the field bus inside the vehicle, which has the advantages of fast transmission speed, high reliability and strong flexibility. In the 1990s, can bus began to be gradually popularized in the automotive electronics industry. At present, it has become the preferred communication protocol in the automotive electronics industry, and has been widely used in the fields of medical equipment, industrial production, building facilities, transportation and so on.
Can bus error detection
The CAN bus protocol defines five error types for monitoring data transmission on the bus. These five errors include:
1. Bit error:
The node on the CAN bus is detecting the level on the bus while sending data. If the data sent outside the arbitration domain is inconsistent with the data monitored by the node, the CAN bus generates a bit error. However, if the node detects that the level on the bus is inconsistent with the transmission value when transmitting the ACK segment or passive error flag, it does not determine that a bit error has occurred.
2. Fill rule error:
In CAN bus transmission, as long as five identical bits appear continuously in the detection start, arbitration domain, control domain, data domain and CRC verification part of the message, an additional opposite bit needs to be inserted, which is the mechanism of CAN bus bit filling. In CAN bus communication, if a node detects six consecutive same levels, it will judge that there is a bit filling error in the bus.
3. CRC error:
The data frame of CAN bus comes with CRC check. When sending data, the CRC check code of this frame is also calculated, and the check code is sent at the end of the data frame. After receiving the data frame, the receiving node calculates the CRC code of the data field in the received data frame and compares it with the received CRC check code to determine whether the received data is accurate. If not, a CRC check error occurs.
4. Form error:
If there is an illegal bit in the fixed format bit field, for example, if there is an explicit level in the CRC delimiter that should be an implicit bit, the monitoring node judges that there is a format error.
5. Recognition error:
In CAN bus transmission, the response field sent by the transmitting node is a hidden bit, and the receiving node needs to send a dominant bit to the bus in the response field to cover the hidden bit to indicate the completion of acceptance. If the sending node detects that the response field of the frame is still hidden bit, it indicates that there is a response error, no node receives data, and the transmission fails.
Can bus error definition
When the node detects an error, it will send an error frame to the bus and the local error counter will be incremented. Each node on the CAN bus is equipped with two error registers: reception error counter and transmission error counter, which are used to count reception and transmission errors respectively. When an error is detected, the corresponding error counter is incremented; If a message is successfully sent or received, the corresponding error counter is decremented to 0. When the error counter is less than 127, the node is in the active error state. When the error counter is between 127 and 255, the node is in the passive error state. When the error counter exceeds 255, the node enters the offline state, and the node in the offline state will no longer participate in the data transmission on the bus.
Can bus error calibration
A station that detects an error condition indicates an error by sending an error flag. For the error active node, the error information is the active error flag; For the node with passive error, the error information is the passive error flag. Whether the error detected by the station is bit error, filling error, situation error or response error, the station will send error flag information at the next bit. When a CRC error is detected, the transmission of the error flag starts at the bit after the ACK delimiter, unless other error flags have started to be transmitted.