Multi-level CAN protocol design method and device

The multi-level CAN protocol addresses inefficiencies in traditional CAN protocols by implementing priority management and dynamic node adjustments, enhancing communication efficiency and reliability in complex systems.

CN120321310AActive Publication Date: 2025-07-15ANHUI ZHONGKE ZHONGHUAN INTELLIGENT EQUIP CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Traditional CAN protocols have problems such as data conflicts, complex node management, lack of hierarchical structure and insufficient real-time performance in multi-node communication, especially in high load situations, which are difficult to meet real-time requirements.

Method used

The multi-level CAN protocol design method is adopted, and the nodes are divided into high, medium and low levels through the priority management mechanism, and the extended data frame structure is defined, the node priority and weight are dynamically adjusted, and the multi-level protocol extension formula is introduced, and the conflict detection and processing mechanism is used to optimize communication efficiency.

Benefits of technology

It improves data transmission efficiency and reliability, ensures the stable operation of the system under high load conditions, meets real-time requirements, and optimizes the flexibility and communication efficiency of node management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120321310A_ABST
    Figure CN120321310A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-level CAN protocol design method and device, and relates to the field of CAN protocol design, and the method comprises the steps: designing a priority management mechanism; defining an extended data frame structure of the CAN2.0B; based on the extended data frame structure, performing data transmission on the to-be-transmitted information according to a priority management mechanism; wherein the design priority management mechanism comprises the following steps of: dividing a plurality of slave nodes into high-level nodes, middle-level nodes and bottom-level nodes according to the importance degree of transmission information of each slave node; and respectively defining the priorities and weights of the master node and the slave nodes in the high-level nodes, the middle-level nodes and the bottom-level nodes. The network nodes in the system are subjected to hierarchical division and priority management, so that the transmission efficiency and reliability are effectively improved, and the stable operation of the system under a high-load condition is ensured.
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] With the increasing demand for intelligence and automation, the number of devices and nodes involved in the system is also increasing. Efficient and reliable communication is required between various devices and nodes to achieve real - time monitoring and control of the devices. However, the traditional CAN protocol has limitations in the following aspects: (1) Data conflict problem: In the case of multiple nodes sending data simultaneously, the traditional CAN protocol uses a priority mechanism to solve data conflicts. However, in high - load situations, data loss and re - transmission may still occur, affecting the real - time performance and reliability of the system; (2) Node management complexity: As the scale of the system expands and the number of nodes increases, network management becomes more complex. The traditional CAN protocol lacks flexibility in dynamically adding, deleting nodes and adjusting priorities, and it is difficult to adapt to rapidly changing application requirements; (3) Lack of hierarchical structure: The traditional CAN protocol usually adopts a flat network structure, and all nodes communicate at the same level, lacking a mechanism to effectively distinguish nodes with different functions and importance; this design is prone to low communication efficiency and resource waste when facing complex multi - level systems; (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 needs. Especially in high - load situations, the real - time performance of the system is severely affected.

[0003] Therefore, in view of 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

[0004] To solve the technical problems in the background art, the present invention proposes a multi - level CAN protocol design method and device.

[0005] In the first aspect, a multi - level CAN protocol design method proposed by the present invention, which is applied to a CAN communication system, includes: Design a priority management mechanism; Define the extended data frame structure of CAN2.0B; Based on the extended data frame structure, transmit the information to be transmitted according to the priority management mechanism; Among them, designing the priority management mechanism includes: Multiple slave nodes are divided into high-level nodes, middle-level nodes, and low-level nodes according to the importance of the information transmitted by each slave node; Define the priorities and weights of the master node and each slave node in the high-level nodes, middle-level nodes, and low-level nodes respectively; among them, the priorities of the master node, high-level nodes, middle-level nodes, and low-level nodes decrease in turn, and the high-level nodes, middle-level nodes, and low-level nodes all include multiple hierarchical nodes with different priorities, and each hierarchical node corresponds to a slave node.

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

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

[0008] Preferably, after defining the priorities and weights of each node in the high-level nodes, middle-level nodes, and low-level nodes respectively, it further includes: dynamically adjusting the priorities of each node in each layer according to the real-time state of the node and the network load; among them, during the dynamic adjustment process, the priority of each node is expressed as ; in the formula, is the priority of node i at time t, is the priority of node i at time , is the priority adjustment amount according to the change of the network state.

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

[0010] Preferably, the multi-level protocol extension formula is ; in the formula, is the communication efficiency, Pi is the priority of node i, Di is the data volume of node i, and Ci is the communication ability of node i.

[0011] Preferably, each node has a unique address; among them, the extended data frame structure includes: direction bit, address of the source node, address of the target node, instruction type, frame type, frame serial number, and data segment.

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

[0013] Preferably, the direction bit includes communication from the master node to the slave node, communication from the slave node to the master node, communication from the slave node to the slave node, and reservation.

[0014] Preferably, the frame type includes single - frame data, non - ending multi - frame data, ending multi - frame data, and reservation.

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

[0016] Preferably, the instruction type includes broadcast mode, control command, device status, and device data.

[0017] Preferably, during the data transmission process, a preset conflict detection and handling mechanism is used for conflict detection and handling; among them, the conflict detection and handling mechanism includes a conflict detection formula and a handling formula; Using a preset conflict detection and handling mechanism for conflict detection and handling specifically includes: Using the conflict detection formula to detect whether there is simultaneous data transmission by multiple nodes; If so, respectively determine whether each node among the multiple nodes has been successfully transmitted; if not, respectively calculate the priorities of the nodes that have not been successfully transmitted, and according to the handling formula and the priorities of the nodes that have not been successfully transmitted, respectively calculate the re - transmission times of the nodes that have not been successfully transmitted; each node that has not been successfully transmitted continues to transmit according to the re - transmission time; among them, the higher the priority of the node that has not been successfully transmitted, the shorter the re - transmission time; each node that has not been successfully transmitted continues to transmit according to the re - transmission time; among them, the higher the priority of the node that has not been successfully transmitted, the shorter the re - transmission time; Among them, the conflict detection formula is ; in the formula, C is the conflict detection value, is the data transmission request of node j, is the request status of node j; among them, , 1 represents a request, 0 represents no request; The handling formula is ; in the formula, is the re - transmission time, is the initial transmission time, k is the number of re - transmissions, is the time interval for each re - transmission.

[0018] Preferably, in the process of calculating the priorities of the nodes that have not been successfully sent, a priority backpropagation mechanism is adopted to increase the priorities of the nodes that have not been successfully sent; Among them, the priority backpropagation mechanism is expressed as ; Among them, is the new priority, is the old priority, is the boosting coefficient, is the critical time threshold, is the current time.

[0019] In a second aspect, the present invention also provides a multi-level CAN protocol design device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the steps of the multi-level CAN protocol design method described in any item of the first aspect are implemented.

[0020] In the present invention, the proposed multi-level CAN protocol design method and device effectively improve the transmission efficiency and reliability by hierarchically partitioning the network nodes in the system and managing the priorities, ensuring the stable operation of the system under high load conditions. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 is a schematic flowchart of the multi-level CAN protocol design method in an embodiment proposed by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0022] It should be noted that, without conflict, the embodiments in the present invention and the features in the embodiments may be combined with each other. The present invention will be described in detail below with reference to the drawings and in conjunction with the embodiments.

