A multi-level can protocol design method and device

Through the multi-level CAN protocol design method, the problems of data conflict, node management complexity and lack of real-time performance in multi-node communication of the traditional CAN protocol are solved, and efficient and reliable data transmission and node management are achieved to adapt to the communication needs of complex systems.

CN120321310BActive Publication Date: 2025-10-10ANHUI ZHONGKE ZHONGHUAN INTELLIGENT EQUIP CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510796503.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-16
Publication Date
2025-10-10
Estimated Expiration
2045-06-16

AI Technical Summary

Technical Problem

The traditional CAN protocol has problems in multi-node communication, such as data conflicts, node management complexity, lack of hierarchical structure and insufficient real-time performance. It is difficult to meet real-time requirements, especially under high load conditions.

Method used

A multi-level CAN protocol design method is adopted, and nodes are divided into high, medium and bottom levels through a priority management mechanism. An extended data frame structure is defined, node priorities and weights are dynamically adjusted, a multi-level protocol extension formula is introduced, and a conflict detection and processing mechanism is adopted to ensure the timely transmission of key data.

Benefits of technology

It improves communication efficiency and reliability, ensures stable operation of the system under high load conditions, reduces latency and data loss rate, and supports flexible management and real-time requirements of different nodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120321310B_ABST
    Figure CN120321310B_ABST
Patent Text Reader

Abstract

The application discloses a kind of multilevel CAN protocol design method and device, it is related to CAN protocol design field, including: design priority management mechanism;Definition CAN2.0B's extended data frame structure;Based on extended data frame structure, according to priority management mechanism, the information to be transmitted is carried out data transmission;Wherein, design priority management mechanism includes: multiple slave nodes are divided into high-level node, middle-level node and bottom-level node according to the importance of each slave node transmission information;The priority and weight of each slave node in master node and high-level node, middle-level node and bottom-level node are defined respectively.The application classifies and priority management to network node in system by level, effectively improves the efficiency and reliability of transmission, ensures the stable operation of system under high load condition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of CAN protocol, and in particular to a multi-level CAN protocol design method and device. Background Art

[0002] As the demand for intelligence and automation continues to grow, the number of devices and nodes involved in the system is also increasing. Efficient and reliable communication is required between devices and nodes to achieve real-time monitoring and control of the equipment. However, the traditional CAN protocol has limitations in the following aspects:

[0003] (1) Data conflict problem: When multiple nodes send data at the same time, the traditional CAN protocol uses a priority mechanism to resolve data conflicts. However, under high load conditions, data loss and retransmission may still occur, affecting the real-time performance and reliability of the system.

[0004] (2) Node management complexity: As the system scale expands, the number of nodes increases, making network management more complex. The traditional CAN protocol lacks flexibility in the dynamic addition, deletion, and priority adjustment of nodes, making it difficult to adapt to rapidly changing application requirements;

[0005] (3) Lack of hierarchical structure: The traditional CAN protocol usually adopts a flat network structure, where all nodes communicate at the same level, and lacks a mechanism to effectively distinguish nodes with different functions and importance. This design is prone to low communication efficiency and waste of resources when faced with complex multi-level systems.

[0006] (4) Insufficient real-time performance: In some application scenarios with extremely high real-time requirements, the response time and data transmission delay of the traditional CAN protocol may not meet the requirements, especially under high load conditions, the real-time performance of the system is seriously affected.

[0007] Therefore, in response to the above problems, a new design method is urgently needed to optimize the communication efficiency and reliability of the CAN protocol. Summary of the Invention

[0008] In order to solve the technical problems existing in the background technology, the present invention proposes a multi-level CAN protocol design method and device.

[0009] In a first aspect, the present invention proposes a multi-level CAN protocol design method, which is applied to a CAN communication system and includes:

[0010] Design a priority management mechanism;

[0011] Define the extended data frame structure of CAN2.0B;

[0012] Based on the extended data frame structure, the information to be transmitted is transmitted according to the priority management mechanism;

[0013] The design priority management mechanism includes:

[0014] The plurality of slave nodes are divided into high-level nodes, middle-level nodes and low-level nodes according to the importance of information transmitted by each slave node;

[0015] The priority and weight of the master node and each slave node in the high-level node, middle-level node and bottom-level node are defined respectively; among them, the priority of the master node, high-level node, middle-level node and bottom-level node decreases in sequence, and the high-level node, middle-level node and bottom-level node all include multiple hierarchical nodes with different priorities, and each hierarchical node corresponds to a slave node.

