CAN synchronization test method and system, electronic equipment and storage medium

Through automated CAN synchronization testing methods and systems, the problem of insufficient efficiency and accuracy of existing manual testing methods is solved, and fast and accurate CAN time synchronization performance evaluation is achieved, reducing testing costs.

CN119583390APending Publication Date: 2025-03-07上海北汇信息科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411839637.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

Existing CAN time synchronization testing methods rely on manual operation, and efficiency and accuracy depend on the tester's expertise and experience, resulting in high testing costs and time-consuming.

Method used

An automated CAN synchronization test method and system has been developed. By obtaining time synchronization packets, format checks and synchronization accuracy verification, synchronous test results are generated, which significantly reduces the difficulty and cost of testing.

Benefits of technology

It achieves rapid and accurate evaluation of CAN time synchronization performance, reduces test time and labor costs, is suitable for component-level and system-level testing, and is flexible in a variety of test environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119583390A_ABST
    Figure CN119583390A_ABST
Patent Text Reader

Abstract

The invention provides a CAN synchronization test method and system, electronic equipment and a storage medium. The method comprises the following steps: acquiring a time synchronization message sent to a slave clock node by a master clock node in a CAN synchronization system; performing format check on the time synchronization message according to a message standard specification to obtain a format check result; performing synchronization precision verification on the master clock node and the slave clock node to obtain a precision verification result; taking a format check result and a precision verification result as synchronous test results; namely, an automatic test project is developed based on the CAN time synchronization system, the test difficulty is remarkably reduced, the test time cost and labor cost are greatly reduced, meanwhile, part-level and system-level tests can be met, and the tests can be flexibly executed in various test environments of an automatic test system and a common power supply condition. And scripts can be generated in batches by utilizing a code generation tool, so that the automatic testing efficiency is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of automobile electronic testing, and more specifically, particularly relates to a CAN synchronization testing method and system, electronic equipment, and storage medium. Background Art

[0002] In modern automotive electronic systems, the CAN (Controller Area Network) bus is a widely used communication protocol, and its time synchronization performance is crucial to ensure the coordinated operation of various system components. Therefore, accurate testing of CAN time synchronization has become a key link to ensure system stability and reliability.

[0003] At present, CAN time synchronization testing mainly relies on manual operation. Testers need to carefully compare the message data format and timestamp information, and evaluate the accuracy of time synchronization through manual calculation. Although this method can meet the test requirements to a certain extent, its efficiency and accuracy largely depend on the professional skills and experience of the testers.

[0004] However, manual testing requires a high level of technical skills from the tester. The tester needs to have a deep understanding of the CAN time synchronization mechanism and rich practical experience, which undoubtedly increases the labor cost of testing. In addition, the manual testing process is cumbersome and time-consuming, especially when facing multi-channel controllers. The tester needs to test and analyze the time synchronization of each channel one by one, which greatly increases the time cost of testing and analysis. For the development of modern automotive electronic systems that require fast and accurate evaluation of CAN time synchronization performance, the existing manual testing methods are obviously difficult to meet the needs. Summary of the invention

[0005] In view of this, the purpose of the present invention is to provide a CAN synchronization test method and system, electronic equipment, and storage medium, which are used to develop an automated test project based on the CAN time synchronization system, significantly reducing the test difficulty and greatly shortening the time and labor costs of the test.

[0006] The first aspect of the present application discloses a CAN synchronization test method, comprising:

[0007] Obtain the time synchronization message sent by the master clock node to the slave clock node in the CAN synchronization system;

[0008] Performing a format check on the time synchronization message according to a message standard specification to obtain a format check result;

[0009] Performing synchronization accuracy verification on the master clock node and the slave clock node to obtain an accuracy verification result;

[0010] The format check result and the accuracy verification result are used as synchronization test results.

[0011] Optionally, the performing synchronization accuracy verification on the master clock node and the slave clock node to obtain an accuracy verification result includes:

[0012] For the master clock node, according to the message time in the time synchronization message and the sending time of the time synchronization message, the absolute time accuracy and relative time accuracy of the master clock node are obtained; the absolute time accuracy and relative time accuracy of the master clock node are used as the accuracy verification result of the master clock node; the time synchronization message is a message sent by the master clock node to the slave clock node;

[0013] For the slave clock node, the absolute time accuracy and relative time accuracy of the slave clock node are obtained through the message time in the time synchronization message and the reverse time in the reverse time message; the absolute time accuracy and relative time accuracy of the slave clock node are used as the accuracy verification result of the slave clock node; wherein the reverse time message is a message in response to the time synchronization message.

[0014] Optionally, for the master clock node, obtaining the absolute time accuracy and relative time accuracy of the master clock node according to the message time in the time synchronization message and the sending time of the time synchronization message; and using the absolute time accuracy and relative time accuracy of the master clock node as the accuracy verification result of the master clock node, includes:

[0015] In the test of absolute time accuracy: the time synchronization message and its sending time are obtained; the timestamp information in the time synchronization message is converted into the message time, and the message time is compared with the sending time to obtain the absolute time accuracy of the master clock node;

[0016] In the relative time accuracy test, two groups of time synchronization messages and their sending times are obtained, and the first sending time difference between the two groups of time synchronization messages and the first message time difference between the two groups of time synchronization messages are determined, and the difference between the first sending time difference and the first message time difference is used as the relative time accuracy of the master clock node.