[0023] In a first aspect, as Figure 1 shown, a multi-level CAN protocol design method proposed by the present invention is applied to a CAN communication system and includes: Design a priority management mechanism according to the importance of the information transmitted by each node; Define the extended data frame structure of CAN2.0B; Based on the extended data frame structure, transmit the information to be transmitted according to the priority management mechanism.

[0024] In this embodiment, first, a priority management mechanism is designed according to the importance of the information transmitted by each node; then, the extended data frame structure of CAN2.0B is defined; 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 key data.

[0025] It should be understood that the CAN communication system includes a master node and multiple slave nodes. The master node and multiple slave nodes are all connected to the CAN bus, and data can be processed and interacted between the master node and the slave nodes, as well as between the slave nodes. The master node is generally a brain device, and other slave nodes are subsystem devices. The priority of the master node is higher than that of any one slave node.

[0026] In this embodiment, a priority management mechanism is designed according to the importance of the information transmitted by each node, specifically including: 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; The priorities and weights of the master node and each slave node in the high-level nodes, middle-level nodes, and low-level nodes are defined respectively; among them, the priorities of the master node, high-level nodes, middle-level nodes, and low-level nodes decrease in turn. The high-level nodes, middle-level nodes, and low-level nodes all include multiple hierarchical nodes with different priorities, and each hierarchical node corresponds to a slave node.

