CAN network communication diagnosis method and device and vehicle
By extending the diagnosis time to wait for messages with potential delays in CAN network communication diagnosis, the problem of misjudgment of CAN network communication diagnosis in the prior art is solved, and the accuracy and accuracy of communication abnormality detection are improved.
Patent Information
- Application Number
- CN202411172336.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2044-08-26
AI Technical Summary
The existing CAN network communication diagnostic method may lead to misjudgment after receiving a single network message timeout, resulting in communication diagnostic errors, and it is impossible to accurately judge the packet reception situation.
When the target CAN node message is not received in the first diagnostic window, the second diagnostic window is opened to extend the diagnosis time, continue to wait for the message to be received, update the timeout information of the target node, and communicate when the reporting conditions are met. Abnormal reporting.
The accuracy of the target node timeout information is improved, false alarm communication abnormalities caused by the short diagnosis time is avoided, and the accuracy of network communication diagnosis is improved.
Smart Images

Figure CN119109759A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of vehicle technology, and in particular to a CAN (Controller Area Network) network communication diagnosis method, device and vehicle. Background Art
[0002] The CAN network is used to implement communication between onboard electronic devices. As the demand for device communication security increases, vehicle electronic devices need to perform communication diagnosis on the CAN network.
[0003] In the related art, network communication is monitored by periodically receiving network messages, and when the reception times out, it is determined that a network failure exists.
[0004] However, in the case of a reception timeout for a single network message, the CAN controller may receive the message after the timeout, but still determine that the message reception has failed, resulting in a communication diagnosis error. Summary of the invention
[0005] The embodiment of the present application provides a CAN network communication diagnosis method, device and vehicle. The technical solution is as follows:
[0006] On the one hand, an embodiment of the present application provides a CAN network communication diagnosis method, the method comprising:
[0007] Determining a first diagnostic window based on a target message period of the target CAN node sending the CAN node message;
[0008] When the CAN node message sent by the target CAN node is not received within the first diagnostic window, a second diagnostic window is opened, wherein the second diagnostic window is smaller than the first diagnostic window;
[0009] Based on the reception status of the CAN node message in the second diagnostic window, updating the target node timeout information corresponding to the target CAN node;
[0010] When the target node timeout information meets the reporting condition, a communication abnormality report is performed on the target CAN node.
[0011] On the other hand, an embodiment of the present application provides a CAN network communication diagnostic device, the device comprising:
[0012] A determination module, configured to determine a first diagnostic window based on a target message period of a target CAN node sending a CAN node message;
[0013] An opening module, configured to open a second diagnostic window when the CAN node message sent by the target CAN node is not received within the first diagnostic window, wherein the second diagnostic window is smaller than the first diagnostic window;
[0014] An updating module, configured to update the target node timeout information corresponding to the target CAN node based on the reception status of the CAN node message in the second diagnostic window;
[0015] The reporting module is used to report the communication abnormality of the target CAN node when the timeout information of the target node meets the reporting condition.
[0016] On the other hand, an embodiment of the present application provides a vehicle, which includes a CAN bus, a CAN node and a CAN controller, the CAN node is connected to the CAN controller via the CAN bus, and the CAN bus is used to implement the CAN network communication diagnostic method as described in the above aspects.
[0017] In the related art, when the CAN node message sent by the target CAN node is not received within the diagnostic window, the CAN controller no longer waits to receive the CAN node message, but opens a new diagnostic window to receive subsequent messages, resulting in misjudgment of the CAN node message.
[0018] In an embodiment of the present application, when the CAN node message sent by the target CAN node is not received within the first diagnostic window, the CAN controller opens a second diagnostic window and continues to wait for receiving the CAN node message, thereby extending the diagnostic time for the CAN node message, thereby avoiding the situation where the actual reception of the message is inconsistent with the reception situation within the diagnostic window due to too short a diagnostic time, causing a false alarm of communication anomaly, which is beneficial to improving the accuracy of the target node timeout information, and thereby improving the accuracy of network communication diagnosis. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 This is a schematic diagram of the CAN node message misjudgment situation;
[0020] Figure 2 is a flowchart of a CAN network communication diagnostic method provided by an exemplary embodiment of the present application;
[0021] Figure 3 is a schematic diagram of a window receiving situation provided by an exemplary embodiment of the present application;
[0022] Figure 4 is a flowchart of a CAN network communication diagnostic method provided by another exemplary embodiment of the present application;
[0023] Figure 5A flow chart showing a process of determining the window duration of the second diagnostic window;
[0024] Figure 6 is a flowchart of a CAN network communication diagnostic process provided by an exemplary embodiment of the present application;
[0025] Figure 7 is a structural block diagram of a CAN network communication diagnostic device provided by an exemplary embodiment of the present application;
[0026] Figure 8 It is a structural block diagram of a vehicle provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0028] First, the nouns involved in this application are explained below.
[0029] CAN node: used to receive, send, and process CAN information. Different CAN nodes send their own CAN node messages to the CAN bus, and determine the CAN node message to be received based on the message ID (Identifier). CAN nodes send CAN node messages according to their own sending cycles.
[0030] CAN controller: controls the reception of CAN node messages sent by CAN nodes by triggering interrupts, and implements communication diagnosis and reports communication anomalies based on the reception status of CAN node messages.
[0031] Among them, the sending and receiving of CAN node messages are asynchronous. The CAN node notifies the CAN controller of the sending cycle of the CAN node message, and the CAN controller determines the window length of the diagnostic window based on the sending cycle. Subsequently, the CAN node sends the CAN node message according to the sending cycle, and the CAN controller diagnoses the message reception according to the diagnostic window.
[0032] However, the CAN bus may be affected by factors such as the network environment, load rate, and node priority, which may cause interference and fluctuation in the signal cycle, resulting in deviations in the arrival time of CAN node messages, which is inconsistent with the diagnostic window of the CAN controller.
[0033] In an illustrative example, Figure 1The figure is a schematic diagram of the misjudgment of CAN node messages. The CAN node sends CAN node messages 1 and CAN node messages 2 at a fixed period. The CAN controller determines that CAN node message 1 is successfully received within diagnostic window 1. The arrival time of CAN node message 2 is delayed. The CAN controller determines that CAN node message 2 fails to be received based on the fact that CAN node message 2 is not received within diagnostic window 2. Even if CAN node message 2 is received after the end of diagnostic window 2, the CAN controller still determines that CAN node message 2 fails to be received.
[0034] See also Figure 2 , Figure 2 1 is a flow chart of a CAN network communication diagnosis method provided by an exemplary embodiment of the present application. The present application embodiment takes the method applied to a CAN controller as an example. The method includes the following steps.
[0035] Step 201 : determining a first diagnostic window based on a target message period of a target CAN node sending a CAN node message.
[0036] In some embodiments, different CAN nodes send their own CAN node messages on the CAN bus according to their own message cycles. The target CAN node is a single CAN node for which the CAN controller implements network communication diagnosis. The CAN controller diagnoses the communication status according to the reception status of the CAN node message sent by the CAN node.
[0037] In some embodiments, the target message period refers to the sending period followed by the target CAN node to send the CAN node message. Optionally, the target CAN node can notify the CAN controller of the target message period before sending the CAN node message so that the CAN controller determines the first diagnostic window.
[0038] In some embodiments, the diagnostic window is used to characterize the duration of the CAN controller monitoring the reception of CAN node messages. A single diagnostic window is used to determine the reception of a single CAN node message.
[0039] In a possible implementation manner, the CAN controller repeatedly opens the first diagnostic window to monitor the reception status of each CAN node message sent by the target CAN node according to the target message period.
[0040] Optionally, the diagnostic duration of the first diagnostic window may be consistent with the period duration of the target message period.
[0041] Step 202: when no CAN node message sent by the target CAN node is received within the first diagnostic window, a second diagnostic window is opened, and the second diagnostic window is smaller than the first diagnostic window.
[0042] In some embodiments, the first diagnostic window is used to preliminarily confirm the reception of the CAN node message. When a CAN node message sent by the target CAN node is received within the first diagnostic window, the CAN controller determines that the CAN node message is received successfully.
[0043] Although the target CAN node sends CAN node messages according to the target message period, the CAN node messages on the CAN bus are prone to time deviation due to the influence of the network environment, resulting in no CAN node messages being received within the first diagnostic window. The CAN controller will determine that a single CAN node message has failed to be received.
[0044] In order to avoid the above problems, when no CAN node message sent by the target CAN node is received within the first diagnostic window, the CAN controller opens a second diagnostic window to continuously monitor the CAN node message sent by the target CAN node to confirm the reception of the delayed CAN node message.
[0045] In some embodiments, the second diagnostic window allows for deviations in the arrival time of CAN node messages. It should be noted that the existence of the second diagnostic window does not affect the CAN node opening the first diagnostic window to monitor the CAN node messages subsequently sent by the target CAN node. In order to prevent the CAN controller from receiving the CAN node messages subsequently sent by the target CAN node within the second diagnostic window, resulting in the CAN node message previously sent by the target CAN node being misjudged as successfully received, the second diagnostic window needs to be smaller than the first diagnostic window.
[0046] Step 203: based on the reception status of the CAN node message in the second diagnosis window, update the target node timeout information corresponding to the target CAN node.
[0047] In some embodiments, the target node timeout information is used to characterize the timeout condition of the target CAN node.
[0048] Optionally, when a CAN node message is received within the second diagnostic window, the CAN controller determines that the reception is successful; when no CAN node message is received within the second diagnostic window, the CAN controller determines that a network anomaly causes a reception timeout.
[0049] In an illustrative example, Figure 3 As shown, the CAN controller performs a cyclic diagnostic task. In the case where no CAN node message is received in the first diagnostic window 301, the CAN controller opens a second diagnostic window 302. The second diagnostic window 302 partially overlaps with the first diagnostic window 303 for receiving subsequent CAN node messages. In the case where a CAN node message 304 is received in the second diagnostic window 302, the CAN controller determines that the reception is successful.
[0050] Step 204: When the target node timeout information meets the reporting condition, report the communication abnormality to the target CAN node.
[0051] In a possible implementation, when the timeout period of the target CAN node reaches a time threshold, the CAN controller reports a communication abnormality to the target CAN node.
[0052] In another possible implementation, when the number of consecutive CAN node message reception failures of the target CAN node reaches a number threshold, the CAN controller reports a communication abnormality to the CAN node.
[0053] In an embodiment of the present application, when the CAN node message sent by the target CAN node is not received within the first diagnostic window, the CAN controller opens a second diagnostic window and continues to wait for receiving the CAN node message, thereby extending the diagnostic time for the CAN node message, thereby avoiding the situation where the actual reception of the message is inconsistent with the reception situation within the diagnostic window due to too short a diagnostic time, causing a false alarm of communication anomaly, which is beneficial to improving the accuracy of the target node timeout information, and thereby improving the accuracy of network communication diagnosis.
[0054] See also Figure 4 , Figure 4 FIG. 1 is a flow chart of a CAN network communication diagnosis method provided by another exemplary embodiment of the present application. The method comprises the following steps.
[0055] Step 401 : determining a first diagnostic window based on a target message period of a target CAN node sending a CAN node message.
[0056] Step 402: when no CAN node message sent by the target CAN node is received within the first diagnostic window, a second diagnostic window is opened, and the second diagnostic window is smaller than the first diagnostic window.
[0057] Among them, the specific description of step 401 and step 402 can refer to step 201 and step 202, and will not be repeated in the embodiment of the present application.
[0058] Step 403, based on the reception status of the CAN node message in the second diagnostic window, update the reception success flag and timeout count value corresponding to the target CAN node, the reception success flag is used to represent the message reception status, and the timeout count value is used to represent the number of message timeouts.
[0059] In some embodiments, the reception success flag and the timeout count value are target node timeout information corresponding to the target CAN node.
[0060] Optionally, when the CAN controller implements network communication diagnosis on different CAN nodes on the CAN bus, the CAN controller can maintain a state machine for each different CAN node, and the state machine is used to store a reception success flag so that the CAN controller can mark the reception status of CAN node messages sent by each CAN node.
[0061] Optionally, the reception success flag bit can represent the real-time reception status of the CAN node message sent by the CAN node. In a possible implementation, the CAN controller updates the reception success flag bit according to the message reception status in the first round of diagnostic windows (including the first diagnostic window and the second diagnostic window), and then updates the reception success flag bit according to the message reception status in the first round of diagnostic windows, and so on.
[0062] In some embodiments, different values of the reception success flag are used to represent different message reception situations. This step may include the following sub-steps.
[0063] Step 403A, when a CAN node message is received in the second diagnostic window, the reception success flag corresponding to the target CAN node is set to a first value, and the timeout count value corresponding to the target CAN node is updated.
[0064] In some embodiments, the reception success flag bit corresponds to the target CAN node. Different target CAN nodes correspond to their own reception success flag bits. Exemplarily, the CAN controller sets the reception success flag bit corresponding to the target CAN node to 1, indicating successful reception.
[0065] Optionally, when a CAN node message is received within the first diagnostic window, the CAN controller may also set the reception success flag corresponding to the target CAN node to the first value, and update the timeout count value corresponding to the target CAN node, which is conducive to ensuring the counting accuracy of the timeout count value.
[0066] In some embodiments, different CAN nodes have different node priorities, wherein a high-priority CAN node has priority in sending CAN node messages on the CAN bus, and a relatively low-priority CAN node sends CAN node messages later, resulting in time deviation of CAN node messages.
[0067] In addition, the load rate of the CAN bus will also cause time deviations in CAN node messages. When the load rate is too high, the CAN bus transmission rate decreases, causing CAN node message delays.
[0068] Optionally, in combination with the node priority and the load rate, the update of the timeout count value may include the following two situations:
[0069] Case 1: When the target CAN node is a high priority node and / or the load rate of the CAN bus is less than the load rate threshold, the timeout count value corresponding to the target CAN node is reduced by one.
[0070] In some embodiments, the timeout count value is used to determine whether the CAN node meets the reporting condition. When the timeout count value of the CAN node reaches the reporting condition, the CAN controller reports the communication abnormality.
[0071] Among them, the network communication requirements of high-priority nodes are higher than those of low-priority nodes. When the CAN node message sent by the high-priority node times out, the CAN controller reduces the timeout count value corresponding to the target CAN node by one, so as to report the communication anomaly in time. Clearing the timeout counter corresponding to the target CAN node is likely to cause the communication anomaly of the high-priority node to be reported untimely, making it difficult to meet the communication needs of the high-priority node.
[0072] In addition, the load rate will affect the transmission efficiency of CAN node messages. When the load rate is less than the load rate threshold, the probability of CAN node message timeout is low, and the possibility of CAN node message timeout due to communication anomalies is high. The CAN controller can improve the communication reporting efficiency by reducing the timeout count value corresponding to the target CAN node by one. Clearing the timeout counter corresponding to the target CAN node is likely to increase the number of additional timeout determinations.
[0073] In case 2, when the target CAN node is not a high priority node and the load rate of the CAN bus is greater than the load rate threshold, the timeout count value corresponding to the target CAN node is set to zero.
[0074] When the target CAN node is not a high-priority node and the load rate of the CAN bus is greater than the load rate threshold, there is no need to report communication anomalies in a timely manner, and excessive load rate reduces the transmission efficiency of CAN node messages and increases the probability of the CAN controller misjudging communication anomalies. Setting the timeout count value corresponding to the target CAN node to zero and restarting the timeout count can reduce the impact of the load rate and improve the accuracy of diagnosing communication anomalies.
[0075] Step 403B, when no CAN node message is received within the second diagnostic window, the reception success flag corresponding to the target CAN node is set to a second value, and the timeout count value corresponding to the target CAN node is updated.
[0076] In some embodiments, the reception cost flag bit corresponds to the target CAN node. Different target CAN nodes correspond to their own reception success flag bits.
[0077] Exemplarily, the CAN controller sets the reception success flag bit corresponding to the target CAN node to 0, indicating a reception failure. When a CAN node message sent by the first CAN node is received within the second diagnostic window, the CAN controller sets the reception success flag bit corresponding to the first CAN node to 1; when a CAN node message sent by the second CAN node is not received within the second diagnostic window, the CAN controller sets the reception success flag bit corresponding to the second CAN node to 0. Since the target message periods of different target CAN nodes are different, the second diagnostic windows corresponding to different target CAN nodes are different.
[0078] Optionally, when no CAN node message is received within the second diagnostic window, the CAN controller may accumulate the number of message timeouts by adding one to the timeout count value corresponding to the target CAN node.
[0079] Step 404, when the timeout count value corresponding to the target CAN node reaches the count threshold, it is determined that the reporting condition is met, and a communication abnormality report is performed on the target CAN node. The count threshold is negatively correlated with the importance of the target CAN node.
[0080] In a possible implementation, high-priority nodes need to report communication anomalies in a timely manner, and are of high importance. The CAN controller sets a smaller counting threshold for high-priority nodes to report communication anomalies in a timely manner, and sets a larger counting threshold for low-priority nodes to improve the accuracy of reporting communication anomalies.
[0081] In another possible implementation, CAN nodes with high error rates need to successfully report communication anomalies, which are of high importance. The CAN controller sets a smaller counting threshold for CAN nodes with high error rates and a larger counting threshold for CAN nodes with low error rates, thereby improving the accuracy of communication anomaly reporting.
[0082] In the embodiment of the present application, CAN diagnoses communication anomalies by updating the reception success flag and the timeout count value, and uses different values for the reception success flag to record the message reception situation. When the timeout count value reaches the count threshold, the communication anomaly is reported. The timeout count value can adjust the update strategy according to the communication requirements of the CAN node, which is conducive to improving the accuracy of communication anomaly reporting.
[0083] In some embodiments, the CAN controller configures multiple first diagnostic windows of the same window duration for the same CAN node to diagnose multiple CAN node messages sent by the CAN node. The second diagnostic window is used to adapt to the deviation of the arrival time of the CAN node message to avoid misjudgment of the reception situation. Since the deviation of the CAN node message sent by different CAN nodes may be different, the window duration of the second diagnostic window corresponding to different CAN nodes may be different.
[0084] In some embodiments, the CAN controller needs to configure the window duration of the second diagnostic window when opening the second diagnostic window, wherein the window duration of the second diagnostic window is related to at least one of the window duration of the first diagnostic window and the CAN network status.
[0085] Optionally, the window length of the second diagnostic window is shorter than the window length of the first diagnostic window. The window length of the second diagnostic window is proportional to the window length of the first diagnostic window.
[0086] Optionally, when the CAN network status is good, the error rate of the message cycle is low, and the window length of the second diagnostic window can be set to be smaller; when the CAN network status is poor, the error rate of the message cycle is high, and the window length of the second diagnostic window can be set to be larger.
[0087] Optionally, the window length of the second diagnostic window may be set as an upper limit of the length, or the window length of the second diagnostic window may be set within the upper limit of the length according to specific circumstances.
[0088] Mode 1: The CAN controller determines the window duration of the second diagnostic window based on the window duration of the first diagnostic window and the proportional factor, wherein the window duration of the second diagnostic window is the product of the window duration of the first diagnostic window and the proportional factor.
[0089] In some embodiments, the proportionality factor is used to characterize the proportional relationship between the second diagnostic window and the first diagnostic window. Optionally, the proportionality factor can be used to determine the upper limit of the duration of the second diagnostic window.
[0090] In a possible implementation, the CAN controller sets the window duration of the second diagnostic window to an upper limit of the duration specified in the communication protocol standard according to an error range in the uniformly specified communication protocol standard.
[0091] Exemplarily, as shown in Table 1, the window duration of the first diagnostic window is the same as the message cycle time of the target CAN node. The window duration of the second diagnostic window is determined according to the error range specified in the communication protocol standard. When the window duration of the first diagnostic window is 60ms, the CAN controller determines that the proportional factor is 0.1, and the upper limit of the duration of the second diagnostic window is 6ms. When the window duration of the first diagnostic window is 10ms, the CAN controller determines that the proportional factor is 0.3, and the upper limit of the duration of the second diagnostic window is 3ms.
[0092] Table 1
[0093]
[0094] Mode 2: The CAN controller determines the upper limit of the window duration of the second diagnostic window based on the window duration and the proportional factor of the first diagnostic window. The upper limit is the product of the window duration of the first diagnostic window and the proportional factor; the window duration of the second diagnostic window is determined based on the CAN network status and the upper limit. The window duration of the second diagnostic window is less than or equal to the upper limit.
[0095] The method for determining the upper limit of the duration is the same as the method for determining the window duration of the second diagnostic window in the above-mentioned method 1, and will not be described in detail in the embodiment of the present application.
[0096] Optionally, the CAN network status may be determined based on at least one of a load rate and a transmission rate.
[0097] In a possible implementation, the CAN controller determines the window duration of the second diagnostic window that is less than or equal to the upper limit of the duration according to a correspondence between the CAN network state, the upper limit of the duration, and the window duration of the second diagnostic window.
[0098] In another possible implementation, the CAN controller determines the duration ratio according to the CAN network state, wherein there is a corresponding relationship between the CAN network state and the duration ratio. The window duration of the second diagnostic window is the product of the duration upper limit and the duration ratio.
[0099] Optionally, the CAN controller may also determine an adjustment factor that matches the CAN network state by utilizing a state evaluation model, thereby improving the degree of matching between the window duration of the second diagnostic window and the CAN network state.
[0100] See also Figure 5 , which shows a flowchart of a process for determining the window length of the second diagnostic window, including the following steps.
[0101] Step 501, obtaining the load rate of the CAN bus and the node timeout information corresponding to each CAN node.
[0102] In some embodiments, the load rate of the CAN bus and the node timeout information corresponding to each CAN node are used to characterize the CAN network status.
[0103] Optionally, the node timeout information may include a reception success flag and a timeout count value, wherein the reception success flag is determined according to the message reception situation, and the timeout count value is determined by counting the number of message timeouts, that is, the number of message reception failures.
[0104] Optionally, the load rate of the CAN bus can be determined according to the upload status of the CAN node message.
[0105] Step 502, the load rate of the CAN bus and the node timeout information corresponding to each CAN node are input into the state assessment model to obtain the adjustment factor output by the state assessment model. The state assessment model is trained based on the sample load rate, the sample node timeout information corresponding to the sample CAN node and the sample adjustment factor. The sample adjustment factor is determined based on the sample window duration and the upper limit of the sample duration.
[0106] The sample load rate and the sample node timeout information corresponding to the sample CAN node may include different CAN network states. The sample adjustment factor is an adjustment factor of different sizes adapted to different network states.
[0107] Optionally, the sample adjustment factor may be the product of the sample window duration and the upper limit of the sample duration, wherein the upper limit of the sample duration may be determined according to the error range of the message cycle time in the uniformly specified communication protocol standard.
[0108] During the training process of the state assessment model, the sample adjustment factor is used to reversely update the model parameters of the state assessment model in combination with the model output results after the sample load rate and the sample node timeout information corresponding to the sample CAN node are input into the state assessment model.
[0109] Step 503: Determine the window duration of the second diagnostic window based on the duration upper limit and the adjustment factor. The window duration of the second diagnostic window is the product of the duration upper limit and the adjustment factor.
[0110] In a possible implementation, the CAN controller determines the upper limit of the duration according to an error range in a uniformly specified communication protocol standard.
[0111] Exemplarily, as shown in Table 1, the window duration of the first diagnostic window is the same as the message cycle time of the target CAN node. The window duration of the second diagnostic window is determined according to the error range specified in the communication protocol standard. When the window duration of the first diagnostic window is 60ms, the upper limit of the duration of the second diagnostic window is 6ms. When the window duration of the first diagnostic window is 10ms, the upper limit of the duration of the second diagnostic window is 3ms.
[0112] In an embodiment of the present application, the CAN controller can configure the window duration of the second diagnostic window according to the window duration of the first diagnostic window and / or the CAN network status, thereby improving the rationality of the window duration of the second diagnostic window. Among them, the window duration of the second diagnostic window can be configured as an upper limit of the duration to reduce the misjudgment rate, or it can be configured to be determined within the upper limit of the duration in combination with the CAN network status so that the window duration is consistent with the CAN network status. The window duration of the second diagnostic window can also use a state assessment model to determine an adjustment factor adapted to the current network status, adjust the window duration of the second diagnostic window, and further improve the rationality of the window duration of the second diagnostic window.
[0113] See also Figure 6 , Figure 6 FIG. 1 is a flow chart of a CAN network communication diagnosis process provided by an exemplary embodiment of the present application. The process includes the following steps.
[0114] Step 601, the application program runs.
[0115] The application is used to perform CAN network communication diagnosis on the target CAN node. The CAN controller performs logic control work when the application is started.
[0116] Step 602: The CAN controller determines whether the running time reaches 3 seconds.
[0117] When the running time reaches 3 seconds, step 603 is executed.
[0118] When the running time is less than 3 seconds, step 601 is executed.
[0119] Step 603: The CAN controller determines whether a CAN node message is received.
[0120] When a CAN node message is received, step 604 is executed.
[0121] If no CAN node message is received, step 605 is executed.
[0122] Step 604, the reception success flag is set to 1, and the node timeout counter is cleared to 0.
[0123] Step 605, delaying the maximum deviation time of the CAN node cycle.
[0124] If no CAN node message is received within the first diagnostic window, the second diagnostic window is opened to extend the diagnostic time. The window duration of the first diagnostic window is the same as the CAN node message cycle. The window duration of the second diagnostic window is determined according to the maximum deviation time allowed by the CAN node message cycle.
[0125] Exemplarily, the maximum deviation time is 3 ms, the CAN controller determines that the window length of the second diagnosis window is 3 ms, and delays the diagnosis time of the message reception condition by 3 ms.
[0126] Step 606: Receive the CAN node message.
[0127] When a CAN node message is received in the second diagnostic window, step 607 is executed.
[0128] When no CAN node message is received in the second diagnostic window, step 608 is executed.
[0129] Step 607, the reception success flag is set to 1, and the node timeout counter is cleared to 0.
[0130] Step 608, the reception success mark position 0, the node timeout counter increases by 1.
[0131] See also Figure 7 , Figure 7 This is a structural block diagram of a CAN network communication diagnostic device provided by an exemplary embodiment of the present application. The device includes the following modules.
[0132] A determination module 701, configured to determine a first diagnostic window based on a target message period of a target CAN node sending a CAN node message;
[0133] An opening module 702 is used to open a second diagnostic window when the CAN node message sent by the target CAN node is not received within the first diagnostic window, and the second diagnostic window is smaller than the first diagnostic window;
[0134] An updating module 703, configured to update the target node timeout information corresponding to the target CAN node based on the reception status of the CAN node message in the second diagnostic window;
[0135] The reporting module 704 is used to report the communication abnormality of the target CAN node when the timeout information of the target node meets the reporting condition.
[0136] Optionally, the updating module 703 is further used to:
[0137] Based on the reception status of the CAN node message in the second diagnostic window, the reception success flag and timeout count value corresponding to the target CAN node are updated, the reception success flag is used to characterize the message reception status, and the timeout count value is used to characterize the number of message timeouts.
[0138] Optionally, the updating module 703 is further used to:
[0139] When the CAN node message is received in the second diagnostic window, the reception success flag corresponding to the target CAN node is set to a first value, and the timeout count value corresponding to the target CAN node is updated;
[0140] When the CAN node message is not received within the second diagnostic window, the reception success flag corresponding to the target CAN node is set to a second value, and the timeout count value corresponding to the target CAN node is updated.
[0141] Optionally, the updating module 703 is further used to:
[0142] Add one to the timeout count value corresponding to the target CAN node;
[0143] When the target CAN node is a high priority node and / or the load rate of the CAN bus is less than a load rate threshold, the timeout count value corresponding to the target CAN node is reduced by one;
[0144] When the target CAN node does not belong to the high priority node and the load rate of the CAN bus is greater than the load rate threshold, the timeout count value corresponding to the target CAN node is set to zero.
[0145] Optionally, the reporting module 704 is further configured to:
[0146] When the timeout count value corresponding to the target CAN node reaches a count threshold, it is determined that the reporting condition is met, and a communication abnormality report is performed on the target CAN node. The count threshold is negatively correlated with the importance of the target CAN node.
[0147] Optionally, the device further includes a configuration module, configured to:
[0148] A window duration of the second diagnostic window is configured, wherein the window duration of the second diagnostic window is related to at least one of the window duration of the first diagnostic window and a CAN network status.
[0149] Optionally, the configuration module is further used to:
[0150] Determining the window length of the second diagnostic window based on the window length of the first diagnostic window and the proportional factor, wherein the window length of the second diagnostic window is the product of the window length of the first diagnostic window and the proportional factor;
[0151] or,
[0152] Based on the window duration of the first diagnostic window and the proportional factor, an upper limit of the window duration of the second diagnostic window is determined, and the upper limit is the product of the window duration of the first diagnostic window and the proportional factor; based on the CAN network status and the upper limit, the window duration of the second diagnostic window is determined, and the window duration of the second diagnostic window is less than or equal to the upper limit.
[0153] Optionally, the determining module 701 is further configured to:
[0154] Get the load rate of the CAN bus and the node timeout information corresponding to each CAN node;
[0155] Input the load rate of the CAN bus and the node timeout information corresponding to each CAN node into a state assessment model to obtain an adjustment factor output by the state assessment model, wherein the state assessment model is trained based on the sample load rate, the sample node timeout information corresponding to the sample CAN node, and the sample adjustment factor, and the sample adjustment factor is determined based on the sample window duration and the upper limit of the sample duration;
[0156] Based on the upper limit of the duration and the adjustment factor, a window duration of the second diagnostic window is determined, and the window duration of the second diagnostic window is the product of the upper limit of the duration and the adjustment factor.
[0157] In summary, in the embodiment of the present application, when the CAN node message sent by the target CAN node is not received within the first diagnostic window, the CAN controller opens the second diagnostic window and continues to wait for receiving the CAN node message, thereby extending the diagnostic time for the CAN node message, thereby avoiding the situation where the actual reception of the message is inconsistent with the reception situation within the diagnostic window due to too short a diagnostic time, causing a false alarm of communication anomaly, which is beneficial to improving the accuracy of the target node timeout information, and thereby improving the accuracy of network communication diagnosis.
[0158] See also Figure 8 , Figure 8 800 includes a CAN bus 801, a CAN node 802, and a CAN controller 803. The CAN node 802 is connected to the CAN controller 803 via the CAN bus 801. The CAN bus 801 is used to implement the CAN network communication diagnostic method provided in each of the above embodiments.
[0159] In an exemplary embodiment, a computer-readable storage medium is further provided. The computer-readable medium stores at least one program code. The at least one program code is loaded and executed by a processor to implement the CAN network communication diagnostic method in the above embodiment.
[0160] In an exemplary embodiment, a computer program product is further provided. The computer program product stores at least one program code. The at least one program code is loaded and executed by a processor to implement the CAN network communication diagnosis method in the above embodiment.
[0161] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0162] The above description is only for the purpose of facilitating those skilled in the art to understand the technical solution of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A CAN network communication diagnostic method, characterized in that: The method comprises: Determining a first diagnostic window based on a target message period of the target CAN node sending the CAN node message; When the CAN node message sent by the target CAN node is not received within the first diagnostic window, a second diagnostic window is opened, wherein the second diagnostic window is smaller than the first diagnostic window; Based on the reception status of the CAN node message in the second diagnostic window, updating the target node timeout information corresponding to the target CAN node; When the target node timeout information meets the reporting condition, a communication abnormality report is performed on the target CAN node.
2. The method according to claim 1, characterized in that The updating of the target node timeout information corresponding to the target CAN node based on the reception status of the CAN node message in the second diagnostic window includes: Based on the reception status of the CAN node message in the second diagnostic window, the reception success flag and timeout count value corresponding to the target CAN node are updated, the reception success flag is used to characterize the message reception status, and the timeout count value is used to characterize the number of message timeouts.
3. The method according to claim 2, characterized in that The updating of the reception success flag bit and the timeout count value corresponding to the target CAN node based on the reception status of the CAN node message in the second diagnostic window includes: When the CAN node message is received in the second diagnostic window, the reception success flag corresponding to the target CAN node is set to a first value, and the timeout count value corresponding to the target CAN node is updated; When the CAN node message is not received within the second diagnostic window, the reception success flag corresponding to the target CAN node is set to a second value, and the timeout count value corresponding to the target CAN node is updated.
4. The method according to claim 3, characterized in that When the CAN node message is not received within the second diagnostic window, updating the timeout count value corresponding to the target CAN node includes: Add one to the timeout count value corresponding to the target CAN node; When the CAN node message is received in the second diagnostic window, updating the timeout count value corresponding to the target CAN node includes: When the target CAN node is a high priority node and / or the load rate of the CAN bus is less than a load rate threshold, the timeout count value corresponding to the target CAN node is reduced by one; When the target CAN node does not belong to the high priority node and the load rate of the CAN bus is greater than the load rate threshold, the timeout count value corresponding to the target CAN node is set to zero.
5. The method according to claim 2, characterized in that: When the target node timeout information meets the reporting condition, reporting the communication abnormality of the target CAN node includes: When the timeout count value corresponding to the target CAN node reaches a count threshold, it is determined that the reporting condition is met, and a communication abnormality report is performed on the target CAN node. The count threshold is negatively correlated with the importance of the target CAN node.
6. The method according to any one of claims 1 to 5, characterized in that: Before opening the second diagnostic window, the method further includes: A window duration of the second diagnostic window is configured, wherein the window duration of the second diagnostic window is related to at least one of the window duration of the first diagnostic window and a CAN network status.
7. The method according to claim 6, characterized in that The configuring the window duration of the second diagnostic window includes: Determining the window length of the second diagnostic window based on the window length of the first diagnostic window and the proportional factor, wherein the window length of the second diagnostic window is the product of the window length of the first diagnostic window and the proportional factor; or, Based on the window duration of the first diagnostic window and the proportional factor, an upper limit of the window duration of the second diagnostic window is determined, and the upper limit is the product of the window duration of the first diagnostic window and the proportional factor; based on the CAN network status and the upper limit, the window duration of the second diagnostic window is determined, and the window duration of the second diagnostic window is less than or equal to the upper limit.
8. The method according to claim 7, characterized in that The determining the window duration of the second diagnostic window based on the CAN network state and the upper limit of the duration includes: Get the load rate of the CAN bus and the node timeout information corresponding to each CAN node; Input the load rate of the CAN bus and the node timeout information corresponding to each CAN node into a state assessment model to obtain an adjustment factor output by the state assessment model, wherein the state assessment model is trained based on the sample load rate, the sample node timeout information corresponding to the sample CAN node, and the sample adjustment factor, and the sample adjustment factor is determined based on the sample window duration and the upper limit of the sample duration; Based on the upper limit of the duration and the adjustment factor, a window duration of the second diagnostic window is determined, and the window duration of the second diagnostic window is the product of the upper limit of the duration and the adjustment factor.
9. A CAN network communication diagnostic device, characterized in that: The device comprises: A determination module, configured to determine a first diagnostic window based on a target message period of a target CAN node sending a CAN node message; An opening module, configured to open a second diagnostic window when the CAN node message sent by the target CAN node is not received within the first diagnostic window, wherein the second diagnostic window is smaller than the first diagnostic window; An updating module, configured to update the target node timeout information corresponding to the target CAN node based on the reception status of the CAN node message in the second diagnostic window; The reporting module is used to report the communication abnormality of the target CAN node when the timeout information of the target node meets the reporting condition.
10. A vehicle, characterized in that: The vehicle includes a CAN bus, a CAN node and a CAN controller, the CAN node is connected to the CAN controller via the CAN bus, and the CAN bus is used to implement the CAN network communication diagnostic method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Periodic CAN (cable area network) message loss fault judging system and method
CN103546306A
Load rate determination method and device and computer readable storage medium
CN115967656A
Abnormal CAN node processing method and device, equipment and medium
CN117792815A
Method for determining reverse connection of CAN (Controller Area Network) bus and CAN bus system
CN118118378A
Vehicle diagnosis routing method, device and system, vehicle and storage medium
CN118200400A
Cited By
Internet of vehicles CAN communication abnormity monitoring method, device and equipment and storage medium
CN121077884A