[0017] Optionally, for the slave clock node, the absolute time accuracy and relative time accuracy of the slave clock node are obtained through the message time in the time synchronization message and the reverse time in the reverse time message; the absolute time accuracy and relative time accuracy of the slave clock node are used as the accuracy verification result of the slave clock node; wherein the reverse time message is a message that responds to the time synchronization message, including:

[0018] In the test of absolute time accuracy, the message time of the time synchronization message received by the slave clock node is determined, the reverse time in the reverse time message sent by the slave clock node is determined, the sending time of the time synchronization message is subtracted from the sending time of the reverse time message to obtain a second sending time difference, and the absolute time accuracy of the slave clock node is obtained based on the reverse time, the message time and the second sending time difference;

[0019] In the test of relative time accuracy, the time synchronization message and the reverse time message are obtained, the sending time of the time synchronization message is sent, and the sending time of the reverse time message is sent; the second sending time difference between the time synchronization message and the reverse time message, and the second message time difference between the message time of the time synchronization message and the reverse time of the reverse time message are determined, and the second message time difference and the sending time are compared to obtain the relative time accuracy of the slave clock node.

[0020] Optionally, performing a format check on the time synchronization message according to a message standard specification to obtain a format check result includes:

[0021] Get the data field of the time synchronization message through CANoe software;

[0022] Match the specific bytes and bits in the data field with the requirements in the message standard specification one by one, and output the comparison result;

[0023] The comparison result is used as the format checking result.

[0024] The second aspect of the present application discloses a CAN synchronization test system, comprising:

[0025] An acquisition module is used to acquire a time synchronization message sent from a master clock node to a slave clock node in a CAN synchronization system;

[0026] A format checking module, used to perform a format check on the time synchronization message according to a message standard specification to obtain a format check result;

[0027] A synchronization accuracy verification module, used to verify the synchronization accuracy of the master clock node and the slave clock node to obtain an accuracy verification result;

[0028] The result module is used to use the format check result and the accuracy verification result as synchronization test results.

[0029] Optionally, the synchronization accuracy verification module is used to verify the synchronization accuracy of the master clock node and the slave clock node, and when the accuracy verification result is obtained, is specifically used to:

[0030] For the master clock node, according to the message time in the time synchronization message and the sending time of the time synchronization message, the absolute time accuracy and relative time accuracy of the master clock node are obtained; the absolute time accuracy and relative time accuracy of the master clock node are used as the accuracy verification result of the master clock node; the time synchronization message is a message sent by the master clock node to the slave clock node;

[0031] For the slave clock node, the absolute time accuracy and relative time accuracy of the slave clock node are obtained through the message time in the time synchronization message and the reverse time in the reverse time message; the absolute time accuracy and relative time accuracy of the slave clock node are used as the accuracy verification result of the slave clock node; wherein the reverse time message is a message in response to the time synchronization message.

[0032] Optionally, the format checking module is used to perform a format check on the time synchronization message according to a message standard specification, and when a format check result is obtained, is specifically used to:

[0033] Get the data field of the time synchronization message through CANoe software;

[0034] Match the specific bytes and bits in the data field with the requirements in the message standard specification one by one, and output the comparison result;

[0035] The comparison result is used as the format checking result.

[0036] The third aspect of the present application discloses an electronic device, comprising:

[0037] one or more processors;

[0038] a storage device having one or more programs stored thereon;

[0039] When one or more programs are executed by one or more processors, the one or more processors implement the CAN synchronization test method as described in any one of the first aspects of the present application.

[0040] A fourth aspect of the present application discloses a storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the CAN synchronization test method as described in any one of the first aspects of the present application is implemented.

[0041] It can be seen from the above technical scheme that a CAN synchronization test method provided by the present invention includes: obtaining a time synchronization message sent by a master clock node to a slave clock node in a CAN synchronization system; performing a format check on the time synchronization message according to the message standard specification to obtain a format check result; performing synchronization accuracy verification on the master clock node and the slave clock node to obtain an accuracy verification result; using the format check result and the accuracy verification result as a synchronization test result; that is, the present application develops an automated test project based on the CAN time synchronization system, significantly reducing the difficulty of the test, greatly shortening the time cost and manpower cost of the test, and can meet component-level and system-level tests at the same time, and can also flexibly perform tests in a variety of test environments under automated test systems and ordinary power supply conditions. Using code generation tools, scripts can be generated in batches, greatly improving the efficiency of automated testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] 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 some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0043] Figure 1 is a flow chart of a CAN synchronization test method provided by an embodiment of the present invention;

[0044] Figure 2 It is a flow chart of a master-slave node sending a message involved in a CAN synchronization test method provided by an embodiment of the present invention;

[0045] Figure 3 It is a schematic diagram of an engineering page involved in a CAN synchronization test method provided by an embodiment of the present invention;

[0046] Figure 4 It is a schematic diagram of an automated test script interface involved in a CAN synchronization test method provided by an embodiment of the present invention;

[0047] Figure 5 It is a schematic diagram of a test report interface involved in a CAN synchronization test method provided by an embodiment of the present invention;

[0048] Figure 6 It is a schematic diagram of a test step result interface involved in a CAN synchronization test method provided by an embodiment of the present invention;

[0049] Figure 7 is a schematic diagram of a CAN synchronization test system provided by an embodiment of the present invention;