[0027] In this embodiment, by dividing multiple slave nodes into high-level nodes, middle-level nodes, and low-level nodes according to the importance of the information transmitted by each slave node; and defining the priorities and weights of the master node and each slave node in the high-level nodes, middle-level nodes, and low-level nodes respectively, the communication requirements of different functional nodes can be effectively managed, the priority management of data transmission is optimized, and the timely transmission of key data is ensured.

[0028] In each level, the priority, data type, address of the target node, and frame index number sent to other nodes can be hierarchically divided. That is, under the same level, the different priorities will change according to the filling of the message.

[0029] 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.

[0030] 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 the functional importance), Ti is the transmission delay of node i, i = 1, 2, 3,..., N, and N is the total number of the master node and slave nodes.

[0031] In a further embodiment, after defining the priorities and weights of each node in the high-level nodes, middle-level nodes, and low-level nodes respectively, it further includes: dynamically adjusting the priorities of each node in each level according to the real-time state of the node and the network load situation.

[0032] In this embodiment, the improvement of priority management and dynamic adjustment ensures that high-priority nodes can obtain data transmission opportunities in a timely manner at critical moments, meeting the real-time requirements.

[0033] 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 adjustment amount according to the change of network state.

[0034] In a further embodiment, in the priority management mechanism, a multi-level protocol extension formula is introduced to support the optimization of communication efficiency between nodes at different levels; among them, the multi-level protocol extension 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 ability of node i.

[0035] It should be understood that each node can act as both a source node and a destination node, and each node has a unique address. The node is the master node or any one of the slave nodes.

[0036] In this embodiment, the extended data frame structure includes: direction bit, source node address, destination node address, instruction type, frame type, frame serial number, and data segment.

[0037] The optimized packet format in this embodiment significantly improves the data transmission efficiency, reduces the latency and data loss rate. Moreover, it can be compatible with the existing CAN protocol, facilitating upgrades and applications in the existing system.

[0038] 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.

[0039] Of course, the priority can not only be based on the node address. Other direction bits, instruction types, frame types, and frame serial numbers can also participate in the priority setting. In other defined cases, the smaller the single value of the direction bit, instruction type, frame type, and frame serial number, the higher the priority.

[0040] In one specific embodiment, the direction bit is ID28-ID27, the source node address is ID26-ID19, the destination node address is ID18-ID11, the instruction type is ID10-ID9, the frame type is ID8-ID7, the frame serial number is ID6-ID0, and the data segment is DaTA, fixed at 8 bytes.

[0041] In this embodiment, the direction bits include communication from the master node to the slave node, communication from the slave node to the master node, communication from the slave node to the slave node, and reservation.

[0042] 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; 11 indicates reservation.

[0043] Among them, each CAN node has a unique node address. In this embodiment, the instruction types include broadcast mode, control command, device status, and device data; among them, the broadcast mode is 00, the control command is 01, the device status is 10, and the device data is 11.

[0044] The instruction types in this embodiment support the transmission of multiple data types, enhancing the flexibility and adaptability of the protocol.

[0045] In this embodiment, the frame types include single-frame data, non-ending multi-frame data, ending multi-frame data, and reserved. In the frame types, 00 indicates single-frame data, 01 indicates reserved or reserved for use, 10 indicates non-ending multi-frame data, and 11 indicates ending multi-frame data.

