Full-data-field CAN bus inspection method
By using a pseudo-random code generation module and frame interval detection on the CAN bus, the problem of low data field inspection efficiency in the existing technology is solved, and fast and comprehensive data field and anomaly detection is achieved.
Patent Information
- Application Number
- CN202510665995.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-22
- Publication Date
- 2025-09-12
AI Technical Summary
The data domain verification method of existing CAN testers is inefficient, making it difficult to verify large data domains in a short period of time and unable to effectively detect abnormal conditions of CAN bus nodes.
A pseudo-random code generation module is used to generate a pseudo-random signal to fill the lowest bit of the CAN data frame. Combined with the frame length and local data field verification, the frame interval is controlled by software to be 1us for detection, and the bus status is monitored in real time to trigger the error setting to detect anomalies.
It realizes comprehensive detection of the CAN bus data domain, improves detection efficiency, can complete large data domain verification in a short time, and detect communication anomalies in time.
Smart Images

Figure CN120639653A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a full data domain CAN bus inspection method. Background Art
[0002] The data field of common CAN testers is very limited, simply fixing the frame length and accumulating the data field. Although this method can set the number of check frames and verify correctness, if you want to check larger data, you still have to start accumulating from the low bits, making it difficult to quickly reach the high bits. For example, if you check an 8-byte data field, which is equivalent to accumulating a 64-bit value, and the initial value is set to hexadecimal 0x0100000000000000, if you choose to send check frames at 1ms intervals, it will take 0x01000000000000000 frames to reach 0x02000000000000000, or 72057594037927935ms, which would take 2284931 years, which is impossible to achieve.
[0003] In addition, CAN bus nodes generally enter idle processing after an abnormality occurs, and the transmission frame interval is unpredictable. These situations require additional testing.
[0004] In summary, full data domain CAN bus inspection has become an urgent problem to be solved in the CAN bus transmission link. Summary of the Invention
[0005] The present invention aims to provide a full data domain CAN bus inspection method, aiming to make the CAN bus inspection data more comprehensive.
[0006] To achieve the above object, the present invention provides a full data domain CAN bus inspection method, comprising the following steps:
[0007] The transmitting end sends a detection CAN data frame, and the receiving end receives the CAN data frame and sequentially performs full data field detection, communication anomaly detection and data frame interval detection, wherein the full data field detection includes a pseudo-random check of the frame length and frame data and a local data frame check;
[0008] The pseudo-random check of the frame length and frame data includes:
[0009] The transmitting end generates a pseudo-random signal using a pseudo-random code generating module, fills the pseudo-random signal into the lowest bit of the lowest byte in the frame data, and adds other contents of the CAN data frame to generate a full data field CAN data check frame;
[0010] After receiving the verification data frame, the receiving end extracts the frame length, extracts data based on the frame length, performs a pseudo-random code check on the lowest bit of the frame, and triggers an error setting when the pseudo-random code check fails;
[0011] The local data frame check includes:
[0012] The transmitting end presets the CAN data frame length, selects the bytes to be checked in the CAN data frame, and sends the accumulated check bytes;
[0013] The receiving end extracts the check bytes from the received data frame and compares the check bytes of the previous and next frames. If the difference is 1, the check is passed. When the cumulative check fails, an error is triggered.
[0014] The random signal width is 1 bit.
[0015] The data frame interval detection controls the sending interval of the CAN data frame through software, and the sending interval step is 1us.
[0016] The communication anomaly detection detects the status of the CAN bus in real time to obtain the working / idle status of the CAN bus, and triggers an error setting when the CAN bus is idle.
[0017] Wherein, the trigger errors are all counted accordingly, and the host computer can query the corresponding counting information.
[0018] A full data field CAN bus inspection method of the present invention includes: a transmitting end sends a detection CAN data frame, a receiving end receives the CAN data frame, and sequentially performs full data field detection, communication anomaly detection, and data frame interval detection, wherein the full data field detection includes a pseudo-random check of frame length and frame data and a local data frame check; wherein the pseudo-random check of frame length and frame data includes: the transmitting end uses a pseudo-random code generation module to generate a pseudo-random signal, fills the pseudo-random signal into the lowest bit of the lowest byte in the frame data, and adds other contents of the CAN data frame to generate a full data field CAN data check frame; after receiving the check data frame, the receiving end extracts the frame length, extracts data based on the frame length, and performs a pseudo-random code check on the lowest bit of the frame, When the pseudo-random check fails, an error bit is triggered. The local data frame check includes: the transmitter presets the CAN data frame length, selects the bytes to be checked in the CAN data frame, and sends a cumulative check byte; the receiver extracts the check byte from the received data frame and compares the check bytes of the previous and next frames. A difference of 1 indicates a pass. When the cumulative check fails, an error bit is triggered. This method utilizes multi-dimensional verification methods, including pseudo-random data frame length, full pseudo-random data frame content, and cumulative verification of partial data fields. The transmitter sends a test CAN data frame, which is then received by the receiver for verification. The CAN data frame interval can be set with a step accuracy of 1µs. Verification data is comprehensive, and random frame length and random data are automatically detected. This method is of decisive significance for the inspection and evaluation of the CAN bus. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0020] Figure 1 This is the CAN test system equipment connection diagram.
[0021] Figure 2 This is the diagram of the CAN test board.
[0022] Figure 3 This is the CAN data frame structure diagram.
[0023] Figure 4 Send schematics for verification data.
[0024] Figure 5 This is the principle diagram of the pseudo-random signal combination frame length.
[0025] Figure 6Schematic diagram of the pseudo-random signal combination data bytes.
[0026] Figure 7 Schematic diagram for receiving inspection data.
[0027] Figure 8 This is the schematic diagram for verifying the received pseudo-random data.
[0028] Figure 9 Slide the design graph for the local data frame.
[0029] Figure 10 Design diagram for CAN test software.
[0030] Figure 11 The present invention provides a flow chart of a method for inspecting a CAN bus in a full data domain.
[0031] Figure 12 It is a flow chart of the pseudo-random check of the frame length and frame data.
[0032] Figure 13 It is a flowchart of local data frame verification. DETAILED DESCRIPTION
[0033] The following describes embodiments of the present invention in detail, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and are not to be construed as limiting the present invention.
[0034] See also Figures 1 to 13 , the present invention provides a full data domain CAN bus inspection method, comprising the following steps;
[0035] S1: The transmitting end sends a detection CAN data frame, and the receiving end receives the CAN data frame and performs full data field detection, communication anomaly detection and data frame interval detection in sequence. The full data field detection includes pseudo-random check of frame length and frame data and local data frame check.
[0036] In an embodiment of the present invention, the data frame interval detection controls the transmission interval of CAN data frames by software, with a transmission interval step of 1 μs. The communication anomaly detection detects the status of the CAN bus in real time to obtain the working / idle status of the CAN bus. When the CAN bus is idle, an error bit is triggered.
[0037] The pseudo-random check of the frame length and frame data includes:
[0038] S101: The transmitting end generates a pseudo-random signal using a pseudo-random code generating module, fills the pseudo-random signal into the lowest bit of the lowest byte in the frame data, and adds other contents of the CAN data frame to generate a full data field CAN data check frame;
[0039] In an embodiment of the present invention, the transmitting end uses a pseudo-random code generation module to generate a pseudo-random signal (with a width of 1 bit). The continuous 4 bits of the pseudo-random signal are used as the frame length, and the pseudo-random signal is filled into the lowest bit of the lowest byte in the frame data. Adding other contents of the CAN data frame, a full data field CAN data check frame is generated. After receiving the check data frame, the receiving end in S102 extracts the frame length, extracts data based on the frame length, and performs a pseudo-random code check on the lowest bit of the frame. When the pseudo-random check fails, an error setting is triggered;
[0040] In the embodiment of the present invention, after receiving the check data frame, the receiving end first extracts the frame length, then extracts the data according to the frame length, and performs a pseudo-random code check on the lowest bit of the frame. If the pseudo-random code check fails, an error bit is triggered.
[0041] The local data frame check includes:
[0042] S111: The transmitting end presets the CAN data frame length, selects the bytes to be checked in the CAN data frame, and sends the accumulated check bytes;
[0043] In the embodiment of the present invention, the transmitting end first sets the CAN data frame length, selects the bytes to be checked in the CAN data frame, and then starts sending the accumulated check bytes.
[0044] In step S112, the receiving end extracts the check bytes of the received data frame and compares the check bytes of the previous and next frames. If the difference is 1, the check is passed. If the cumulative check fails, an error is triggered.
[0045] In the embodiment of the present invention, the receiving end recognizes the setting of the transmitting end accordingly, extracts the check byte of the received data frame, compares the check bytes of the previous and next frames, and passes the check if the difference is 1. When the cumulative check fails, an error bit is triggered.
[0046] The present invention provides a full-data-domain CAN bus verification method, which uses a single-bit pseudo-random signal generated by a linear feedback shift register as a signal source, and shifts the single-bit pseudo-random signal to form a pseudo-random frame length and pseudo-random data. Verification is performed using a configurable frame length and an optional check data field. The method has a sliding window movement function for the optional data field, enabling automatic sliding testing. It also has a function for handling communication anomalies. When errors such as data frame CRC checksum errors cause communication anomalies, the method can self-recover and record and report to a PC for management. The main chips used in the CAN bus transmission path are FPGA chips and CAN level conversion chips, resulting in a simple hardware design.
[0047] In order to better understand the present technical solution, the following examples are provided for further explanation:
[0048] Example:
[0049] System equipment connection Figure 1 As shown in the figure, the test object is a CAN communication link. The CAN test board has two CAN interfaces. During testing, one CAN interface functions as a transmitter and the other as a receiver. The CAN test board communicates with a PC via a UART interface, which provides control and real-time display of test information.
[0050] The CAN test board is composed of Figure 2 The FPGA chip is connected to the CAN bus through two IO pins via a CAN level conversion chip, and the two transmit and receive pins are used as UART management interfaces.
[0051] CAN data frame structure is as follows Figure 3 As shown in the figure, a CAN data frame consists of a synchronization segment, arbitration segment, control segment, data segment, check segment, and end segment. The check segment in this design is the data segment, and the frame length is contained in the control segment. The check segment refers to the CRC checksum of the CAN data frame itself, which can indicate a communication anomaly. The FPGA program detects and collects communication anomalies, resets the CAN communication module, performs self-recovery processing, and reports to the PC management.
[0052] The principle of sending test data is as follows Figure 4 As shown in the figure, the FPGA chip uses the corresponding test signals according to the corresponding configuration, combines the test signals into a test frame with the corresponding frame length and data bytes, and finally sends it.
[0053] like Figure 5 、 Figure 6As shown in the figure. When a frame is transmitted, a transmit frame enable signal is generated. This enable signal drives the pseudo-random signal generator to produce a single-bit pseudo-random signal. Simultaneously, this signal drives the corresponding shift register, shifting it left one bit and appending the generated pseudo-random signal to the lowest bit, thereby generating the corresponding frame length and data. The pseudo-random signal generator is implemented using an FPGA's linear feedback shift register. A linear feedback shift register is a shift register that takes a linear function of its previous state output as input.
[0054] The principle of receiving inspection data is as follows Figure 7 As shown in the figure, the FPGA chip receives a CAN data frame, first determines the frame length, and then extracts the test data based on the frame length. Based on the corresponding configuration, the test data is verified. During this process, the CAN communication is also checked for abnormalities.
[0055] The principle of receiving pseudo-random data verification is as follows Figure 8 As shown in the figure, each time a CAN data frame is received, the lowest bit of the check data in the data frame is extracted, that is, a single-bit pseudo-random signal. After extraction, the pseudo-random signal is verified.
[0056] The local data frame sliding design is as follows Figure 9 The local data is in bytes, and the sliding window steps are 1 byte. For example, if the total data field is 8 bytes and the local data is 3 bytes, the sliding window needs to step 1, 2, 3, 4, and 5 bytes in sequence. Each time the local data is checked from all 0s to all 1s, the sliding window steps one byte.
[0057] CAN test software design Figure 10 The configuration phase sets the test mode and total number of test packets, and has reset, start, and end control. It also has real-time information collection functions, including collection of verification errors, communication anomalies, and detection summary functions.
[0058] The above disclosure is only a preferred embodiment of the full data domain CAN bus inspection method of the present invention. Of course, this cannot be used to limit the scope of the rights of the present invention. Ordinary technicians in this field can understand that implementing all or part of the processes of the above embodiment and making equivalent changes in accordance with the claims of the present invention still fall within the scope of the invention.
Claims
1. A full data domain CAN bus inspection method, characterized in that: The following steps are included: The transmitting end sends a detection CAN data frame, and the receiving end receives the CAN data frame and sequentially performs full data field detection, communication anomaly detection and data frame interval detection, wherein the full data field detection includes a pseudo-random check of the frame length and frame data and a local data frame check; The pseudo-random check of the frame length and frame data includes: The transmitting end generates a pseudo-random signal using a pseudo-random code generating module, fills the pseudo-random signal into the lowest bit of the lowest byte in the frame data, and adds other contents of the CAN data frame to generate a full data field CAN data check frame; After receiving the verification data frame, the receiving end extracts the frame length, extracts data based on the frame length, performs a pseudo-random code check on the lowest bit of the frame, and triggers an error setting when the pseudo-random code check fails; The local data frame check includes: The transmitting end presets the CAN data frame length, selects the bytes to be checked in the CAN data frame, and sends the accumulated check bytes; The receiving end extracts the check bytes from the received data frame and compares the check bytes of the previous and next frames. If the difference is 1, the check is passed. When the cumulative check fails, an error is triggered.
2. The full data domain CAN bus inspection method according to claim 1, characterized in that ; The random signal width is 1 bit.
3. The full data domain CAN bus inspection method according to claim 1, characterized in that ; The data frame interval detection controls the sending interval of the CAN data frame through software, and the sending interval step is 1us.
4. The full data domain CAN bus inspection method according to claim 1, characterized in that ; The communication anomaly detection detects the status of the CAN bus in real time to obtain the working / idle status of the CAN bus, and triggers an error setting when the CAN bus is idle.
5. The full data domain CAN bus inspection method according to claim 1, characterized in that ; The trigger errors are all counted accordingly, and the host computer can query the corresponding counting information.