[0050] Figure 8It is a schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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.

[0052] In the present application, the term "comprises", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of further restrictions, the elements defined by the sentence "comprising one..." do not exclude the existence of other identical elements in the process, method, article or equipment including the elements. In addition, the terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here, for example.

[0053] The embodiment of the present application provides a CAN synchronization test method, which is used to solve the problem in the prior art that the existing manual testing method is obviously difficult to meet the needs of modern automotive electronic system development that requires rapid and accurate evaluation of CAN time synchronization performance.

[0054] See also Figure 1 The CAN synchronization test method comprises:

[0055] S101, obtaining a time synchronization message sent by a master clock node to a slave clock node in a CAN synchronization system.

[0056] It should be noted that the message interaction process between the master clock node and the slave clock node is as follows: Figure 2 As shown, where:

[0057] Time synchronization messages are divided into SYNC messages and FUP messages. One SYNC and one FUP form a group. Each group starts with a SYNC message and ends with a FUP message. The last four bytes in the SYNC message are the seconds part of a timestamp, and the last four bytes in the FUP message are the nanoseconds part of a timestamp.

[0058] CANEastertime is the master clock node for time synchronization; CANTimeslave is the slave clock node for time synchronization; SYNC is the master message of the time synchronization message; FUP is the follower message of the time synchronization message; t0r is the timestamp when the master clock node sends the SYNC message; t1r is the timestamp when the master clock node completes sending the SYNC message; t2r is the timestamp when the slave clock node receives the SYNC message; t3r is the timestamp before the slave clock node is synchronized; t4r is the relative time carried in the FUP message sent by the master clock node (the time difference between t1r and s(t0r)); s(t) is the seconds part of time t; SYNC(s(t0r)) is the seconds part of the SYNC message of t0r time; FUP(t4r=t1r-s(t0r)) is the FUP message carrying t4r time.

[0059] That is to say, the master clock node starts sending SYNC messages to the slave clock node at time t0r; the sending of the SYNC message is completed at time t1r, that is, the SYNC message of the second part of the t0r time is sent to the slave clock node; then the slave clock node starts receiving the SYNC message at time t2r; the slave clock node synchronizes the timestamp at time t3r; t4r=t1r-s(t0r); where t4 is the relative time carried in the FUP message; and the FUP message is sent to the slave clock node at time t4r, that is, the FUP message of the nanosecond part of the t4r time is sent to the slave clock node.

[0060] The acquired time synchronization message can be real-time, that is, when the master clock node sends a message, the message is acquired immediately. Of course, historical messages can also be acquired. There is no specific limitation here, and it depends on the actual situation, which is all within the protection scope of this application.

[0061] S102: Perform a format check on the time synchronization message according to a message standard specification to obtain a format check result.

[0062] It should be noted that the process of formatting the time synchronization message in accordance with the standard specification of the data message and obtaining the format check result usually involves strict verification of the structure, content, encoding method, etc. of the message.

[0063] The following is an example of the time synchronization message format specification and check results based on the IEEE 1588 standard:

[0064] The message format is standardized. The message types are: Sync message: sent by the master clock node in broadcast mode, and its departure time needs to be marked at the master clock node, and its arrival time needs to be marked at the slave clock node. Follow_Up message: sent by the master clock node in broadcast mode, used to transmit the precise departure time of the Sync message. Delay_Req message: sent by the slave clock node in point-to-point mode, and its departure time needs to be marked at each slave clock node, and its arrival time needs to be marked at the master clock node. Delay_Resp message: sent from the master clock in point-to-point mode, used to transmit the arrival time of the Delay_Req message and the departure time of the Delay_Resp message. The message header format is: IEEE 1588 messages are transmitted in the network using the UDP protocol, so the header should follow the format of the UDP protocol. The header should contain key information such as the source IP address, destination IP address, source port number, and destination port number. Time stamp: Sync messages and Delay_Req messages need to be time stamped when they are sent and received. Follow_Up and Delay_Resp messages do not need to be time-stamped, but should contain time information associated with the corresponding request message. The encoding method is: the message content should be encoded using network byte order (big-endian). The time information should use a unified time standard, such as UTC time.

[0065] Format check results. Message integrity: Check whether the message contains all necessary fields, such as message type, time stamp, source and destination addresses, etc. Verify whether the length of each field meets the specification requirements. Time stamp accuracy: For Sync messages and Delay_Req messages, check whether their time stamps are accurate, that is, whether the sending and receiving times are consistent with the actual time. For Follow_Up messages and Delay_Resp messages, verify whether the time information they contain is consistent with the time stamp of the corresponding request message. Coding method correctness: Check whether the message content is encoded in network byte order. Verify whether the time information uses a unified time standard. Protocol consistency: Ensure that the message follows the format requirements of the UDP protocol. Verify whether the IP address, port number and other information in the message meets the network configuration requirements. Error handling: For messages with incorrect format, it should be able to identify and discard or perform error handling. Record and report the format check results for subsequent analysis and improvement.

[0066] In summary, the process of formatting the time synchronization message standard involves multiple aspects, including message type, header format, time stamp, encoding method, etc. Through strict format checking results, the correctness and reliability of the message can be ensured, thereby improving the accuracy and stability of time synchronization.

[0067] S103: Verify the synchronization accuracy of the master clock node and the slave clock node to obtain an accuracy verification result.

