Protection method and device for normal operation of CAN bus and storage medium

By performing error monitoring and message monitoring on the CAN bus, the threshold is dynamically adjusted to reduce the interference of its own software exceptions to the bus, and the problem of CAN bus easily crashing when facing node exceptions in the prior art is solved, and the normal operation protection and reliability improvement of the CAN bus is achieved.

CN120223456APending Publication Date: 2025-06-27XIAMEN YAXON ZHILLAN TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311764446.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-20
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

The existing CAN bus protection mechanism can easily cause bus crash when facing node exceptions, and cannot effectively avoid interference from its own exceptions on the entire vehicle bus.

Method used

By turning on error monitoring and message monitoring in the normal working mode of the CAN bus, we can judge whether the error duration and message monitoring time have reached the threshold in real time, and dynamically adjust the first time threshold T1 and the second time threshold T2 to reduce the interference of its own software abnormalities on the bus.

Benefits of technology

It effectively avoids bus crashes caused by its own exceptions, realizes the normal operation protection of the CAN bus, and enhances the reliability and stability of the bus.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120223456A_ABST
    Figure CN120223456A_ABST
Patent Text Reader

Abstract

The invention relates to a protection method and device for normal operation of a CAN bus and a storage medium, and the method comprises the steps: S1, starting error monitoring in a normal working mode of the CAN bus, and recording the error duration; s2, judging whether the duration time of error monitoring reaches T1 or not, and entering S3 when the duration time of error monitoring reaches T1; s3, judging whether errors are monitored in the CAN communication process or not, and if yes, entering S4; otherwise, returning to S1; s4, message monitoring is started in the mode of prohibiting the sending function of the CAN bus, and the duration time of message monitoring is recorded; s5, judging whether the duration reaches T2 or not, if yes, judging whether the message is monitored or not, if yes, increasing T1, decreasing T2, and returning to S1; otherwise, T1 is reduced, T2 is increased, and S1 is returned. According to the invention, the interference of self software abnormity on the CAN bus is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of CAN buses, and in particular, to a protection method, device, and storage medium for the normal operation of a CAN bus. Background Art

[0002] Currently, the network architecture design of most vehicle hosts highly depends on the CAN bus. The communication of basically all major functional nodes is completed through the CAN bus. Once one or several nodes have abnormalities (such as baud rate and sampling point errors), it may directly lead to the collapse of the entire bus. Therefore, it is necessary to study an effective and reliable bus protection mechanism. The existing bus protection mechanisms widely adopted in software generally implement through the fast and slow recovery strategies of Busoff (bus off). Summary of the Invention

[0003] To solve the above problems, the present invention proposes a protection method, device, and storage medium for the normal operation of a CAN bus.

[0004] The specific solutions are as follows:

[0005] A protection method for the normal operation of a CAN bus includes the following steps:

[0006] S1: Enable error monitoring in the normal working mode of the CAN bus and record the duration of error monitoring;

[0007] S2: Real-time judge whether the duration of error monitoring reaches the first time threshold T1. When it reaches, enter S3;

[0008] S3: Judge whether an error occurs in the CAN communication process during error monitoring. If so, enter S4; otherwise, return to S1;

[0009] S4: Enable message listening in the mode of prohibiting the sending function of the CAN bus and record the duration of message listening;

[0010] S5: Real-time judge whether the duration of message listening reaches the second time threshold T2. When it reaches, judge whether a message is monitored during message listening. If so, set the first time threshold T1 to increase and the second time threshold T2 to decrease, and return to S1; otherwise, set the first time threshold T1 to decrease and the second time threshold T2 to increase, and return to S1.

[0011] Further, the errors in the CAN communication process are recorded by an error counter, including transmission errors and reception errors.

[0012] Further, the sum of the first time threshold T1 and the second time threshold T2 is a fixed value.

[0013] Further, the sum of the first time threshold T1 and the second time threshold T2 is 100 milliseconds.

[0014] Further, the time for each increase or decrease of the first time threshold T1 and the second time threshold T2 is 10 milliseconds.

[0015] A protection device for the normal operation of a CAN bus, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method described above in the embodiments of the present invention are implemented.

[0016] A computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the steps of the method described above in the embodiments of the present invention are implemented.

[0017] The present invention adopts the above technical solution, adjusts the degree of its own bus participation by using bus error detection before Busoff, avoids interfering with the operation of the vehicle bus due to its own abnormality, and realizes the protection of the normal operation of the CAN bus. Description of the Drawings

