ECU error state detection method and system
By sending data frames on the CAN bus and combining CANoe equipment and oscilloscope monitoring, the error status detection of the ECU is realized, and the ECU function abnormality caused by the CAN bus error frame is solved, ensuring the normal operation of the ECU and network stability.
Patent Information
- Application Number
- CN202411202108.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2024-11-05
AI Technical Summary
During normal operation of the CAN bus, the CAN controller hardware failure, electrical specifications are not in compliance, electromagnetic interference, communication protocol errors, network load excessive and software problems, etc., cause the CAN bus to experience error frames, which in turn causes the ECU to adjust the internal error status, resulting in Functional abnormality, and it is necessary to detect the internal error status of the ECU to ensure its normal operation.
By determining the error state detection instruction, the data frame is sent to the CAN bus connected to the ECU, and based on the error state detection strategy corresponding to the number of data frames, the ECU is detected in error state, including detection of active error, passive error and bus shutdown state. The CANoe device and oscilloscope monitor waveforms, combining power-off restart operation and fault code reading to achieve accurate detection of ECU error status.
It can effectively identify the error status of the ECU, quickly locate faulty nodes or line segments, reduce troubleshooting time, ensure network stability and data integrity, and ensure normal operation of the ECU.
Smart Images

Figure CN118897537A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of state recognition, and more specifically, to an ECU (electronic Control Unit, electronic controller) error state detection method and related devices. Background Art
[0002] During normal operation of the CAN (Controller Area Network) bus, CAN controller hardware failure, electrical specification non-compliance, electromagnetic interference, communication protocol errors, network overload and software problems can cause error frames on the CAN bus, and the ECU connected to the CAN bus will adjust its internal error state accordingly.
[0003] In order to ensure the normal use of ECU functions, it is necessary to detect the error state inside the ECU to determine whether the ECU is operating normally. How to implement the error state detection inside the ECU is a technical problem that those skilled in the art need to solve urgently. Summary of the invention
[0004] In view of this, the present invention provides an ECU error state detection method and system to solve the problem of urgently needing to realize error state detection inside the ECU.
[0005] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0006] An ECU error state detection method, comprising:
[0007] determining an error state detection instruction, wherein the error state detection instruction includes a number of data frames;
[0008] Sending data frames matching the number of data frames to a controller area network bus (CAN) connected to an electronic controller ECU; the data frames include error frames;
[0009] Based on the error state detection strategy corresponding to the number of data frames, an error state detection operation is performed on the ECU to obtain an ECU error state detection result.
[0010] Optionally, determining an error state detection instruction includes:
[0011] If the error state detection instruction is used to detect whether the ECU is in an active error state, determining an error state detection instruction including a first number of data frames, the first number of data frames being less than an active error threshold;
[0012] If the error state detection instruction is used to detect whether the ECU is in a passive error state, determining an error state detection instruction including a second number of data frames, the second number of data frames being greater than a passive error threshold;
[0013] If the error state detection instruction is used to detect whether the ECU is in a bus-off state, an error state detection instruction including a third number of data frames is determined, and the third number of data frames is greater than a bus-off threshold.
[0014] Optionally, if the error state detection instruction is used to detect whether the ECU is in an active error state, an error state detection operation is performed on the ECU based on the error state detection strategy corresponding to the number of data frames to obtain an ECU error state detection result, including:
[0015] generating a first diagnostic instruction, and sending the first diagnostic instruction to the ECU;
[0016] If the feedback message corresponding to the first diagnostic instruction sent by the ECU can be received normally, it is determined that the ECU error state detection result is a first identifier; the first identifier is an identifier indicating normality.
[0017] Optionally, if the error state detection instruction is used to detect whether the ECU is in a passive error state; based on the error state detection strategy corresponding to the number of data frames, an error state detection operation is performed on the ECU to obtain an ECU error state detection result, including:
[0018] generating a second diagnostic instruction, and sending the second diagnostic instruction to the ECU;
[0019] Performing a power-off restart operation on the ECU;
[0020] Reading a first historical fault code of the ECU;
[0021] If the first historical fault code is a passive error fault code, the ECU error state detection result is determined to be a first identifier.
[0022] Optionally, if the error state detection instruction is used to detect whether the ECU is in a bus-off state; sending data frames matching the number of data frames to a CAN bus connected to the ECU includes:
[0023] After short-circuiting a high-level data line and a low-level data line in a CAN bus to which the ECU is connected, simulating data frames matching the number of data frames;
[0024] The data frame is sent to the CAN bus.
[0025] Optionally, based on the error state detection strategy corresponding to the number of data frames, performing an error state detection operation on the ECU to obtain an ECU error state detection result includes:
[0026] After clearing the short-circuit operation between the high-level data line and the low-level data line in the CAN bus, reading a second historical fault code of the ECU;
[0027] If the second historical fault code is a bus-off fault code, the ECU error state detection result is determined to be a first identifier.
[0028] Optionally, when the error state of the ECU is bus off, the method further includes:
[0029] Stop sending data frames to the ECU to continuously detect the original waveform on the CAN bus to obtain the signal quality and signal amplitude of the original waveform;
[0030] If the signal quality corresponding to the original waveform meets the quality requirement, and it is determined based on the signal amplitude that the original waveform includes a preset number of recessive bits, sending a third diagnostic instruction to the ECU;
[0031] If the feedback message corresponding to the third diagnostic instruction fed back by the ECU can be received normally, it is determined that the ECU error state detection result is the first identification.
[0032] An ECU error state detection system includes: a test host and a CANoe device;
[0033] The test host is connected to the CANoe device for communication; the CANoe device is connected to the ECU via a CAN bus;
[0034] The test host is used to determine an error status detection instruction and send the error status detection instruction to the CANoe device, wherein the error status detection instruction includes the number of data frames to control the CANoe device to send data frames matching the number of data frames to the CAN bus connected to the ECU; based on the error status detection strategy corresponding to the number of data frames, an error status detection operation is performed on the ECU to obtain an ECU error status detection result; the data frame includes an error frame.
[0035] Optionally, the ECU error state detection system further includes:
[0036] Oscilloscope; the oscilloscope is connected to the CAN bus and the test host respectively;
[0037] The oscilloscope is used to continuously detect the original waveform on the CAN bus to obtain the signal quality and signal amplitude of the original waveform.
[0038] Optionally, the ECU error state detection system further includes:
[0039] A programmable power supply for supplying power to the ECU, wherein the programmable power supply is connected to the test host;
[0040] The test host is also used to implement a power-off restart operation of the ECU through the programmable power supply.
[0041] Compared with the prior art, the present invention has the following beneficial effects:
[0042] The present invention provides an ECU error state detection method and system. In the present invention, an error state detection instruction including the number of data frames is determined, and data frames matching the number of data frames are sent to a CAN bus connected to the ECU, so as to perform an error state detection operation on the ECU based on an error state detection strategy corresponding to the number of data frames, and obtain an ECU error state detection result. Then, by analyzing the ECU error state detection result, it can be determined whether the ECU is operating normally. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0044] Figure 1 A schematic diagram of the structure of a test system provided by an embodiment of the present invention;
[0045] Figure 2 A flow chart of an ECU error state detection method provided by an embodiment of the present invention;
[0046] Figure 3 A switching diagram of an ECU error state provided by an embodiment of the present invention;
[0047] Figure 4 A flowchart of a method for determining an ECU error state detection result provided by an embodiment of the present invention;
[0048] Figure 5 A flowchart of another method for determining an ECU error state detection result provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0050] In order to enable those skilled in the art to more clearly understand the present invention, the professional terms in the present invention are now explained.
[0051] TEC (Tx Error Counter) transmit error counter;
[0052] REC (Rx Error Counter): receive error counter;
[0053] BUSOFF: refers to the bus off state, which is an error state.
[0054] During the normal operation of the CAN bus, CAN controller hardware failure, electrical specification non-compliance, electromagnetic interference, communication protocol errors, network overload and software problems can cause error frames on the CAN bus, affecting vehicle functions and preventing normal use.
[0055] When an error frame appears on the CAN bus, the ECU connected to the CAN bus adjusts the internal error state accordingly. In order to ensure the normal use of the ECU function, it is necessary to detect the error state inside the ECU to determine whether the ECU is operating normally, so as to facilitate troubleshooting the cause of the problem. Specifically, bus error state detection is a key part of ensuring network stability and data integrity. It mainly helps to identify faulty nodes or line segments, allowing maintenance personnel to quickly locate the problem and reduce troubleshooting time.
[0056] So how to realize the error state detection inside the ECU is a technical problem that technical personnel in this field need to solve urgently.
[0057] In order to realize the error status detection inside the ECU, a test system is built in this embodiment. By controlling a certain number of data frames to be sent to the CAN bus connected to the ECU, it is possible to detect whether the sending error counter and receiving error counter inside the ECU are counting normally, thereby analyzing whether the ECU has a normal or abnormal error state.
[0058] Based on the above content, an embodiment of the present invention provides an ECU error state detection method, and the execution subject of the ECU error state detection method is a test system.
[0059] Test system structure reference Figure 1, including the test host (Tester) and CANoe equipment.
[0060] The test host mainly implements the test control process. Based on the control of the test host, the CANoe device realizes the sending of data frames, communication with the ECU, monitoring of communication messages on the CAN bus, and real-time monitoring of the network status, including the status of the node (such as active error or passive error), bus utilization, etc.
[0061] In actual applications, the test host and the CANoe device can be connected via a USB (Universal Serial Bus) line. The CANoe device is connected to the ECU via a CAN bus, which includes a high-level data line (CAN_H) and a low-level data line (CAN_L). If CAN_H and CAN_L are short-circuited, the CAN bus cannot perform data transmission operations.
[0062] In another implementation of the present invention, in order to detect whether the ECU jumps from the bus-off state to the active error state, it is necessary to monitor the waveform changes on the CAN bus. In this embodiment, an oscilloscope can be used to perform waveform monitoring operations, and the oscilloscope can be a PicoScope oscilloscope.
[0063] The oscilloscope is connected to the test host via a USB cable and is controlled by the test host to continuously collect the original waveform on the CAN bus and analyze the signal quality and signal amplitude of the original waveform. The test host can perform ECU error status detection operations based on the signal quality and signal amplitude.
[0064] Furthermore, in this embodiment, a programmable power supply is used to power the ECU. The programmable power supply is used in this embodiment because the power supply can be connected to the test host and then controlled by the test host to achieve power on and off operations, thereby achieving power-off and restart operations of the ECU.
[0065] The programmable power supply can be connected to the ECU through the KL30, 35 and GND power lines.
[0066] Based on the structure of the above test system, refer to Figure 2 , an ECU error state detection method may include:
[0067] S11. Determine an error status detection instruction.
[0068] Wherein, the error state detection instruction includes the number of data frames.
[0069] In practical applications, refer to Figure 3 , ECU error status mainly includes three states:
[0070] 1) Active error state, can receive and send, use active error flag;
[0071] 2) Passive error state, only receiving but not sending, using passive error flag;
[0072] 3) Bus off state, not participating in any bus activities.
[0073] The ECU is internally configured with TEC and REC. If the ECU sends an error frame, TEC increases by one. If the ECU receives an error frame, REC increases by one.
[0074] If 0<REC≤127, and 0<TEC≤127, the ECU is in active error state and can receive and send data frames. When REC>127 or TEC>127, the ECU will jump from active error to passive error. In this error state, the ECU can only receive data frames but cannot send data frames.
[0075] In the passive error state, if the TEC inside the ECU is greater than 255, the ECU will jump from the passive error state to the bus-off state.
[0076] In the bus-off state, the ECU can neither receive nor send data frames. At the same time, in the state, if a user request or 128 consecutive 11 recessive bits appear on the CAN bus, the ECU can switch from the bus-off state to the active error state.
[0077] In this embodiment, since the ECU error state is caused by the error state switching due to the internal REC and TEC counts, the ECU error state detection mainly detects whether the internal REC and TEC counts are correct.
[0078] Therefore, the above-mentioned CANoe device is used to simulate different numbers of error frames and send them to the CAN bus. Based on the received error frames, the ECU performs the REC counting operation to achieve the error state switching. Subsequently, it can detect whether the ECU state is the specified state to determine whether the REC count inside the ECU is correct. In addition, for the TEC inside the ECU, the CAN_H and CAN_L in the CAN bus can be short-circuited to achieve the accumulation of TEC, so that after the accumulation reaches 255, the ECU switches from the passive state to the bus off state.
[0079] In addition, it is also possible to determine whether the ECU can switch from the bus-off state to the active error state based on 128 times of 11 consecutive recessive bits when the CAN bus is idle.
[0080] That is, the present invention can realize the switching detection from active error to passive error, the switching detection from passive error to bus off, and the switching detection from bus off to active error.
[0081] It should be noted that in order to enable the CANoe device to simulate a certain number of error frames, the CANoe device is also configured with TEC and REC to implement the error frame counting function.
[0082] Since the switching detection is the switching between two error states, but in actual applications, at the same time, the error state of the ECU can only be one of the states, in this embodiment, whether the ECU switches normally is determined by detecting whether the ECU is in a certain state.
[0083] In this embodiment, the error state detection instruction can be used to detect whether the ECU is in an active error state, to detect whether the ECU is in a passive error state, or to detect whether the ECU is in a bus-off state.
[0084] When the ECU error state is different, the triggering conditions that trigger the ECU to enter the error state are different. For example, when the CANoe device cumulatively sends less than 127 error frames to the CAN bus, the ECU is in the active error state. When the CANoe device cumulatively sends more than 127 error frames to the CAN bus, the ECU is in the passive error state. If CAN_H and CAN_L are short-circuited and more than 255 data frames are sent to the CAN bus, the ECU is in the bus-off state.
[0085] It should be noted that the accumulation operation in this embodiment refers to uninterrupted transmission, but it is allowed to send other data frames in the middle of sending the error frame as long as there is no idle time on the CAN bus.
[0086] For example, if 127 error frames are sent first, the TEC inside the ECU will accumulate to 127, and then a diagnostic instruction is sent, and then an error frame is sent, and the TEC inside the ECU will accumulate to 128. If there is idle time in the middle, TEC and REC will be cleared and counted again.
[0087] In this embodiment, determining the error state detection instruction includes:
[0088] If the error state detection instruction is used to detect whether the ECU is in an active error state, an error state detection instruction including a first data frame quantity is determined, and the first data frame quantity is less than an active error threshold 128.
[0089] If the error state detection instruction is used to detect whether the ECU is in a passive error state, an error state detection instruction including a second data frame quantity is determined, and the second data frame quantity is greater than a passive error threshold 127 .
[0090] If the error state detection instruction is used to detect whether the ECU is in a bus-off state, an error state detection instruction including a third data frame number is determined, and the third data frame number is greater than a bus-off threshold value of 255.
[0091] In actual applications, the user may operate on the test host to configure the purpose of the error state detection instruction, and configure the first data frame number, the second data frame number, and the third data frame number.
[0092] In addition, the test level may be pre-configured on the test host. When the test host is in use, the first data frame number, the second data frame number and the third data frame number are sequentially configured to achieve detection of different error states.
[0093] The subsequent test host will send the error status detection instruction to the CANoe device to perform simulation generation operations of error frames or normal data frames.
[0094] S12, sending data frames matching the number of data frames to the CAN bus connected to the ECU.
[0095] When detecting whether the ECU error state is an active error or a passive error, the data frame is an error frame; when detecting whether the ECU error state is a bus shutdown, the data frame can be an error frame or a normal data frame.
[0096] When detecting active errors, real-time monitoring is started in CANoe. A certain number of error frames are simulated through the CAPL (Communication Access Programming Language, a script programming language based on CANOE) program and sent to the CAN bus. The number of TEC or REC inside the ECU changes. Subsequently, the CANoe device sends a diagnostic message to the ECU. By observing whether the ECU can respond, the error state of the ECU can be determined.
[0097] For example, in order to detect the active error state of the ECU, the CAPL level is simulated to be <128, that is, ≤127 error frames, which are sent to the CAN bus.
[0098] In order to detect the passive error state of the ECU, >127 error frames are simulated by CAPL and sent to the CAN bus.
[0099] In order to detect the bus-off state of the ECU, it is necessary to manually short-circuit the high-level data line CAN_H and the low-level data line CAN_L in the CAN bus to which the ECU is connected, and then use the CAPL degree simulation to simulate >255 data frames and send them to the CAN bus. At this time, due to the short circuit, the data frame cannot be sent out and will be sent repeatedly. The TEC inside the CANoe will quickly accumulate to 255.
[0100] Since CAN_H and CAN_L are short-circuited, the data frame cannot be sent out. At this time, you can also simulate only one data frame and send it to the CAN bus. At this time, since it is short-circuited, the data frame cannot be sent out and will be sent repeatedly. The TEC inside CANoe will quickly accumulate to 255.
[0101] S13. Based on the error state detection strategy corresponding to the number of data frames, perform an error state detection operation on the ECU to obtain an ECU error state detection result.
[0102] In this embodiment, different error state detection instructions correspond to different error state detection strategies. For example:
[0103] If the error state detection instruction is used to detect whether the ECU is in an active error state, at this time the number of the first data frames is less than 128. Since the ECU can send and receive in the active error state, the first diagnostic instruction can be sent to the ECU to determine whether feedback from the ECU can be received. If so, it means that the ECU is in the active error state, and the TEC count inside the ECU is correct.
[0104] If the error status detection instruction is used to detect whether the ECU is in an active error state (the number of the first data frames is greater than 127 at this time) or a bus-off state (the number of the first data frames is greater than 255 at this time), the ECU cannot send messages regardless of whether it is in a passive error state or a bus-off state. Therefore, the state of the ECU can be determined by reading the ECU's fault code DTC (Diagnostic Trouble Code) to detect whether the ECU's error state is correct.
[0105] In this embodiment, an error state detection instruction including the number of data frames is determined, and data frames matching the number of data frames are sent to the CAN bus connected to the ECU, so as to perform an error state detection operation on the ECU based on the error state detection strategy corresponding to the number of data frames, and obtain an ECU error state detection result, and then determine whether the ECU is operating normally by analyzing the ECU error state detection result.
[0106] In another implementation of the present invention, if the error state detection instruction is used to detect whether the ECU is in an active error state, refer to Figure 4 , step S13 may include:
[0107] S21. Generate a first diagnostic instruction, and send the first diagnostic instruction to the ECU.
[0108] In this embodiment, the first diagnostic instruction may be generated by a test host, and the first diagnostic instruction may be, for example, 1001.
[0109] After the test host generates the first diagnostic instruction, it sends the first diagnostic instruction to the CANoe device through the USB line, and the CANoe device sends the first diagnostic instruction to the ECU through the CAN bus.
[0110] S22: If the feedback message corresponding to the first diagnostic instruction sent by the ECU can be received normally, it is determined that the ECU error state detection result is a first identifier.
[0111] In order to verify whether the ECU is in the active error state, the CANoe device cumulatively sends error frames below 127 to the CAN bus. Theoretically, the ECU should receive error frames below 127, and the REC count inside the ECU should be below 127. The ECU should be in the active error state. Since the ECU can send and receive in this state, the first diagnostic instruction can be sent to the ECU. The ECU should be able to receive the instruction and feedback the message corresponding to the instruction. If the feedback message corresponding to the first diagnostic instruction sent by the ECU (such as 50011) can be received normally, it means that the current ECU is in the active error state, which is the same as the test purpose. Then, the ECU error state detection result is determined to be the first identifier, and the first identifier is the normal identifier. In practical applications, if 1 is used to represent normal and 0 is used to represent abnormal, the ECU error state detection result is 1.
[0112] In addition, if the feedback message corresponding to the first diagnostic instruction sent by the ECU cannot be received normally, it is determined that the ECU error state detection result is 0.
[0113] It should be noted that after receiving the first diagnostic instruction, the ECU will send a feedback message to the CAN bus, and the CANoe device will forward the feedback message to the test host so that the test host can perform subsequent diagnostic operations.
[0114] In this embodiment, the ECU is capable of sending and receiving in the active error state, and a first diagnostic instruction is sent to it. By judging whether a corresponding feedback message can be received, it is determined whether the ECU is in the active error state, thereby realizing the detection of the ECU error state.
[0115] In another implementation of the present invention, if the error state detection instruction is used to detect whether the ECU is in a passive error state; Figure 5 , step S13 may include:
[0116] S31. Generate a second diagnostic instruction, and send the second diagnostic instruction to the ECU.
[0117] In this embodiment, since it is necessary to test whether the ECU is in a passive error state, in which the ECU can receive but not send, after sending a diagnostic instruction to the ECU, the ECU cannot feed back a message to determine whether it is in a passive error state.
[0118] Therefore, in this embodiment, the fault code of the ECU can be read to determine the error state of the ECU.
[0119] Specifically, after sending more than 127 error frames to the ECU, theoretically the ECU should receive more than 127 error frames, at which time the REC count should be greater than 127, and the ECU should switch to the passive error state.
[0120] At this time, after the test host generates the second diagnostic instruction, it sends the second diagnostic instruction to the CANoe device via the USB cable, and the CANoe device sends the second diagnostic instruction to the ECU via the CAN bus. In theory, the CANoe device cannot receive the feedback message sent by the ECU. If the feedback message sent by the ECU is received, it means that the ECU is in an active error state at this time, which does not match the passive error state to be tested, and the ECU error state detection result is determined to be 0.
[0121] S32, performing a power-off and restart operation on the ECU.
[0122] After the ECU receives the diagnostic command, because the internal REC has counted to more than 127, the ECU has switched to the passive error state and cannot send a feedback message at this time.
[0123] At this time, if the feedback message sent by the ECU cannot be obtained through the CAN bus communication method, the ECU power-on restart operation can be controlled to restore the ECU to normal.
[0124] To elaborate, the test host can control the programmable power supply to stop supplying power to the ECU, so that the ECU is powered off, and then the test host can control the programmable power supply to continue supplying power to the ECU, so that the ECU is powered on. At this time, the ECU returns to normal and the ECU resumes communication.
[0125] S33, reading a first historical fault code of the ECU.
[0126] In this embodiment, the 19 service can be used to read the historical DTC, that is, the first historical fault code, to see whether the ECU reports the DTC corresponding to the passive error state.
[0127] S34: If the first historical fault code is a passive error fault code, determine that the ECU error state detection result is a first identifier.
[0128] If the first historical fault code inside the ECU is a passive error fault code, it means that the ECU is in a passive error state at this time, which is the same as the detection purpose, and the ECU error state detection result is determined to be the first identification, such as 1 above.
[0129] In this embodiment, if the second diagnostic instruction is sent to the ECU, the feedback message sent by the ECU cannot be received normally, and the fault code inside the ECU is a passive error fault code, it is determined that the ECU is in a passive error state, and the detection of the ECU passive error state is realized.
[0130] In another implementation of the present invention, if the error state detection instruction is used to detect whether the ECU is in a bus-off state, step S13 may specifically include:
[0131] After clearing the short-circuit operation of the high-level data line and the low-level data line in the CAN bus, the second historical fault code of the ECU is read; if the second historical fault code is a bus-off fault code, the ECU error state detection result is determined to be the first identification.
[0132] Specifically, when the ECU is in the bus-off state, the ECU cannot receive or send signals. At this time, it is impossible to determine that the ECU is in the bus-off state in which it cannot receive or send signals by sending a diagnostic instruction to the ECU.
[0133] At this time, the bus-off state can be identified through the fault code inside the ECU.
[0134] When the CANoe device sends a data frame to the bus, the data frame cannot be sent out because the bus is short-circuited. CANoe will repeatedly send the data frame, and the TEC inside CANoe will continue to accumulate, and it can accumulate to more than 255 in a short time. When the ECU is actually running, it will also send some messages, such as fault detection messages sent by the ECU, such as messages for detecting coolant temperature. Since the message cannot be sent out normally and is sent repeatedly, the TEC inside the ECU will continue to accumulate until it is more than 255. Therefore, after the TEC inside CANoe accumulates to more than 255, you can wait for a few seconds to ensure that the TEC inside the ECU also accumulates to 255 or more. At this time, you can manually clear the short-circuit operation of the high-level data line and the low-level data line in the CAN bus, and then read the second historical fault code of the ECU. If the second historical fault code is a bus-off fault code, it is determined that the ECU error state detection result is the first identification. The specific implementation process is similar to the above-mentioned passive error fault code.
[0135] In this embodiment, by reading the fault code, it is possible to accurately detect whether the ECU is in the bus-off state, thereby realizing the detection of the ECU bus-off state.
[0136] In another implementation of the present invention, when the error state of the ECU is in the bus-off state, the ECU can also switch from this state to the active error state, and at this time it can be detected whether the ECU has successfully switched to the active error state.
[0137] Due to the user request or 128 times of 11 consecutive recessive bits on the CAN bus, the ECU can switch from the bus off state to the active error state. When the CANoe device does not send data frames, recessive bits can appear on the CAN bus.
[0138] Therefore, the CANoe device is controlled not to send data frames, that is, stops sending data frames to the ECU, and an oscilloscope is used to continuously detect the original waveform on the CAN bus to obtain the signal quality and signal amplitude of the original waveform.
[0139] Among them, the signal quality can be such as slope, noise level and signal distortion. If the signal quality is high, it means that the original waveform of this test is highly reliable and can be used. If the signal quality is low, it means that the original waveform of this test is unreliable and cannot be used. The original waveform is directly abandoned and the subsequent waveforms are collected.
[0140] If the signal quality is high, it means that the signal quality corresponding to the original waveform detected this time meets the quality requirements. The signal amplitude of the original waveform is analyzed to determine whether 128 consecutive recessive bits appear in the original waveform. If so, the error state inside the ECU will switch to an active error state. In this state, the ECU can send and receive. At this time, the third diagnostic instruction is sent to the ECU. If the feedback message corresponding to the third diagnostic instruction fed back by the ECU can be received normally, it means that the error state of the ECU is both receivable and sendable and is in an active error state, which is the same as the detection purpose. At this time, the ECU error state detection result is determined to be the first identifier, such as 1.
[0141] In this embodiment, when the error state of the ECU is bus off, it is possible to detect whether the ECU can normally switch to the active error state, thereby realizing the switching detection from bus off to active error.
[0142] It should be noted that in order to detect reliability, a diagnostic instruction can be sent to the ECU before stopping sending data frames to the ECU to determine whether the ECU is in a state where it cannot send or receive. If the ECU does not send a feedback message, it can be said that the ECU cannot send, but whether it is specifically unreceivable or not is still determined through fault code detection, ultimately achieving reliable detection of the bus-off state.
[0143] In order to enable those skilled in the art to more clearly understand the present invention, the overall implementation of the present invention is now described by way of example.
[0144] 1) Configure CANoe and PicoScope oscilloscope: Set up the project, select the appropriate CAN interface, configure the network, including bus type, baud rate and other parameters; start the PicoScope software, set the sampling rate and time base, enable the serial decoding function, and select the CAN protocol.
[0145] 2. Start monitoring and simulate error frames: Start real-time monitoring in CANoe, simulate the number of error frames through the CAPL program, and observe the changes in ECU's REC. When REC≤127, send a diagnostic command, the ECU can respond normally, and its own message is sent normally; when REC>127, send a diagnostic command, the ECU can receive information, but it cannot send any messages. After the message restores communication, use the 19 service to read the historical DTC to see if the DTC corresponding to the passive error state is reported; when CAN_H shorts CAN_L, observe that the ECU's TEC>255 and then send a diagnostic request. The ECU has no response and cannot send its own message. After the bus is restored, use the 19 service to read the historical DTC to see if the DTC corresponding to the bus shutdown is reported.
[0146] Subsequently, CANoe can be controlled not to send data frames, and the waveform can be detected using an oscilloscope to implement switching detection from bus off to active error.
[0147] This embodiment uses CANoe simulation error frames and PicoScope oscilloscope to capture waveform changes at the physical layer, which can more accurately identify the error state of the ECU and solve the problem that testers cannot directly capture changes in error counters and error states. The application of this system can analyze error patterns, automatically diagnose fault causes, and simplify the debugging process.
[0148] Based on the above-mentioned embodiment of the ECU error state detection method, another embodiment of the present invention provides an ECU error state detection system, including: a test host and a CANoe device;
[0149] The test host is connected to the CANoe device for communication; the CANoe device is connected to the ECU via a CAN bus;
[0150] The test host is used to determine an error state detection instruction, and send the error state detection instruction to the CANoe device to control the CANoe device to send data frames matching the number of data frames to the CAN bus connected to the ECU; based on the error state detection strategy corresponding to the number of data frames, perform an error state detection operation on the ECU to obtain an ECU error state detection result; the error state detection instruction includes the number of data frames;
[0151] Furthermore, the ECU error state detection system further includes:
[0152] Oscilloscope; the oscilloscope is connected to the CAN bus and the test host respectively;
[0153] The oscilloscope is used to continuously detect the original waveform on the CAN bus to obtain the signal quality and signal amplitude of the original waveform.
[0154] Furthermore, the ECU error state detection system further includes:
[0155] A programmable power supply for supplying power to the ECU, wherein the programmable power supply is connected to the test host;
[0156] The test host is also used to implement a power-off restart operation of the ECU through the programmable power supply.
[0157] It should be noted that for the specific implementation of each device in this embodiment, please refer to the above corresponding description.
[0158] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any ECU error state detection method provided in the embodiment of the present application.
[0159] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any ECU error state detection method provided in the embodiment of the present application.
[0160] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for detecting an ECU error state, It is characterized in that include: determining an error state detection instruction, wherein the error state detection instruction includes a number of data frames; Sending data frames matching the number of data frames to a controller area network bus (CAN) connected to an electronic controller ECU; the data frames include error frames; Based on the error state detection strategy corresponding to the number of data frames, an error state detection operation is performed on the ECU to obtain an ECU error state detection result.
2. The ECU error state detection method according to claim 1, It is characterized in that Determine the error status detection instructions, including: If the error state detection instruction is used to detect whether the ECU is in an active error state, determining an error state detection instruction including a first number of data frames, the first number of data frames being less than an active error threshold; If the error state detection instruction is used to detect whether the ECU is in a passive error state, determining an error state detection instruction including a second number of data frames, the second number of data frames being greater than a passive error threshold; If the error state detection instruction is used to detect whether the ECU is in a bus-off state, an error state detection instruction including a third number of data frames is determined, and the third number of data frames is greater than a bus-off threshold.
3. The ECU error state detection method according to claim 2, It is characterized in that If the error state detection instruction is used to detect whether the ECU is in an active error state, an error state detection operation is performed on the ECU based on the error state detection strategy corresponding to the number of data frames to obtain an ECU error state detection result, including: generating a first diagnostic instruction, and sending the first diagnostic instruction to the ECU; If the feedback message corresponding to the first diagnostic instruction sent by the ECU can be received normally, it is determined that the ECU error state detection result is a first identifier; the first identifier is an identifier indicating normality.
4. The ECU error state detection method according to claim 2, It is characterized in that If the error state detection instruction is used to detect whether the ECU is in a passive error state; Based on the error state detection strategy corresponding to the number of data frames, an error state detection operation is performed on the ECU to obtain an ECU error state detection result, including: generating a second diagnostic instruction, and sending the second diagnostic instruction to the ECU; Performing a power-off restart operation on the ECU; Reading a first historical fault code of the ECU; If the first historical fault code is a passive error fault code, the ECU error state detection result is determined to be a first identifier.
5. The ECU error state detection method according to claim 2, It is characterized in that If the error state detection instruction is used to detect whether the ECU is in a bus-off state; sending a data frame matching the number of data frames to a CAN bus connected to the ECU, including: After short-circuiting a high-level data line and a low-level data line in a CAN bus to which the ECU is connected, simulating data frames matching the number of data frames; The data frame is sent to the CAN bus.
6. The ECU error state detection method according to claim 5, It is characterized in that Based on the error state detection strategy corresponding to the number of data frames, an error state detection operation is performed on the ECU to obtain an ECU error state detection result, including: After clearing the short-circuit operation between the high-level data line and the low-level data line in the CAN bus, reading a second historical fault code of the ECU; If the second historical fault code is a bus-off fault code, the ECU error state detection result is determined to be a first identifier.
7. The ECU error state detection method according to claim 6, It is characterized in that In case the ECU error state is bus off, it also includes: Stop sending data frames to the ECU to continuously detect the original waveform on the CAN bus to obtain the signal quality and signal amplitude of the original waveform; If the signal quality corresponding to the original waveform meets the quality requirement, and it is determined based on the signal amplitude that the original waveform includes a preset number of recessive bits, sending a third diagnostic instruction to the ECU; If the feedback message corresponding to the third diagnostic instruction fed back by the ECU can be received normally, it is determined that the ECU error state detection result is the first identification.
8. An ECU error state detection system, It is characterized in that include: Test host and CANoe equipment; The test host is communicatively connected with the CANoe device; The CANoe device is connected to the ECU via a CAN bus; The test host is used to determine an error state detection instruction, and send the error state detection instruction to the CANoe device, wherein the error state detection instruction includes a data frame quantity, so as to control the CANoe device to send data frames matching the data frame quantity to a CAN bus connected to the ECU; Based on the error state detection strategy corresponding to the number of data frames, an error state detection operation is performed on the ECU to obtain an ECU error state detection result; the data frame includes an error frame.
9. The ECU error state detection system according to claim 8, It is characterized in that The ECU error state detection system also includes: Oscilloscope; the oscilloscope is connected to the CAN bus and the test host respectively; The oscilloscope is used to continuously detect the original waveform on the CAN bus to obtain the signal quality and signal amplitude of the original waveform.
10. The ECU error state detection system according to claim 8, It is characterized in that The ECU error state detection system also includes: A programmable power supply for supplying power to the ECU, wherein the programmable power supply is connected to the test host; The test host is also used to implement a power-off restart operation of the ECU through the programmable power supply.
Citation Information
Patent Citations
Bus test system and method
CN107491055A
Bus_Off fault testing system and testing method
CN107959599A
CAN bus controller test method based on RX and TX
CN111104272A
CAN Bus off fast and slow recovery time test method and device, equipment and storage medium
CN111130935A
Attributing bus disconnect attack based on error frame
CN111147437A
