Share this

Analysis of CAN bus communication protocol based on AVR

2026-04-06 05:56:33 · · #1
Abstract This paper introduces a CAN bus communication protocol analysis technique based on an AVR microcontroller. A logic analyzer is used to first analyze the meaning of different query-response data generated by the host computer controlling each node on the CAN bus. Then, an AVR microcontroller ATmega168L is used to control an independent CAN controller MCP2510 to listen to the messages on the CAN bus and transmit them to a PC for display via a host computer. Combining the CAN bus specification and the previously analyzed query-response data definition, a complete analysis of the protocol is performed through the messages displayed on the PC. Keywords: CAN bus; AVR; host computer; SPI 1 CAN Bus Specification Overview CAN (Controller Area Network) is a serial communication protocol with high security performance and error handling capabilities. As a reliable, efficient, and economical platform, the CAN bus is widely used in distributed real-time systems such as automotive systems, mechanical equipment, and industrial control, replacing the complex wiring in traditional control systems. It has become one of the most widely used fieldbuses. However, some domestic manufacturers lack standardized guidance on CAN bus when developing network products, leading to incompatibility between different network products and weakening interoperability. This is especially true in the automotive industry, where CAN bus applications are most widespread. Because different car manufacturers define the meaning of data on the CAN bus differently and do not publicly disclose this information, diagnosing the performance of different vehicles becomes extremely difficult. Therefore, analyzing the CAN bus communication protocol is particularly important. The currently used CAN bus specification V2.0 mainly consists of two parts, A and B. Part A, namely CAN specification VI.2, uses an address range defined by 11 identification bits, i.e., the standard format. Part B includes the standard format and the extended format, the latter being a 29-bit identification bit format developed to address the expanded address range. The difference between the standard and extended formats is that the extended format uses the first reserved bit from CAN 1.2, thus the extended format remains valid. To ensure compatibility with CAN 2.0, CAN devices are required to use either Part A or Part B of CAN 2.0. 2. CAN Bus Communication Protocol Analysis 2.1 Protocol Analysis Principles The CAN bus is subdivided into three different layers: the object layer, the transfer layer, and the physical layer. The object layer and the transfer layer are equivalent to the data link layer defined in the ISO/OSI model. The functions of the object layer include: finding the message to be sent; determining which message will be received by the actual transfer layer; and providing an interface for the application layer hardware. The definition of the object layer is relatively flexible. The main function of the transfer layer is to transmit rules, that is, control the frame structure, perform arbitration, error detection, error labeling, and fault determination. When to start sending new messages and when to start receiving messages on the bus are determined in the transfer layer. Therefore, modifications to the transfer layer are restricted. The function of the physical layer is to actually transmit bit information between different nodes according to their electrical properties. The selection of the physical layer is relatively free. The protocol analysis of the CAN bus mainly involves the following three steps: 1) Use a logic analyzer to analyze the question and answer data generated by the host controlling each node on the CAN bus of a specific network product. From this, we can obtain the baud rate of communication between the host and nodes, and the meaning of the data. For example, in an automotive system, which data represents the engine, and which data represents a malfunction, etc. 2) Design a microcontroller system based on AVR. The AVR microcontroller listens to the messages on the CAN bus and sends them to the PC for display via the host computer. Obtain all the question and answer data between the host and each node. 3) Perform a complete analysis of the CAN bus protocol of the system based on the CAN bus specification and the data meaning table previously obtained using a logic analyzer. Full text: CAN Bus Communication Protocol Analysis Technology Based on AVR.pdf
Read next

CATDOLL Dolly Hybrid Silicone Head

The hybrid silicone head is crafted using a soft silicone base combined with a reinforced scalp section, allowing durab...

Articles 2026-02-22