[0016] Preferably, the CAN communication system includes a master node and multiple slave nodes, the master node and the multiple slave nodes are all connected to the CAN bus, and each node can communicate with each other.

[0017] Preferably, the priority of each node is expressed as ; Where Pi is the priority of node i, Wi is the weight of node i, Ti is the transmission delay of node i, , N is the total number of master nodes and slave nodes.

[0018] Preferably, after defining the priority and weight of each node in the high-level node, the middle-level node and the bottom-level node respectively, it also includes: dynamically adjusting the priority of each node in each level according to the real-time status of the node and the network load; wherein, during the dynamic adjustment process, the priority of each node is expressed as Where, is the priority of node i at time t, For node i at time Priority, The priority adjustment amount based on the network status change.

[0019] Preferably, after respectively defining the priority and weight of each node in the high-level nodes, the middle-level nodes and the bottom-level nodes, it further includes: introducing a multi-level protocol extension formula to support optimization of communication efficiency between different nodes.

[0020] Preferably, the multi-level protocol expansion formula is: Where, is the communication efficiency, Pi is the priority of node i, Di is the data volume of node i, and Ci is the communication capability of node i.

[0021] Preferably, each node has a unique address; wherein the extended data frame structure includes: a direction bit, an address of a source node, an address of a target node, an instruction type, a frame type, a frame index number and a data segment.

[0022] Preferably, the direction bit is ID28-ID27, the address of the source node is ID26-ID19, the address of the target node is ID18-ID11, the instruction type is ID10-ID9, the frame type is ID8-ID7, and the frame index number is ID6-ID0.

[0023] Preferably, the direction bits include master node to slave node communication, slave node to master node communication, slave node to slave node communication and reserved.

[0024] Preferably, the frame types include single-frame data, non-end multi-frame data, end multi-frame data and reserved.

[0025] Preferably, in the frame type of the multi-frame data, the total frame number is added to the first byte of the first frame in the non-end multi-frame data, and the last two bytes in the end multi-frame data are the data field CRC16 check.

[0026] Preferably, the instruction types include broadcast mode, control command, device status and device data.

[0027] Preferably, during the data transmission process, a preset conflict detection and processing mechanism is used to perform conflict detection and processing; wherein the conflict detection and processing mechanism includes a conflict detection formula and a processing formula;

[0028] Conflict detection and handling is performed using a preset conflict detection and handling mechanism, specifically including:

[0029] Use the conflict detection formula to detect whether there are multiple nodes sending data at the same time;

[0030] If so, determine whether each node in the multiple nodes has successfully sent the message; if not, calculate the priority of each node that has not successfully sent the message, and calculate the retransmission time of each node that has not successfully sent the message according to the processing formula and the priority of each node that has not successfully sent the message; each node that has not successfully sent the message continues to send according to the retransmission time; wherein, the higher the priority level of the node that has not successfully sent the message, the shorter the retransmission time; each node that has not successfully sent the message continues to send according to the retransmission time; wherein, the higher the priority level of the node that has not successfully sent the message, the shorter the retransmission time;

[0031] The conflict detection formula is: ; Where C is the conflict detection value, is the data transmission request of node j, is the request state of node j; , 1 means request, 0 means no request;

[0032] The processing formula is ; in the formula, is the retransmission time, is the initial transmission time, k is the retransmission number, is the time interval of each retransmission.

[0033] Preferably, in the process of calculating the priority of each node that fails to transmit, a priority back propagation mechanism is used to improve the priority of each node that fails to transmit;

[0034] The priority back propagation mechanism is expressed as ;

[0035] In the formula, is the new priority, is the old priority, is the improvement coefficient, is the critical time threshold, is the current time.

[0036] In a second aspect, the application further provides a multi-level CAN protocol design device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the multi-level CAN protocol design method according to any one of the first aspect when executing the computer program.

[0037] In the application, the multi-level CAN protocol design method and device effectively improve the transmission efficiency and reliability by classifying and managing the priorities of the network nodes in the system, and ensure the stable operation of the system under high load. BRIEF DESCRIPTION OF DRAWINGS

[0038] Figure 1 FIG. 1 is a flowchart of the multi-level CAN protocol design method according to an embodiment of the application. DETAILED DESCRIPTION

[0039] It should be noted that the embodiments and features in the embodiments of the application can be combined with each other without conflict. The application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0040] In a first aspect, as Figure 1 indicated, the application provides a multi-level CAN protocol design method applied to a CAN communication system, comprising:

[0041] Designing a priority management mechanism according to the importance of the information transmitted by each node;