[0046] This embodiment is set up in this way to optimize the transmission of multi-frame data. By distinguishing between non-ending multi-frames and ending multi-frames, the redundant information in data transmission is reduced, and the bandwidth utilization rate is improved. Moreover, it allows new frame types to be flexibly added to the protocol to adapt to the development and application needs of future technologies, ensuring the long-term effectiveness and adaptability of the protocol.

[0047] During the multi-frame transmission process, the total number of frames is added to the first byte of the first frame, and the last two bytes of the last frame of the ending multi-frame are the CRC16 checksum of the data field. In this embodiment, by nominating the total number of frames in the first frame of the multi-frame data, the loss of intermediate frames or the injection of forged frames can be detected, and CRC checks are set in the ending frame to detect whether there is a problem of data being tampered with due to interference sources during data transmission. When the CRC16 checksum of the data field does not match the data, this frame of data can be discarded. Moreover, by concentrating the checksum in the last frame, the protocol overhead can be reduced compared to per-frame checking.

[0048] The schematic diagram of single-frame data in one specific embodiment is shown in Table 1.

[0049]

[0050] The schematic diagram of single-frame data in another specific embodiment is shown in Table 2.

[0051]

[0052] In one specific embodiment, the schematic diagram of multi-frame data is shown in Table 3.

[0053]

[0054] In this embodiment, the frame index number supports single node to single node, and the maximum number of frames for sending the same type of data is 128 frames.

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

[0056] 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 simultaneously; the handling formula is used to retransmit data when a conflict occurs.

[0057] Among them, in the conflict detection and handling mechanism, the conflict detection formula is ; in the formula, C is the conflict detection value, is the data transmission request of node j, is the request status of node j; among them, , 1 represents a request, and 0 represents no request; When a conflict occurs, multiple nodes retransmit according to a preset handling formula. Specifically, it is determined whether each node among the multiple nodes has been successfully sent; if not, the priorities of the nodes that have not been successfully sent are calculated respectively, and according to the handling formula and the priorities of the nodes that have not been successfully sent, the retransmission times of the nodes that have not been successfully sent are calculated respectively; the nodes that have not been successfully sent continue to send according to the retransmission times; among them, the higher the priority of the node that has not been successfully sent, the shorter the retransmission time; the nodes that have not been successfully sent continue to send according to the retransmission times to solve the problems of possible data loss and retransmission in high-load situations. When retransmitting, the higher the priority of the node that has not been successfully sent, the shorter the retransmission time.

[0058] Among them, the handling formula is ; in the formula, is the retransmission time, is the initial transmission time, k is the number of retransmissions, is the time interval for each retransmission.

[0059] During the process of calculating the priorities of the nodes that have not been successfully sent respectively, a priority backpropagation mechanism is adopted, allowing the priorities of the nodes that have not been successfully sent to increase their priorities under specific conditions to ensure the timely transmission of important data and avoid frame loss of some nodes.

[0060] Among them, the priority backpropagation mechanism is expressed as ; Wherein, is the new priority, is the old priority, is the promotion coefficient, is the critical time threshold, is the current time.

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

[0062] As described above, only the specific preferred embodiments of the present invention are given, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention, according to the technical solution and inventive concept of the present invention, making equivalent substitutions or changes, shall be covered by the protection scope of the present invention.

Claims

1. A multi - level CAN protocol design method, characterized in that, Applied to a CAN communication system, the CAN communication system includes a master node and multiple slave nodes, and both the master node and the multiple slave nodes are connected to the CAN bus, including: Design a priority management mechanism; Define the extended data frame structure of CAN 2.0B; Based on the extended data frame structure, transmit the information to be transmitted according to the priority management mechanism; Among them, designing the priority management mechanism includes: Divide the multiple slave nodes into high-level nodes, middle-level nodes, and low-level nodes according to the importance of the information transmitted by each slave node; Define the priorities and weights of the master node and each slave node in the high-level nodes, middle-level nodes, and low-level nodes respectively; among them, the priorities of the master node, high-level nodes, middle-level nodes, and low-level nodes decrease in sequence, and the high-level nodes, middle-level nodes, and low-level nodes all include multiple hierarchical nodes with different priorities, and each hierarchical node corresponds to a slave node.

