. What is CAN bus communication:

CAN (Controller Area Network) is a serial communication protocol bus for real-time applications. It belongs to the category of fieldbus. It is a serial communication network that effectively supports distributed control systems. It is a multi-master bus that allows multiple devices to communicate without central control. Due to its high reliability, flexibility and real-time performance, CAN bus is widely used in automotive electronics, industrial automation, robotics and other fields. For example, in automobiles, CAN bus is used to control key components such as engine management, anti-lock braking system (ABS), and airbag system.

. Characteristics of CAN bus:

  1. Multi-master communication: All nodes are equal, and any node can actively initiate communication, and there is no master-slave relationship.
  2. Arbitration mechanism: When multiple nodes try to send data at the same time, conflicts are resolved through conflict detection and priority arbitration mechanisms.
  3. High reliability: The CAN bus is designed with error detection and error handling mechanisms, which can automatically resend error frames to ensure the reliability of data transmission.
  4. Flexible data length: CAN supports data frames of different lengths, ranging from 8 bytes to 8K bytes.

. Frame types of CAN communication:

  1. Data frame: a frame used by the sending unit to transmit data to the receiving unit.
  2. Remote frame (remote frame): a frame used by the receiving unit to request data from the sending unit with the same ID. The remote frame has no data segment.
  3. Error frame: a frame used to notify other units of errors when errors are detected when receiving and sending messages. The error frame consists of an error flag and an error delimiter.
  4. Overload frame: a frame used by the receiving unit to notify that it has not yet completed the reception preparation. The overload frame consists of an overload flag and an overload delimiter.
  5. Frame interval: a frame used to separate data frames and remote control frames from previous frames. Data frames and remote control frames can be separated from any previous frames (data frames, remote control frames, error frames, overload frames) by inserting a frame interval. However, a frame interval cannot be inserted before overload frames and error frames.

. CAN errors:

  1. Error types:

There are five types of CAN errors: bit error, stuffing error, CRC error, format error, ACK error.

Bit error: According to the CAN protocol, when a node sends a signal, it will compare the level it sends to the bus with the level read back from the bus. If the content is inconsistent, a bit error will occur.

Fill error: If six consecutive bits of the same sex are detected in the frame position that requires normal bit filling (that is, when the data frame has 6 consecutive bits of the same level), a fill error will be detected.

CRC error: Each CAN message contains a cyclic redundancy check (CRC check). If the receiver's CRC calculation does not match the transmitter's CRC, the receiver will detect it as a CRC error.

Format error: In a frame of message, if an illegal value is detected in an area where a specific value must be sent, a format error will be detected.

ACK error: ACK error is a response error. Usually, the sending node sends a frame of message data on the bus. After the receiving end receives the message data, it will send a dominant bit to respond to the sending node. If the sending node does not read the dominant bit in the ACK segment time period, an ACK error will be detected.

  1. Error state:

The error state of CAN is divided into the following three types: active error (Error Active), passive error (Error Passive), bus off (Bus Off)

Active error (Error Active): In the active error state, the node can still participate in bus communication, and will actively send error frames when an error is detected.

Passive error (Error Passive): When the node's transmit error counter (TEC) is greater than or equal to 128, or the receive error counter (REC) is greater than or equal to 128, the node will enter the passive error state. In this state, the node can still participate in communication, but the node needs to wait for a period of time (called "suspended transmission" or "delayed transmission") before sending again after sending data, and insert a specific delayed transmission bit during this period,

Bus Off (Bus Off): When the node's transmit error counter (TEC) is greater than or equal to 256, the node will enter the bus off state. In this state, the node cannot participate in any communication activities on the bus, including receiving and sending data. To recover from the bus off state, the node usually needs to reset its error counter and wait for a period of time before trying to rejoin the bus. Sometimes hardware or software repair work may also be required.

. Our Ebyte CAN series equipment:

Our company has a wealth of CAN communication equipment, such as ECAN-401 (isolated version)/ECAN-401S (non-isolated version) that realizes bidirectional conversion between CAN and RS485/RS232/RS422 serial port different protocol data; ECAN-S01, a small intelligent protocol conversion module that realizes bidirectional conversion between CAN and TTL different protocol data; ECAN-101, a small device that realizes bidirectional conversion between CAN and RS485 different protocol data; ECAN-U01 (isolated version)/ECAN-U01S (non-isolated version), a high-performance CAN-BUS bus communication analyzer with integrated 2-way CAN interface, and equipment for protocol conversion between CAN and optical fiber, industrial Ethernet, etc.