[0018] Figure 1 The flowchart of Embodiment 1 of the present invention is shown. Detailed Embodiments

[0019] To further illustrate the embodiments, the present invention provides drawings. These drawings are part of the disclosure of the present invention, mainly used to illustrate the embodiments, and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these contents, those of ordinary skill in the art should be able to understand other possible embodiments and the advantages of the present invention.

[0020] The present invention will be further described below in conjunction with the drawings and specific embodiments.

[0021] Embodiment 1:

[0022] The embodiment of the present invention provides a method for protecting the normal operation of a CAN bus, as Figure 1 shown, the method includes the following steps:

[0023] S1: Enable error monitoring in the normal working mode of the CAN bus and record the duration of the error monitoring.

[0024] S2: Continuously determine whether the duration of the error monitoring reaches the first time threshold T1. When it reaches, enter S3.

[0025] S3: Determine whether an error occurs in the CAN communication process during the error monitoring. If so, enter S4; otherwise, return to S1.

[0026] S4: Enable message listening in the mode of disabling the transmission function of the CAN bus, and record the duration of message listening.

[0027] S5: Real-time judge whether the duration of message listening reaches the second time threshold T2. When it reaches, judge whether a message is listened during the message listening process. If so, set the first time threshold T1 to increase and the second time threshold T2 to decrease, and return to S1; otherwise, set the first time threshold T1 to decrease and the second time threshold T2 to increase, and return to S1.

[0028] In this embodiment, the errors in the CAN communication process are recorded through an error counter, including transmission errors and reception errors.

[0029] Furthermore, set the sum of the first time threshold T1 and the second time threshold T2 to a fixed value, which is set to 100 milliseconds in this embodiment. On this basis, the time for the first time threshold T1 to increase (decrease) and the second time threshold T2 to decrease (increase) should be equal, and the difference each time is set to 10 milliseconds in this embodiment.

[0030] In this embodiment, through the continuous cycle of the two modes of error monitoring and message listening, the interference of its own software anomalies to the CAN bus is reduced. At the same time, the first time threshold T1 and the second time threshold T2 can be dynamically self-adjusted according to the degree of CAN communication anomalies, which is an effective supplement to the Busoff fast and slow recovery mechanism of the CAN bus.

[0031] This embodiment adjusts the participation degree of its own bus by using bus error detection before Busoff, avoiding interfering with the operation of the vehicle bus due to its own anomalies, and realizing the protection of the normal operation of the CAN bus.

[0032] Embodiment 2:

[0033] The present invention also provides a protection device for the normal operation of the CAN bus, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps in the above method embodiment of Embodiment 1 of the present invention are implemented.

[0034] The present invention also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the above method of the present invention embodiment are implemented.

[0035] Although the present invention has been specifically shown and described in connection with preferred embodiments, those skilled in the art should understand that various changes in form and detail may be made to the present invention without departing from the spirit and scope of the present invention as defined by the appended claims, and all such changes are within the scope of protection of the present invention.

Claims

1. A protection method for the normal operation of the CAN bus, characterized in that Including the following steps: S1: Enable error monitoring in the normal working mode of the CAN bus and record the duration of error monitoring; S2: Real-time judge whether the duration of error monitoring reaches the first time threshold T1. When it reaches, enter S3; S3: Judge whether an error occurs in the CAN communication process during error monitoring. If so, enter S4; Otherwise, return to S1; S4: Enable message listening in the mode of disabling the sending function of the CAN bus and record the duration of message listening; S5: Real-time judge whether the duration of message listening reaches the second time threshold T2. When it reaches, judge whether a message is monitored during message listening. If so, set the first time threshold T1 to increase and the second time threshold T2 to decrease, and return to S1; otherwise, set the first time threshold T1 to decrease and the second time threshold T2 to increase, and return to S1.

2. The protection method for the normal operation of the CAN bus according to claim 1, characterized in that: The errors in the CAN communication process are recorded through an error counter, including transmission errors and reception errors.

3. The protection method for the normal operation of the CAN bus according to claim 1, characterized in that: The sum of the first time threshold T1 and the second time threshold T2 is a fixed value.

4. The protection method for the normal operation of the CAN bus according to claim 3, characterized in that: The sum of the first time threshold T1 and the second time threshold T2 is 100 milliseconds.

5. The protection method for normal operation of the CAN bus according to claim 1, characterized in that: The time for the first time threshold T1 and the second time threshold T2 to increase or decrease each time is 10 milliseconds.

6. A protection device for the normal operation of a CAN bus, characterized in that: Including a processor, a memory, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 5 are implemented.