2. The multi-level CAN protocol design method according to claim 1, characterized in that, Among them, 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, and i = 1, 2, 3, …, N, where N is the total number of master and slave nodes.

3. 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, middle-level nodes, and low-level nodes respectively, it further includes: Dynamically adjust the priorities of each node in each level according to the real-time state of the node and the network load; Among them, during the dynamic adjustment process, the priority of each node is expressed as ; in the formula,[[]] is the priority of node i at time t,[[]] is the priority of node i at time ;[[]] is the priority adjustment amount according to the change of network state.

4. The multi-level CAN protocol design method according to claim 3, wherein After defining the priorities and weights of each slave node in the high-level nodes, middle-level nodes, and low-level nodes respectively, it further includes: Introduce a multi-level protocol extension formula to optimize the communication efficiency between different nodes; among them, the multi-level protocol extension formula is ; in the formula,[[]]END]] is the communication efficiency, Pi is the priority of node i, Di is the data volume of node i, and Ci is the communication ability of node i.

5. The multi-level CAN protocol design method according to claim 1, characterized in that Each node has a unique address; among them, the extended data frame structure includes: direction bit, source node address, destination node address, instruction type, frame type, frame sequence number, and data segment; among them, the direction bit, source node address, destination node address, instruction type, frame type, and frame sequence number can all be used to define the priority.

6. The multi-level CAN protocol design method according to claim 5, wherein The direction bit is ID28-ID27, the source node address is ID26-ID19, the destination node address is ID18-ID11, the instruction type is ID10-ID9, the frame type is ID8-ID7, and the frame sequence number is ID6-ID0.

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

8. The multi - level CAN protocol design method according to claim 1, wherein During the data transmission process, use a preset conflict detection and handling mechanism for conflict detection and handling; among them, the conflict detection and handling mechanism includes a conflict detection formula and a handling formula; Use a preset conflict detection and handling mechanism for conflict detection and handling, specifically including: Use the conflict detection formula to detect whether there is multi-node simultaneous data transmission; If so, determine whether each node in the multi-node has been successfully transmitted respectively; if not, calculate the priorities of the nodes that have not been successfully transmitted respectively, and calculate the retransmission times of the nodes that have not been successfully transmitted according to the processing formula and the priorities of the nodes that have not been successfully transmitted; each node that has not been successfully transmitted continues to transmit according to the retransmission time; among them, the retransmission time of the node that has not been successfully transmitted with a higher priority is shorter; Among them, the conflict detection formula is ; in the formula, C is the conflict detection value, is the data transmission request of node j, is the request status of node j; among them, , 1 indicates a request, and 0 indicates no request; The processing formula is ; In the formula, is the retransmission time, is the initial transmission time, k is the number of retransmissions, is the time interval for each retransmission.

9. The multi-level CAN protocol design method according to claim 8, characterized in that During the process of calculating the priorities of the nodes that have not been successfully transmitted respectively, a priority backpropagation mechanism is adopted to increase the priorities of the nodes that have not been successfully transmitted; Among them, the priority backpropagation mechanism is represented as ; Among them, is the new priority, is the old priority, is the promotion coefficient, is the critical time threshold, is the current time.

10. A multi - level CAN protocol design device, characterized in that, including: A memory, a processor, and a computer program stored on the memory and executable on the processor, and 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

  • CAN bus communication method based on CAN2.0B

    CN108199941A

  • Industrial time sensitive network multilevel security data scheduling method

    CN109450943A

  • Serial bus design method of dynamic priority

    CN111682992A

  • Preemptive multi-master RS485 bus communication method based on dynamic priorities

    CN112231260A

  • Method and device for transmitting CAN (Controller Area Network) message of electric vehicle

    CN114422289A