[0068] Verifying the synchronization accuracy of master and slave clock nodes is a key step to ensure the performance of the time synchronization system. The following is a detailed process for verifying the synchronization accuracy of master and slave clock nodes based on the IEEE 1588 (also known as gPTP or 802.1AS) standard, as well as the possible accuracy verification results.

[0069] First, the synchronization accuracy verification process.

[0070] Test environment setup: prepare master clock nodes, slave clock nodes, and test equipment (such as oscilloscopes, special test equipment, etc.). Ensure that the network connection between all nodes is stable and meets the requirements of the IEEE 1588 standard.

[0071] You can choose one or more of the 1PPS method, Ingress Reporting method, or Reverse Sync method for testing. Each method has its own specific implementation steps and test requirements. You need to read the relevant documents carefully and configure the test equipment and nodes correctly.

[0072] Test implementation: During the test, the master clock node will periodically send Sync messages, and the slave clock node will perform time synchronization based on the received Sync messages. Use the test equipment to record the time difference between the slave clock node and the master clock node, that is, the synchronization error. Depending on the selected test method, it may be necessary for the slave clock node to report synchronization time parameters (such as T1, T2, offsetFromMaster, etc.), or for the test equipment to directly calculate the synchronization error.

[0073] Data collection and analysis: Collect the results of multiple tests and calculate statistical indicators such as the mean and variance of the synchronization error. Analyze the distribution of the synchronization error to determine whether there are outliers or systematic errors.

[0074] Secondly, the accuracy of the verification results.

[0075] Synchronization accuracy index: Synchronization accuracy is usually measured in nanoseconds (ns). According to the requirements of the IEEE 1588 standard, the synchronization accuracy between the master and slave clock nodes should be within ±500ns (for nodes within 7 hops).

[0076] Verification result analysis: If the average value of the synchronization error is close to 0 and the variance is small, it means that the synchronization accuracy of the master and slave clock nodes is high. If there is a significant deviation or large fluctuation in the synchronization error, further debugging and optimization may be required. If abnormal values ​​appear, it may be caused by network delays, hardware failures, or software errors, and needs to be investigated and repaired.

[0077] Test report generation: Generate a detailed test report based on the test data and analysis results. The report should include the test environment, test methods, test data, analysis results, and possible improvement suggestions.

[0078] Subsequent optimization measures: Based on the verification results, optimize and adjust the hardware configuration, software algorithm or network settings of the master and slave clock nodes. Repeat the synchronization accuracy verification until the synchronization accuracy indicators required by the system are met.

[0079] In summary, verifying the synchronization accuracy of the master and slave clock nodes is an important step to ensure the performance of the time synchronization system. By selecting appropriate test methods, building a stable test environment, collecting and analyzing test data, and generating detailed test reports, the synchronization accuracy of the master and slave clock nodes can be effectively evaluated and optimized.

[0080] S104. Use the format check result and the accuracy verification result as the synchronization test result.

[0081] That is to say, the format check result and the accuracy verification result can be used together as the synchronization test result. This synchronization test result can be used to display to the user. Of course, the synchronization test result can also include other information, which will not be repeated here one by one. It depends on the actual situation and is within the protection scope of this application.

[0082] In this embodiment, the time synchronization message sent from the master clock node to the slave clock node in the CAN synchronization system is obtained; the format of the time synchronization message is checked according to the message standard specification to obtain the format check result; the synchronization accuracy of the master clock node and the slave clock node is verified to obtain the accuracy verification result; the format check result and the accuracy verification result are used as the synchronization test result; that is, the application develops an automated test project based on the CAN time synchronization system, which significantly reduces the difficulty of the test, greatly shortens the time cost and manpower cost of the test, and can meet the component level and system level tests at the same time, and can also flexibly perform tests in a variety of test environments under the conditions of automated test systems and ordinary power supply. Using code generation tools, scripts can be generated in batches, greatly improving the efficiency of automated testing.

[0083] Optionally, the synchronization accuracy of the master clock node and the slave clock node is verified to obtain the accuracy verification result, including:

[0084] (1) For the master clock node, the absolute time accuracy and relative time accuracy of the master clock node are obtained according to the message time in the time synchronization message and the sending time of the time synchronization message; the absolute time accuracy and relative time accuracy of the master clock node are used as the accuracy verification result of the master clock node; the time synchronization message is the message sent by the master clock node to the slave clock node.

[0085] The time when the time synchronization message is sent is the world standard time when the time synchronization message is sent.

[0086] First, data collection is performed; specifically, the master clock node sends a time synchronization message (such as a Sync message) to the slave clock node. While sending the time synchronization message, the master clock node records the world standard time (such as UTC time or GPS time) at the time of sending and uses it as a reference time. The time synchronization message contains the timestamp when it was sent (i.e., the message time).

[0087] Secondly, comparison and calculation are performed; specifically, the message time of the timestamp is extracted from the time synchronization message. The message time is compared with the world standard time when it was sent, and the time difference is calculated. Based on the time difference, the absolute time accuracy (i.e., the deviation from the world standard time) and relative time accuracy (i.e., the deviation between the message time and the actual sending time) of the master clock node are obtained.

[0088] Finally, the verification result is obtained; specifically, the absolute time accuracy and relative time accuracy of the master clock node are output as the accuracy verification result.

[0089] The following is an explanation of the absolute time accuracy and relative time accuracy of the master clock node:

[0090] In the test of absolute time accuracy: obtain the time synchronization message sent by the master clock node and its sending time; convert and calculate the timestamp information in the time synchronization message to obtain the message time, compare the message time and the sending time, and obtain the absolute time accuracy of the master clock node.

[0091] In the test of absolute time accuracy, attention should be paid to the difference between the time synchronization message sent by the master clock node and the world standard time when the message is sent. The test process is as follows:

[0092] First, data acquisition. Capture the time synchronization message sent by the master clock node, which contains timestamp information. Record the world standard time (such as UTC time) when the time synchronization message is sent.

[0093] Secondly, timestamp conversion. The timestamp information in the time synchronization message is converted into the actual time value, recorded as T2. This conversion process may involve steps such as message format parsing and time zone adjustment.

[0094] Next, a comparative analysis is performed to compare the converted time T2 with the world standard time T1 when the message was sent, and the difference between the two is calculated, which is the absolute time accuracy.

[0095] That is to say, in the test of absolute time accuracy, when the master clock node sends a time synchronization message, it will also record the world standard time when it is sent. This time point can be called T1. The timestamp information contained in the time synchronization message can be converted to calculate the time when the message is actually transmitted and recorded by the receiver, which is called T2. By comparing T2 with T1, the absolute time accuracy of the master clock node can be obtained.

[0096] The world standard time can be understood as a globally unified and accurate time standard. It is a time system based on the International Atomic Time, with high stability and accuracy, and is not affected by geography and time zones.

[0097] In the relative time accuracy test, two groups of time synchronization messages and their sending times are obtained, and the first sending time difference of the two groups of time synchronization messages and the first message time difference of the two groups of time synchronization messages are determined, and the difference between the first sending time difference and the first message time difference is used as the relative time accuracy of the master clock node.

[0098] The first sending time difference is: the difference between the sending time of one group of time synchronization messages and the sending time of another group of time synchronization messages.

[0099] The first message time difference is: the difference between the message time of one group of time synchronization messages and the message time of another group of time synchronization messages.

[0100] First, data acquisition: capture two sets of time synchronization messages sent continuously, each set of messages contains a SYNC message (main message). Record the world standard time when these two SYNC messages are received.

[0101] Secondly, the time difference calculation: calculate the world standard time difference t1 of the two SYNC messages received. At the same time, calculate the time difference t2 of the timestamps contained in the two sets of synchronization messages.

[0102] Next, perform comparative analysis: Compare the difference between t1 and t2, which is the relative time accuracy. If the difference between t1 and t2 is small, it means that the relative time accuracy of the time synchronization system is high.

[0103] Through the above process, the absolute time accuracy and relative time accuracy of the master clock node can be tested respectively. The absolute time accuracy test focuses on the difference between the time synchronization message sent by the master clock node and the world standard time when it is sent, while the relative time accuracy test focuses on the time consistency between the time synchronization messages received continuously. These test results help evaluate the performance and accuracy of the time synchronization system.

[0104] (2) For the slave clock node, the absolute time accuracy and relative time accuracy of the slave clock node are obtained through the message time in the time synchronization message and the reverse time in the reverse time message; the absolute time accuracy and relative time accuracy of the slave clock node are used as the accuracy verification result of the slave clock node; wherein the reverse time message is a message that responds to the time synchronization message.

[0105] Specifically, the slave clock node receives the time synchronization message sent by the master clock node. The slave clock node records the timestamp (i.e., message time) of the received time synchronization message. The slave clock node sends a reverse time message (such as a Delay_Req message) to the master clock node, and records the sending time (i.e., reverse time) when sending. The master clock node receives the reverse time message and records the received timestamp (i.e., the master clock receiving time). The master clock node embeds the master clock receiving time into the reverse time response message (such as a Delay_Resp message) and sends it back to the slave clock node.

[0106] The slave clock node receives the reverse time response message and extracts the master clock reception time. The absolute time accuracy and relative time accuracy of the slave clock node are calculated based on the message time of the time synchronization message, the reverse time of the reverse time message, and the master clock reception time in the reverse time response message. The absolute time accuracy can be calculated by comparing the message time of the slave clock node with the reference time of the master clock node (or the time after network delay correction). The relative time accuracy can be calculated by comparing the difference between the message time of the slave clock node and the reverse time.

[0107] The absolute time accuracy and relative time accuracy of the slave clock node are output as accuracy verification results.

[0108] The following is an explanation of the absolute time accuracy and relative time accuracy of the slave clock node:

[0109] In the test of absolute time accuracy, the message time Ta of the time synchronization message received from the clock node is determined, the reverse time Tb in the reverse time message sent from the clock node is determined, and the sending time of the time synchronization message is subtracted from the sending time of the reverse time message to obtain the second sending time difference t11, wherein t11=the sending time t2 of the reverse time message-the sending time t1 of the time synchronization message; based on the reverse time, the message time and the second sending time difference, the absolute time accuracy of the clock node is obtained, that is, Tb-Ta-t11 is used to obtain the absolute time accuracy of the clock node.

[0110] It should be noted that after receiving the time synchronization message from the clock node, it will respond to the message, that is, after checking the time at one end, the clock node sends a reverse time message.

[0111] That is to say, the slave clock node first receives the time synchronization message from the master clock node, which contains the timestamp Ta when it was sent. After a period of time, the slave clock node will send a reverse time message, which contains the time Tb recorded by the slave clock node.