[0042] Defining the extended data frame structure of CAN2.0B;

[0043] Based on the extended data frame structure, the information to be transmitted is transmitted according to the priority management mechanism.

[0044] This embodiment first designs a priority management mechanism according to the importance of information transmitted by each node; then defines the extended data frame structure of CAN2.0B; based on the extended data frame structure, the information to be transmitted is transmitted according to the priority management mechanism, which can optimize the priority management of data transmission and ensure the timely transmission of critical data.

[0045] It's important to understand that a CAN communication system consists of a master node and multiple slave nodes, all connected to the CAN bus. Data can be processed and exchanged between the master and slave nodes, as well as between each other. The master node is typically the brain device, while the other slave nodes are subsystem devices. The master node has priority over any other slave node.

[0046] In this embodiment, a priority management mechanism is designed according to the importance of information transmitted by each node, specifically including:

[0047] According to the importance of the information transmitted by each slave node, multiple slave nodes are divided into high-level nodes, middle-level nodes and low-level nodes;

[0048] The priority and weight of the master node and each slave node in the high-level node, middle-level node and bottom-level node are defined respectively; among them, the priority of the master node, high-level node, middle-level node and bottom-level node decreases in sequence, and the high-level node, middle-level node and bottom-level node all include multiple hierarchical nodes with different priorities, and each hierarchical node corresponds to a slave node.

[0049] This embodiment divides multiple slave nodes into high-level nodes, middle-level nodes and low-level nodes according to the importance of information transmitted by each slave node; defines the priority and weight of the master node and each slave node in the high-level node, middle-level node and low-level node respectively, which can effectively manage the communication needs of different functional nodes, optimize the priority management of data transmission, and ensure the timely transmission of critical data.

[0050] Each level can be divided into different levels according to the priority, data type, target node address, and frame index number of the messages sent to other nodes. That is, at the same level, the priority will also change according to the different filling of the message.

[0051] For example, the high-level node includes 10 nodes with different priorities, defined as 1-10; the middle-level node includes 10 nodes with different priorities, defined as 11-20; the low-level node includes 10 nodes with different priorities, defined as 21-30; the smaller the number, the higher the priority.

[0052] In a further embodiment, the priority of each node is expressed as Pi=Ti×Wi; where Pi is the priority of node i, Wi is the weight of node i (set according to functional importance), Ti is the transmission delay of node i, i=1, 2, 3, …, N, and N is the total number of master nodes and slave nodes.

[0053] In a further embodiment, after respectively defining the priority and weight of each node in the high-level nodes, mid-level nodes and bottom-level nodes, it also includes: dynamically adjusting the priority of each node in each level according to the real-time status of the node and the network load.

[0054] This embodiment improves priority management and dynamic adjustment to ensure that high-priority nodes can obtain data transmission opportunities in a timely manner at critical moments, meeting real-time requirements.

[0055] During the dynamic adjustment process, the priority of each node is expressed as Where, is the priority of node i at time t; The priority adjustment amount based on the network status change.

[0056] In a further embodiment, a multi-level protocol expansion formula is introduced into the priority management mechanism to support the optimization of communication efficiency between nodes at different levels; wherein the multi-level protocol expansion formula is Where, is the communication efficiency, Pi is the priority of node i, Di is the data volume of node i, and Ci is the communication capability of node i.

[0057] It is important to understand that each node can be either a source node or a destination node, and each node has a unique address. A node can be a master node or any slave node.

[0058] In this embodiment, the extended data frame structure includes: a direction bit, an address of a source node, an address of a destination node, an instruction type, a frame type, a frame index number, and a data segment.

[0059] The optimized data packet format of this embodiment significantly improves the efficiency of data transmission, reduces delay and data loss rate, and is compatible with the existing CAN protocol, making it easy to upgrade and apply in existing systems.

[0060] In one specific embodiment, the priority is determined by the source node address. The smaller the source node address, the higher the priority. The higher the priority of the source node address, the higher the priority of the data frame.

[0061] Of course, priority can be determined not only by the node address, but also by other factors such as direction bit, instruction type, frame type, and frame index number. In other defined cases, the smaller the value of direction bit, instruction type, frame type, and frame index number, the higher the priority.

[0062] In one specific embodiment, the direction bit is ID28-ID27, the address of the source node is ID26-ID19, the address of the target node is ID18-ID11, the instruction type is ID10-ID9, the frame type is ID8-ID7, the frame index number is ID6-ID0, and the data segment is DaTA, which is fixed to 8 bytes.