[0112] At the same time, it is necessary to record the standard time when the reverse time message is sent from the clock node, and calculate the time difference t between this time and the sending time of the time synchronization message (that is, the total delay of message transmission and processing).

[0113] In the test of relative time accuracy, the time synchronization message and the reverse time message are obtained, the sending time of the time synchronization message is sent, and the sending time of the reverse time message is sent; the sending time difference between the time synchronization message and the reverse time message, and the second message time difference between the message time of the time synchronization message and the reverse time of the reverse time message are determined, and the second message time difference and the second sending time are compared to obtain the relative time accuracy of the slave clock node.

[0114] The second message time difference is: the difference between the message time of the reverse time message and the message time of the time synchronization message.

[0115] Obtain a set of time synchronization messages and reverse time messages, as well as the sending time of each message, calculate the sending time difference ta between the main message and the reverse time message in the time synchronization message, and the time difference tb between the timestamps contained in the time synchronization message and the reverse time message, and compare ta and tb to obtain the relative time accuracy.

[0116] Specifically, the relative time accuracy of the slave clock node is obtained through tb-ta.

[0117] It should be noted that in actual applications, due to factors such as network delay and hardware processing time, there may be certain errors in absolute time accuracy and relative time accuracy. Therefore, when conducting time synchronization tests, it is necessary to fully consider these factors and take corresponding measures to reduce the errors.

[0118] Through the above process, the synchronization accuracy of the master clock node and the slave clock node can be verified, and the respective accuracy verification results can be obtained. These results are helpful to evaluate the performance of the time synchronization system and provide data support for subsequent optimization and improvement.

[0119] Optionally, a format check is performed on the time synchronization message according to a message standard specification to obtain a format check result, including:

[0120] The data field of the time synchronization message is obtained through the CANoe software; the specific bytes and bits in the data field are matched one by one with the requirements in the message standard specification, and the comparison result is output; the comparison result is used as the format check result. The identifier of the synchronization time message can also be obtained.

[0121] When checking the message format, the built-in functions of CAPL (a programming language developed by Vector) and the self-developed underlying function library are used to detect whether the format of the time synchronization message and the data meet the requirements. Specifically, the identifier and data field of the time synchronization message are first obtained through the CANoe software, and the specific bytes and bits in the data field are matched one by one with the requirements in the message standard specification AUTOSAR_SWS_TimeSyncOverCAN, and the comparison results are output.

[0122] It should be noted that test specifications based on synchronization message format checking and synchronization accuracy verification in the AUTOSAR_SWS_TimeSyncOverCAN standard can be pre-built.

[0123] The test specification covers the following aspects in detail: the order, cycle, data length, CRC (cyclic redundancy check) method, time domain characteristics, transmission sequence counter, user-defined byte (User Byte 0) of SYNC message, reserved byte (Reserved Byte) of FUP message, synchronization object indicator (SGW) of FUP message, etc. of the master clock node sending master and slave messages. In addition, it also includes test cases such as synchronization accuracy verification of absolute time accuracy and relative time accuracy of master clock node and slave clock node.

[0124] Specific test cases include:

[0125] 1. Verify the sending order of time synchronization messages to ensure that the messages are transmitted in the expected order.

[0126] 2. SYNC time synchronization message cycle test to check the accuracy of the message sending cycle.

[0127] 3. FUP synchronization follow-up message interval test to verify the time interval between the FUP message and the SYNC message.

[0128] 4. Test the message verification type to confirm the verification method used by the message.

[0129] 5. SYNC message verification correctness test to ensure that the CRC check of the SYNC message is correct.

[0130] 6. SYNC message time domain test, check the performance of the message in the time domain.

[0131] 7. SYNC message sending sequence counter test to verify the increment of sequence counter.

[0132] 8. Test the user-defined bytes of the SYNC message and check the setting value of User Byte 0.

[0133] 9. FUP message verification correctness test to ensure that the CRC check of the FUP message is correct.

[0134] 10. FUP message time domain test, analyze the characteristics of FUP message in the time domain.

[0135] 11. FUP message sending sequence counter test to verify the correctness of the FUP message sequence counter.

[0136] 12. FUP message reserved byte test, check the reserved status of the Reserved Byte.

[0137] 13. Test the synchronization object indicator bit of the FUP message to verify whether the setting of the SGW bit is as expected.

[0138] 14. Time synchronization master node absolute time test to evaluate the absolute time accuracy of the master node.

[0139] 15. Time synchronization master node relative time test to verify the relative time synchronization performance of the master node.

[0140] 16. Time synchronization slave node absolute time test, measure the absolute time accuracy of the slave node.

[0141] 17. Time synchronization slave node relative time test to check the relative time synchronization capability of the slave node.

[0142] Together, these test cases form a comprehensive and detailed test specification to ensure the performance and accuracy of the time synchronization system.

[0143] According to the above CAN time synchronization mechanism and test specifications, develop test projects and scripts, refer to Figure 3 and Figure 4 .

[0144] In the Hardware Configuration module, users can configure the number of channels required for the test, define the mapping relationship between channels and hardware, and set detailed settings such as channel hardware parameters. In particular, this module supports the configuration of multiple CAN channels that support time synchronization.