[0063] In this embodiment, the direction bits include master node to slave node communication, slave node to master node communication, slave node to slave node communication, and reserved.

[0064] Among them, 00 indicates communication from the master node to the slave node; 01 indicates communication from the slave node to the master node; 10 indicates communication from the slave node to the slave node; and 11 indicates reserved.

[0065] Each CAN node has a unique node address. In this embodiment, the instruction type includes broadcast mode, control command, device status and device data; wherein the broadcast mode is 00, the control command is 01, the device status is 10, and the device data is 11.

[0066] The instruction type in this embodiment supports the transmission of multiple data types, thereby enhancing the flexibility and adaptability of the protocol.

[0067] In this embodiment, the frame types include single-frame data, non-end multi-frame data, end multi-frame data, and reserved. In the frame type, 00 represents single-frame data, 01 represents reserved or reserved for use, 10 represents non-end multi-frame data, and 11 represents end multi-frame data.

[0068] This embodiment optimizes the transmission of multi-frame data by distinguishing between non-terminated and terminated multi-frames, reducing redundant information in data transmission and improving bandwidth utilization. Furthermore, it allows for the flexible addition of new frame types to the protocol to accommodate future technological developments and application requirements, ensuring the long-term effectiveness and adaptability of the protocol.

[0069] During multi-frame transmission, the total frame count is included in the first byte of the first frame, and the last two bytes of the final multi-frame contain the data field CRC16 checksum. This embodiment adds the nominal total frame count to the first frame of multi-frame data to detect intermediate frame loss or the illegal injection of forged frames. A CRC checksum is also provided in the final frame to detect data tampering caused by interference during data transmission. If the data field CRC16 checksum is inconsistent with the data, the frame data can be discarded. Furthermore, concentrating the checksum in the final frame reduces protocol overhead compared to frame-by-frame checksums.

[0070] A schematic diagram of single frame data in one specific embodiment is shown in Table 1.

[0071]

[0072] Table 2 shows a schematic diagram of single-frame data in another specific embodiment.

[0073]

[0074] In one specific embodiment, a schematic diagram of multiple frames of data is shown in Table 3.

[0075]

[0076] The frame index number in this embodiment supports single-node to single-node transmission, and the maximum number of frames for sending the same type of data is 128 frames.

[0077] In this embodiment, during the data transmission process, when multiple nodes send data simultaneously and a conflict occurs, a preset conflict detection and processing mechanism is used to ensure that the conflict can be effectively handled when multiple nodes send data simultaneously.

[0078] The conflict detection and handling mechanism includes a conflict detection formula and a handling formula. The conflict detection formula is used to detect whether a conflict occurs, that is, multiple nodes send data at the same time; the handling formula is used to retransmit data when a conflict occurs.

[0079] Among them, in the conflict detection and processing mechanism, the conflict detection formula is ; Where C is the conflict detection value, is the data transmission request of node j, is the request state of node j; , 1 means request, 0 means no request;

[0080] When a conflict occurs, multiple nodes retransmit according to a pre-set processing formula. Specifically, each node in the multi-node system is individually determined to determine whether all transmissions were successful. If not, the priority of each node that failed to transmit is calculated. Based on the processing formula and the priority of each node that failed to transmit, the retransmission time for each node that failed to transmit is calculated. Each node that failed to transmit continues to transmit based on the retransmission time. The higher the priority of the node, the shorter the retransmission time. Each node that failed to transmit continues to transmit based on the retransmission time to address the issue of data loss and retransmission that may occur under high load conditions. When retransmitting, the higher the priority of the node that failed to transmit, the shorter the retransmission time.

[0081] The processing formula is Where, is the retransmission time, is the initial transmission time, k is the number of retransmissions, The interval between each retransmission.

[0082] In the process of calculating the priority of each node that has not been successfully sent, the priority back-propagation mechanism is adopted to allow the priority of multiple nodes that have not been successfully sent to be increased under specific conditions to ensure the timely transmission of important data and avoid frame loss in some nodes.

[0083] Among them, the priority back propagation mechanism is expressed as ;

[0084] in, For the new priority, For the old priority, is the lifting coefficient, is the critical time threshold, is the current time.

[0085] In the second aspect, the present invention also proposes a multi-level CAN protocol design device, comprising: a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the computer program, the steps of the multi-level CAN protocol design method as described in any one of the first aspects are implemented.

[0086] The above description is only a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with the technical field, within the technical scope disclosed by the present invention, who makes equivalent replacements or changes based on the technical solution and inventive concept of the present invention, should be covered by the scope of protection of the present invention.

Claims

1. A multi-level CAN protocol design method, characterized in that: Applied to CAN communication system, which includes a master node and multiple slave nodes, both of which are connected to the CAN bus, including: Design a priority management mechanism; Define the extended data frame structure of CAN2.0B; Based on the extended data frame structure, the information to be transmitted is transmitted according to the priority management mechanism; The design priority management mechanism includes: The plurality of slave nodes are divided into high-level nodes, middle-level nodes and low-level nodes according to the importance of information transmitted by each slave node; The priority and weight of the master node and each slave node in the high-level node, mid-level node and bottom-level node are defined respectively; wherein the priority of the master node, high-level node, mid-level node and bottom-level node decreases in sequence, and the high-level node, mid-level node and bottom-level node each include multiple hierarchical nodes with different priorities, and each hierarchical node corresponds to a slave node; Each node has a unique address; wherein, the extended data frame structure includes: a direction bit, an address of a source node, an address of a destination node, an instruction type, a frame type, a frame index number, and a data segment; wherein, the direction bit, the address of a source node, the address of a destination node, the instruction type, the frame type, and the frame index number can all be used to define a priority; wherein, the priority of each node is expressed as Pi=Ti×Wi; wherein, Pi is the priority of node i, Wi is the weight of node i, Ti is the transmission delay of node i, i=1,2,3,…,N, and N is the total number of master nodes and slave nodes.

2. The multi-level CAN protocol design method according to claim 1, characterized in that: After defining the priorities and weights of each slave node in the high-level nodes, mid-level nodes, and low-level nodes, it also includes: Dynamically adjust the priority of each node in each layer according to the real-time status of the node and network load; Among them, during the dynamic adjustment process, the priority of each node is expressed as Where, is the priority of node i at time t, is the priority of node i at time t −1, and ΔPi is the priority adjustment amount according to the change of network status.

3. The multi-level CAN protocol design method according to claim 2, characterized in that: After defining the priorities and weights of each slave node in the high-level nodes, mid-level nodes, and low-level nodes, it also includes: A multi-level protocol expansion formula is introduced to optimize the communication efficiency between different nodes; the multi-level protocol expansion formula is: Where, is the communication efficiency, Pi is the priority of node i, Di is the data volume of node i, and Ci is the communication capacity of node i.

4. The multi-level CAN protocol design method according to claim 1, characterized in that: The direction bit is ID28-ID27, the address of the source node is ID26-ID19, the address of the target node is ID18-ID11, the instruction type is ID10-ID9, the frame type is ID8-ID7, and the frame index number is ID6-ID0.

5. The multi-level CAN protocol design method according to claim 1, characterized in that: The direction bit includes master node to slave node communication, slave node to master node communication, slave node to slave node communication and reserved; the frame type includes single frame data, non-end multi-frame data, end multi-frame data and reserved; Command types include broadcast mode, control command, device status and device data; Among them, in the frame type of multi-frame data, the total frame number is added to the first byte of the first frame in the non-end multi-frame data, and the last two bytes in the end multi-frame data are the data field CRC16 check.

6. The multi-level CAN protocol design method according to claim 1, characterized in that: During data transmission, a preset conflict detection and processing mechanism is used to detect and process conflicts; wherein the conflict detection and processing mechanism includes a conflict detection formula and a processing formula; Conflict detection and handling is performed using a preset conflict detection and handling mechanism, specifically including: Use the conflict detection formula to detect whether there are multiple nodes sending data at the same time; If so, determine whether each node in the multiple nodes has successfully sent the message; if not, calculate the priority of each node that has not successfully sent the message, and calculate the retransmission time of each node that has not successfully sent the message according to the processing formula and the priority of each node that has not successfully sent the message; each node that has not successfully sent the message continues to send the message according to the retransmission time; the node with a higher priority has a shorter retransmission time; The conflict detection formula is: ; Where C is the conflict detection value, is the data transmission request of node j, is the request status of node j; Or 1, 1 means request, 0 means no request; The processing formula is Where, is the retransmission time, is the initial transmission time, k is the number of retransmissions, The interval between each retransmission.

7. The multi-level CAN protocol design method according to claim 6, characterized in that: In the process of calculating the priority of each node that failed to send, the priority back propagation mechanism is used to improve the priority of each node that failed to send; Among them, the priority back propagation mechanism is expressed as ; in, For the new priority, For the old priority, is the lifting coefficient, is the critical time threshold, is the current time.

8. A multi-level CAN protocol design device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the multi-level CAN protocol design method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Serial bus design method of dynamic priority

    CN111682992A