[0145] After entering the Simulation Setup module, users can create new network segment information. This function allows multiple network segments to be tested simultaneously, improving the flexibility and efficiency of the test. In addition, through the Databases function, users can import DBC files to parse and identify related messages and signals.

[0146] In the Test Modules area, users can add the required test modules and perform specific test tasks by selecting different test cases. The system will automatically record log information while the test is in progress. After the test is completed, the system will automatically generate a detailed test report. Users can directly open this report in the test module to view the specific steps and test results of each test case. For details, please refer to Figure 5 and Figure 6 The test report lists the operation information of each step in detail. Combined with the timestamp and log records, users can accurately determine the time when the problem occurred and quickly locate the cause of the problem.

[0147] The automated test execution system and template-based code generation tools can be integrated to enhance the automation level of the test process. The developed engineering projects can be connected to the company's exclusive test system architecture, which can be based on Vector's VT System and integrates various peripherals and interface modules such as I / O boards, programmable power supplies, programmable oscilloscopes, etc., ensuring the smooth operation of the engineering projects in this test environment.

[0148] In addition, the project also has excellent compatibility and can adapt to desktop power supply VH1150 or conventional voltage-stabilized power supply, which provides great convenience for users to perform tests in a variety of test environments. In the parameter configuration and generation stage, users can rely on the corresponding software. They only need to import the parameter configuration file, and the system can automatically complete the parameter setting and efficiently generate test cases and test scripts. This function greatly improves the efficiency of batch generation of test scripts, thereby accelerating the overall process of automated testing.

[0149] Another embodiment of the present application provides a CAN synchronization test system.

[0150] See also Figure 7 , the CAN synchronization test system includes:

[0151] The acquisition module 101 is used to acquire a time synchronization message sent by a master clock node to a slave clock node in a CAN synchronization system.

[0152] The format checking module 102 is used to perform a format check on the time synchronization message according to the message standard specification to obtain a format check result.

[0153] Optionally, the format checking module 103 is used to perform a format check on the time synchronization message according to a message standard specification, and when a format check result is obtained, is specifically used to:

[0154] Get the data field of the time synchronization message through CANoe software.

[0155] Match the specific bytes and bits in the data field with the requirements in the message standard specification one by one, and output the comparison results.

[0156] The comparison result is used as the format check result.

[0157] The synchronization accuracy verification module 103 is used to verify the synchronization accuracy of the master clock node and the slave clock node to obtain an accuracy verification result.

[0158] Optionally, the synchronization accuracy verification module 103 is used to verify the synchronization accuracy of the master clock node and the slave clock node, and when the accuracy verification result is obtained, it is specifically used to:

[0159] For the master clock node, the absolute time accuracy and relative time accuracy of the master clock node are obtained according to the message time in the time synchronization message and the sending time of the time synchronization message; the absolute time accuracy and relative time accuracy of the master clock node are used as the accuracy verification result of the master clock node; the time synchronization message is the message sent by the master clock node to the slave clock node.

[0160] For the slave clock node, the absolute time accuracy and relative time accuracy of the slave clock node are obtained through the message time in the time synchronization message and the reverse time in the reverse time message; the absolute time accuracy and relative time accuracy of the slave clock node are used as the accuracy verification result of the slave clock node; wherein, the reverse time message is a message that responds to the time synchronization message.

[0161] The result module 104 is used to use the format check result and the accuracy verification result as the synchronization test result.

[0162] The specific working process and principle of each of the above modules are detailed in the CAN synchronization test method provided in the above embodiment, which will not be described one by one here. It depends on the actual situation and is within the protection scope of this application.

[0163] In this embodiment, the acquisition module 101 is used to obtain the time synchronization message sent from the master clock node to the slave clock node in the CAN synchronization system; the format check module 102 is used to perform format check on the time synchronization message according to the message standard specification to obtain the format check result; the synchronization accuracy verification module 103 is used to perform synchronization accuracy verification on the master clock node and the slave clock node to obtain the accuracy verification result; the result module 104 is used to use the format check result and the accuracy verification result as the synchronization test result; that is, the present application develops an automated test project based on the CAN time synchronization system, which significantly reduces the difficulty of the test, greatly shortens the time cost and manpower cost of the test, and can meet the component level and system level tests at the same time, and can also flexibly perform tests in a variety of test environments under the conditions of the automated test system and ordinary power supply. Using the code generation tool, scripts can be generated in batches, which greatly improves the efficiency of automated testing.

[0164] Another embodiment of the present application provides a storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the CAN synchronization test method as described in any one of the above embodiments is implemented.

[0165] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0166] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0167] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0168] Another embodiment of the present invention provides an electronic device, such as Figure 8 As shown, including:

[0169] One or more processors 201.

[0170] The storage device 202 stores one or more programs.

[0171] When one or more programs are executed by one or more processors 201 , the one or more processors 201 implement the CAN synchronization test method as described in any one of the above embodiments.

[0172] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart.

[0173] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

[0174] Although several specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Certain features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination.

[0175] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0176] The features recorded in the various embodiments in this specification can be replaced or combined with each other, and the same and similar parts between the various embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.

[0177] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0178] 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 CAN synchronization test method, characterized in that: include: Obtain the time synchronization message sent by the master clock node to the slave clock node in the CAN synchronization system; Performing a format check on the time synchronization message according to a message standard specification to obtain a format check result; Performing synchronization accuracy verification on the master clock node and the slave clock node to obtain an accuracy verification result; The format check result and the accuracy verification result are used as synchronization test results.

2. The CAN synchronization test method according to claim 1, characterized in that: The performing synchronization accuracy verification on the master clock node and the slave clock node to obtain an accuracy verification result includes: For the master clock node, according to the message time in the time synchronization message and the sending time of the time synchronization message, the absolute time accuracy and relative time accuracy of the master clock node are obtained; the absolute time accuracy and relative time accuracy of the master clock node are used as the accuracy verification result of the master clock node; the time synchronization message is a message sent by the master clock node to the slave clock node; For the slave clock node, the absolute time accuracy and relative time accuracy of the slave clock node are obtained through the message time in the time synchronization message and the reverse time in the reverse time message; the absolute time accuracy and relative time accuracy of the slave clock node are used as the accuracy verification result of the slave clock node; wherein the reverse time message is a message in response to the time synchronization message.

3. The CAN synchronization test method according to claim 2, characterized in that: For the master clock node, according to the message time in the time synchronization message and the sending time of the time synchronization message, the absolute time accuracy and relative time accuracy of the master clock node are obtained; Taking the absolute time accuracy and the relative time accuracy of the master clock node as the accuracy verification result of the master clock node includes: In the test of absolute time accuracy: the time synchronization message and its sending time are obtained; the timestamp information in the time synchronization message is converted into the message time, and the message time is compared with the sending time to obtain the absolute time accuracy of the master clock node; In the relative time accuracy test, two groups of time synchronization messages and their sending times are obtained, and the first sending time difference between the two groups of time synchronization messages and the first message time difference between the two groups of time synchronization messages are determined, and the difference between the first sending time difference and the first message time difference is used as the relative time accuracy of the master clock node.

4. The CAN synchronization test method according to claim 2, characterized in that: For the slave clock node, the absolute time accuracy and relative time accuracy of the slave clock node are obtained through the message time in the time synchronization message and the reverse time in the reverse time message; the absolute time accuracy and relative time accuracy of the slave clock node are used as the accuracy verification result of the slave clock node; wherein the reverse time message is a message responding to the time synchronization message, including: In the test of absolute time accuracy, the message time of the time synchronization message received by the slave clock node is determined, the reverse time in the reverse time message sent by the slave clock node is determined, the sending time of the time synchronization message is subtracted from the sending time of the reverse time message to obtain a second sending time difference, and the absolute time accuracy of the slave clock node is obtained based on the reverse time, the message time and the second sending time difference; In the test of relative time accuracy, the time synchronization message and the reverse time message are obtained, the sending time of the time synchronization message is sent, and the sending time of the reverse time message is sent; the second sending time difference between the time synchronization message and the reverse time message, and the second message time difference between the message time of the time synchronization message and the reverse time of the reverse time message are determined, and the second message time difference and the sending time are compared to obtain the relative time accuracy of the slave clock node.

5. The CAN synchronization test method according to claim 1, characterized in that: The step of performing a format check on the time synchronization message according to a message standard specification to obtain a format check result includes: Get the data field of the time synchronization message through CANoe software; Match the specific bytes and bits in the data field with the requirements in the message standard specification one by one, and output the comparison result; The comparison result is used as the format checking result.

6. A CAN synchronization test system, characterized in that: include: An acquisition module is used to acquire a time synchronization message sent from a master clock node to a slave clock node in a CAN synchronization system; A format checking module, used to perform a format check on the time synchronization message according to a message standard specification to obtain a format check result; A synchronization accuracy verification module, used to verify the synchronization accuracy of the master clock node and the slave clock node to obtain an accuracy verification result; The result module is used to use the format check result and the accuracy verification result as synchronization test results.

7. The CAN synchronization test system according to claim 6, characterized in that: The synchronization accuracy verification module is used to verify the synchronization accuracy of the master clock node and the slave clock node, and when the accuracy verification result is obtained, it is specifically used to: For the master clock node, according to the message time in the time synchronization message and the sending time of the time synchronization message, the absolute time accuracy and relative time accuracy of the master clock node are obtained; the absolute time accuracy and relative time accuracy of the master clock node are used as the accuracy verification result of the master clock node; the time synchronization message is a message sent by the master clock node to the slave clock node; For the slave clock node, the absolute time accuracy and relative time accuracy of the slave clock node are obtained through the message time in the time synchronization message and the reverse time in the reverse time message; the absolute time accuracy and relative time accuracy of the slave clock node are used as the accuracy verification result of the slave clock node; wherein the reverse time message is a message in response to the time synchronization message.

8. The CAN synchronization test system according to claim 6, characterized in that: The format checking module is used to perform a format check on the time synchronization message according to a message standard specification, and when a format check result is obtained, is specifically used to: Get the data field of the time synchronization message through CANoe software; Match the specific bytes and bits in the data field with the requirements in the message standard specification one by one, and output the comparison result; The comparison result is used as the format checking result.

9. An electronic device, characterized in that: include: one or more processors; a storage device having one or more programs stored thereon; When one or more programs are executed by one or more processors, the one or more processors implement the CAN synchronization test method as described in any one of claims 1 to 5.

10. A storage medium, characterized in that: A computer program is stored thereon, wherein when the computer program is executed by a processor, the CAN synchronization test method as described in any one of claims 1-5 is implemented.