A method, device, equipment and storage medium for automatic calibration of bus communication module
By sending synchronous calibration frames and correcting timestamps in the bus communication system, automatic calibration of the bus module is realized, time synchronization deviation problem is solved, real-time and reliability of communication is improved, and calibration process is simplified.
Patent Information
- Application Number
- CN202411387719.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-07
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-10-07
AI Technical Summary
There is a deviation in the time synchronization between bus modules in the existing bus communication system, which affects the real-time and reliability of communication. The existing calibration methods are cumbersome, costly and difficult to achieve automatic calibration across the entire network.
Through the control bus module, the slave station sends synchronous calibration frames to the main station. After receiving the master station, the timing maintenance and time stamp extraction are performed, the local time is corrected, and the time error information is broadcast. Each slave station corrects the propagation delay time to achieve automatic calibration synchronization judge.
It improves the synchronization and reliability of the bus communication module, simplifies the calibration process, reduces costs, and adapts to the characteristics of large number and wide distribution of modules, realizing automatic calibration across the entire network.
Smart Images

Figure CN118921247B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of bus communication technology, and in particular to a bus communication module automatic calibration method, device, equipment and storage medium. Background Art
[0002] A bus communication system is a set of interconnected devices, transmission media, and control logic that supports the transmission of data and control signals between devices according to a predetermined protocol. These devices can be computers, sensors, actuators, controllers, or other intelligent devices. Each device in the system is connected to the bus through a bus interface and communicates with other devices through the bus.
[0003] In existing bus communication systems, especially those based on CAN (Controller Area Network) bus, time synchronization between bus modules is a key technical issue. Since the internal clocks of each bus module may deviate, this deviation will affect the real-time and reliability of bus communication. Therefore, it is necessary to calibrate the time of the bus communication module to ensure the synchronization and accuracy of data transmission.
[0004] Traditional bus communication module calibration methods usually need to be performed manually or rely on external time synchronization signal sources, such as GPS signals. These methods have the following disadvantages: 1) The manual calibration process is cumbersome, inefficient, and prone to errors; 2) Methods that rely on external signal sources are costly and cannot be calibrated when the signal is unavailable; 3) Existing calibration methods cannot adapt well to the characteristics of the large number and wide distribution of modules in the bus system, making it difficult to achieve automatic calibration across the entire network.
[0005] Therefore, it is an urgent problem to be solved by technicians in this field to invent a bus communication module automatic calibration method that can realize automatic calibration of the bus module so as to improve the synchronization and reliability of the bus communication system. Summary of the invention
[0006] In view of the above defects, the embodiments of the present invention provide a bus communication module automatic calibration method, device, equipment and storage medium to solve the problems existing in the prior art.
[0007] In order to solve the above technical problems, an embodiment of the present invention provides a bus communication module automatic calibration method, the method comprising:
[0008] The synchronization controller controlling each bus module slave station sends a synchronization calibration frame to the bus module master station;
[0009] Controlling the bus module master station to perform timing maintenance control on the synchronization calibration frame after receiving the synchronization calibration frame, so as to restore the original sending order of the synchronization calibration frame;
[0010] Control the bus module master station to extract the sending timestamp and original propagation delay time of the synchronization calibration frame;
[0011] Controlling the bus module master station to correct the local time of the bus module master station according to the sending timestamp and the original propagation delay time;
[0012] Control the bus module master station to obtain a first local time error of the bus module master station according to the sending timestamp, the corrected local time of the bus module master station and the original propagation delay time;
[0013] Control the bus module master station to encapsulate the first local time error and the corrected local time of the bus module master station in a response message, and broadcast the response message to each of the bus module slave stations on the CAN bus;
[0014] Control each of the bus modules to receive the response message from the station, and correct the original propagation delay time according to the receiving timestamp of the response message and the sending timestamp of the synchronization calibration frame;
[0015] Control each of the bus module slave stations to determine a second local time error of the bus module slave station;
[0016] determining the synchronization of the automatic calibration according to a comparison result of the first local time error and the second local time error;
[0017] The controlling each of the bus module slave stations to determine the second local time error of the bus module slave station comprises:
[0018] Control each of the bus module slave stations to determine a second local time error of the bus module slave station according to the local time of the bus module master station, the receiving timestamp of the response message and the original propagation delay time.
[0019] Preferably, judging the synchronization of automatic calibration according to the comparison result of the first local time error and the second local time error comprises:
[0020] Determining whether the first local time error and the second local time error are the same;
[0021] If the first local time error and the second local time error are the same, it is determined that the automatic calibration is successful.
[0022] Preferably, the controlling the bus module master station to correct the local time of the bus module master station according to the sending timestamp and the original propagation delay time comprises:
[0023] Control the bus module master station to obtain the time deviation according to the sending timestamp, the local clock counter value of the bus module master station and the original propagation delay time;
[0024] The bus module master station is controlled to correct the local time of the bus module master station according to the local clock counter value and the time deviation.
[0025] Preferably, the controlling the bus module master station to obtain a first local time error of the bus module master station according to the sending timestamp, the corrected local time of the bus module master station and the original propagation delay time comprises:
[0026] Obtaining the original propagation delay time;
[0027] Calculating the first local time error according to the original propagation delay time, the sending timestamp and the local time of the bus module master station;
[0028] Among them, the first local time error=(the sending timestamp+the original propagation delay time / 2-the local time of the bus module master station).
[0029] Preferably, in controlling the bus module master station to obtain the time deviation according to the sending timestamp of the synchronization calibration frame, the local clock counter value of the bus module master station and the original propagation delay time, the time deviation is:
[0030] The time deviation=(the sending timestamp+the original propagation delay time / 2-the local clock counter value of the bus module master station).
[0031] Preferably, the controlling each of the bus modules to receive the response message from the station, and correcting the original propagation delay time according to the receiving timestamp of the response message and the sending timestamp of the synchronization calibration frame comprises:
[0032] Corrected original propagation delay time=receiving timestamp of the response message−sending timestamp of the synchronization calibration frame.
[0033] In order to solve the above technical problems, an embodiment of the present invention provides a bus communication module automatic calibration device, characterized in that the device comprises:
[0034] A synchronization frame sending module, used to control the synchronization controller of each bus module slave station to send a synchronization calibration frame to the bus module master station;
[0035] A timing control module, used for controlling the bus module master station to perform timing control on the synchronization calibration frame after receiving the synchronization calibration frame, so as to restore the original sending order of the synchronization calibration frame;
[0036] An information extraction module, used for controlling the bus module master station to extract the sending timestamp and original propagation delay time of the synchronization calibration frame;
[0037] A first correction module, used for controlling the bus module master station to correct the local time of the bus module master station according to the sending timestamp and the original propagation delay time;
[0038] A first time error confirmation module, used for controlling the bus module master station to obtain a first local time error of the bus module master station according to the sending timestamp, the corrected local time of the bus module master station and the original propagation delay time;
[0039] A broadcast module, used for controlling the bus module master station to encapsulate the first local time error and the corrected local time of the bus module master station in a response message, and broadcasting the response message to each of the bus module slave stations on the CAN bus;
[0040] A second correction module, used for controlling each of the bus modules to receive the response message from the station, and correcting the original propagation delay time according to the receiving timestamp of the response message and the sending timestamp of the synchronization calibration frame;
[0041] A second time error confirmation module, used for controlling each of the bus module slave stations to determine a second local time error of the bus module slave station;
[0042] The controlling each of the bus module slave stations to determine the second local time error of the bus module slave station comprises:
[0043] Control each of the bus module slave stations to determine a second local time error of the bus module slave station according to the local time of the bus module master station, the receiving timestamp of the response message and the original propagation delay time;
[0044] A synchronization verification module is used to determine the synchronization of automatic calibration according to a comparison result of the first local time error and the second local time error.
[0045] To solve the above technical problems, an embodiment of the present invention provides a bus communication module automatic calibration device, including: at least one processor, at least one memory and computer program instructions stored in the memory. When the computer program instructions are executed by the processor, the method of the first aspect in the above embodiment is implemented.
[0046] To solve the above technical problems, an embodiment of the present invention provides a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method of the first aspect in the above embodiment is implemented.
[0047] In summary, an embodiment of the present invention provides a method, device, equipment and storage medium for automatic calibration of a bus communication module. The present invention controls the synchronization controller of each bus module slave station to send a synchronization calibration frame to the bus module master station; controls the bus module master station to perform timing maintenance control on the synchronization calibration frame after receiving the synchronization calibration frame to restore the original sending order of the synchronization calibration frame; controls the bus module master station to extract the sending timestamp and original propagation delay time of the synchronization calibration frame; controls the bus module master station to correct the local time of the bus module master station according to the sending timestamp and the original propagation delay time; controls the bus module master station to obtain the total time according to the sending timestamp, the corrected local time of the bus module master station and the original propagation delay time. The first local time error of the bus module master station; control the bus module master station to encapsulate the first local time error and the corrected local time of the bus module master station in a response message, and broadcast the response message to each of the bus module slave stations on the CAN bus; control each of the bus module slave stations to receive the response message, and correct the original propagation delay time according to the receiving timestamp of the response message and the sending timestamp of the synchronization calibration frame; control each of the bus module slave stations to determine the second local time error of the bus module slave station; and judge the synchronization of automatic calibration according to the comparison result of the first local time error and the second local time error. Therefore, the present invention can realize automatic synchronization calibration of the bus communication module and improve the synchronization and reliability of the operation of the bus communication module. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solution of the embodiment of the present invention, the following briefly introduces the drawings required for use in the embodiment of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0049] Figure 1 The present invention is a flowchart of a method for automatically calibrating a bus communication module according to an embodiment of the present invention.
[0050] Figure 2 It is a flowchart of determining the synchronization of automatic calibration according to the comparison result of the first local time error and the second local time error according to an embodiment of the present invention.
[0051] Figure 3It is another flowchart diagram of an embodiment of the present invention for controlling the bus module master station to correct the local time of the bus module master station according to the sending timestamp and the original propagation delay time.
[0052] Figure 4 It is a flowchart of an embodiment of the present invention for controlling the bus module master station to obtain the first local time error of the bus module master station based on the sending timestamp, the corrected local time of the bus module master station and the original propagation delay time.
[0053] Figure 5 It is a schematic diagram of the structure of the automatic calibration device for a bus communication module according to an embodiment of the present invention.
[0054] Figure 6 It is a schematic diagram of the structure of a bus communication module automatic calibration device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0055] The features and exemplary embodiments of various aspects of the present invention will be described in detail below. In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and Examples. It should be understood that the specific embodiments described herein are only configured to explain the present invention and are not configured to limit the present invention. For those skilled in the art, the present invention can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present invention by illustrating examples of the present invention.
[0056] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0057] See also Figure 1 , Figure 1 A bus communication module automatic calibration method provided in this application comprises the following steps:
[0058] S1. The synchronization controller of each bus module slave station controls the bus module master station to send a synchronization calibration frame.
[0059] Specifically, in this embodiment, the bus module includes a bus module master station and a bus module slave station. The bus module master station is a control node in the network, which is used to manage the communication and operation of the network and to exchange data with each bus module slave station. The bus module slave station is a controlled node in the network, which is used to respond to the command of the master station and perform specific tasks. The bus module master station and the bus module slave station are in a one-to-many relationship.
[0060] Specifically, in this embodiment, the bus module master station, each bus module slave station and the PLC system are connected to each other through the CAN bus. On the CAN (Controller Area Network) bus, each bus module slave station on each node is provided with a synchronization controller, which is used to ensure the time synchronization between the nodes.
[0061] It can be understood that the synchronization calibration frame is a special data frame, which contains timestamp information for synchronizing nodes. The synchronization controller of each bus module slave station sends the synchronization calibration frame to the CAN bus periodically or when a specific event occurs.
[0062] S2. After receiving the synchronization calibration frame, the control bus module master station performs timing maintenance control on the synchronization calibration frame to restore the original sending order of the synchronization calibration frame.
[0063] Specifically, in this embodiment, a centralized controller is provided in the bus module master station. The centralized controller serves as a central node in the network and is used to receive synchronization calibration frames from various synchronization controllers and process the time information in the synchronization calibration frames to achieve time synchronization of the entire network.
[0064] Specifically, in this embodiment, since the sending order of data frames may change due to network congestion, priority competition, etc. during the sending process, the centralized controller in the bus module master station needs to restore the original sending order of the data frames through timing maintenance, so that the order of messages received by the centralized controller is consistent with the sending order of the messages, to ensure that the data frames are processed in the correct order.
[0065] S3. The control bus module master station extracts the sending timestamp and original propagation delay time of the synchronization calibration frame.
[0066] Specifically, each bus module slave station sends the sending timestamp TimeA of the synchronization calibration frame and the original propagation delay time T / 2 detected by each bus module slave station to the bus module master station. Among them, the sending timestamp TimeA is the local time of each bus module slave station. When each bus module slave station sends the synchronization calibration frame, the local timestamp TimeA is included in the message; the original propagation delay time T is the transmission delay from the bus module slave station to the bus module master station, that is, the time required for the bus module slave station to receive the response message after the message sent by each bus module slave station arrives at the bus module master station and the bus module master station sends a response message to the bus module slave station.
[0067] S4. Control the bus module master station to correct the local time of the bus module master station according to the sending timestamp and the original propagation delay time.
[0068] Specifically, in this embodiment, the bus module master station estimates the theoretical time of the bus module master station when the bus module master station receives the synchronization calibration frame based on the sending timestamp and the original propagation delay time, and further corrects the local time of the bus module master station based on the theoretical local time.
[0069] S5. Control the bus module master station to obtain a first local time error of the bus module master station according to the sending timestamp, the corrected local time of the bus module master station and the original propagation delay time.
[0070] Specifically, in this embodiment, the bus module master station first estimates the theoretical time for the synchronization calibration frame to arrive at the bus module master station based on the sending timestamp TimeA of the synchronization calibration frame and the original propagation delay time T / 2; further, the bus module master station obtains the first local time error D1 of the bus module master station based on the theoretical time and the local time of the bus module when the synchronization calibration frame is received.
[0071] Specifically, in this embodiment, the sending timestamp TimeA=counter CountA+time offset OffsetA; wherein, counter CountA is the local clock counter value of each bus module slave station, which is a continuously increasing value and represents the local time of each bus module slave station; OffsetA is the difference between the local clock of each bus module slave station and the reference clock, and the difference comes from clock drift, temperature change or other factors. OffsetA is used for each bus module slave station to adjust the local time to keep it consistent with the reference clock. During the time calibration process, OffsetA usually needs to be updated regularly to compensate for clock drift.
[0072] S6. Control the bus module master station to encapsulate the first local time error and the corrected local time of the bus module master station in a response message, and broadcast the response message to each bus module slave station on the CAN bus.
[0073] Specifically, in this embodiment, the bus module master station encapsulates the first local time error D1 and the local time TimeB of the bus module master station in a response message and sends it to each bus module slave station, wherein the local time TimeB of the bus module master station is the corrected local time when the bus module master station receives the synchronization calibration frame.
[0074] Specifically, in this embodiment, local time TimeB=counter CountB+time deviation OffsetB; wherein counter CountB is the local clock counter value of the bus module master station, which is a continuously increasing value and represents the local time of the bus module master station; OffsetB is the difference between the local clock of the bus module master station and the reference clock, and the difference comes from clock drift, temperature change or other factors. OffsetB is used by the bus module master station to adjust the local time to keep it consistent with the reference clock. During the time calibration process, OffsetB usually needs to be updated regularly to compensate for clock drift.
[0075] S7. Control each bus module to receive a response message from the station, and correct the original propagation delay time according to the receiving timestamp of the response message and the sending timestamp of the synchronization calibration frame.
[0076] Specifically, in this embodiment, after each bus module slave station receives a response message, it corrects the original propagation delay of the entire transportation system through the reception time TimerA' of the response message, so that the corrected original propagation delay time can be sent to the bus module master station during the next message transmission to perform correct time information calibration.
[0077] S8. Control each bus module slave station to determine the second local time error of the bus module slave station.
[0078] S9. Determine the synchronization of the automatic calibration according to the comparison result of the first local time error and the second local time error.
[0079] Specifically, in this embodiment, the bus module master station sends the local time TimerB and the first local time error D1 to each bus module slave station, and the bus module slave station calculates the second local time error of the bus module slave station based on the local time TimerB and the first local time error D1 of the bus module master station. On the one hand, each bus module slave station can perform a consistency check on the error calibration of the bus module master station to verify the synchronization of the time calibration between the bus module master station and the bus module slave station; on the other hand, after each bus module slave station confirms the second local time error of the bus module slave station, the local clock of each bus module slave station can be adjusted according to the error to eliminate the time difference between the nodes. Therefore, the present application can ensure the accuracy of the bus module calibration and the synchronization of the calibration between the bus module master station and the slave station.
[0080] In summary, the present application provides a method for automatic calibration of a bus communication module. In this scheme, the synchronization controller of each bus module slave station is controlled to send a synchronization calibration frame to the bus module master station; the bus module master station is controlled to perform timing maintenance control on the synchronization calibration frame after receiving the synchronization calibration frame to restore the original sending order of the synchronization calibration frame, ensure the accuracy of communication, and effectively avoid errors caused by timing deviations in the transmission process; the bus module master station is controlled to extract the sending timestamp and original propagation delay time of the synchronization calibration frame; the bus module master station is controlled to correct the local time of the bus module master station according to the sending timestamp and the original propagation delay time; the bus module master station is controlled to obtain the first local time error of the bus module master station according to the sending timestamp, the corrected local time of the bus module master station and the original propagation delay time, so that the bus module master station can The error between the theoretical time and the actual time of the message arrival is clarified; the bus module master station is controlled to encapsulate the first local time error and the corrected local time of the bus module master station in the response message, and the response message is broadcasted to each bus module slave station on the CAN bus, ensuring that the slave station can receive the time error information of the master station, and providing a basis for subsequent time synchronization; each bus module slave station is controlled to receive the response message, and the original propagation delay time is corrected according to the receiving timestamp of the response message and the sending timestamp of the synchronization calibration frame, so as to ensure the consistency of time during the next message transmission; each bus module slave station is controlled to determine the second local time error of the bus module master station; the synchronization of automatic calibration is judged according to the comparison result of the first local time error and the second local time error, so as to ensure the time synchronization of the master station and the slave station, and improve the accuracy of communication. Therefore, the present invention can not only realize the time calibration of the bus module master station and the bus module slave station respectively, but also ensure the synchronization of calibration between the bus module master station and the bus module slave station, and improve the synchronization and reliability of the operation of the bus communication module.
[0081] Based on the above embodiments:
[0082] See also Figure 2 , Figure 2 A schematic diagram of a flow chart of determining the synchronization of automatic calibration according to a comparison result of a first local time error and a second local time error provided by the present application.
[0083] Determining the synchronization of the automatic calibration according to the comparison result of the first local time error and the second local time error includes:
[0084] S91, determining whether the first local time error and the second local time error are the same;
[0085] Specifically, in this embodiment, after the bus module slave station sends the synchronization calibration frame to the bus module master station, the bus module master station estimates the theoretical time for the synchronization calibration frame to arrive at the bus module master station based on the sending timestamp of the synchronization calibration frame and the original propagation delay time, and then compares the theoretical time with the local time of the bus module master station to obtain the first local time error of the bus module master station, which is the error calculated at the bus module master station.
[0086] Specifically, in this embodiment, the bus module master station encapsulates the first local time error D1 and the local time TimerB, that is, the receiving timestamp information of the synchronization calibration frame in the bus module master station and sends it to the bus module slave station. The bus module slave station estimates the theoretical time for the response message to arrive at the bus module slave station based on the receiving timestamp of the response message and the original propagation delay time, and then compares the theoretical time with the local time of the bus module slave station to obtain the second local time error of the bus module slave station, which is the error calculated at the bus module slave station end.
[0087] Furthermore, the bus module slave station determines whether the first local time error reported by the bus module master station is consistent with the second local time error confirmed by the bus module slave station, which is equivalent to the difference between the local time of the bus master station and the theoretical arrival time when the synchronization calibration frame arrives at the bus module master station from the perspective of the bus module slave station. If the two are the same or close from the perspective of the bus module master station and the perspective of the bus module slave station, this indicates that the time synchronization calibration is effective.
[0088] S92: If the first local time error and the second local time error are the same, it is determined that the automatic calibration is successful.
[0089] Therefore, the present application can perform bidirectional verification, effectively ensuring the synchronization of time calibration.
[0090] As a preferred embodiment, controlling each bus module slave station to obtain the second local time error of the bus module slave station includes:
[0091] Each bus module slave station is controlled to determine a second local time error of the bus module slave station according to the local time TimeB of the bus module master station, the receiving timestamp TimerA' of the response message and the original propagation delay time T.
[0092] Specifically, in this embodiment, the bus module slave station first estimates the theoretical time (TimerB + T / 2) for the response message to arrive at the bus module slave station based on the local time TimeB and the original propagation delay time T; further, the bus module slave station obtains a second local time error (TimerA'-TimerB + T / 2) based on the theoretical time and the local clock of the bus module slave station when the response message is received.
[0093] See also Figure 3 , Figure 3 A schematic diagram of a flow chart of controlling a bus module master station to correct the local time of the bus module master station according to a sending timestamp and an original propagation delay time provided by the present application.
[0094] S41, controlling the bus module master station to obtain the time deviation according to the sending timestamp, the local clock counter value of the bus module master station and the original propagation delay time.
[0095] S42, controlling the bus module master station to correct the local time of the bus module master station according to the local clock counter value and the time deviation.
[0096] As a preferred embodiment, in controlling the bus module master station to obtain the time deviation according to the sending timestamp of the synchronization calibration frame, the local clock counter value of the bus module master station and the original propagation delay time, the time deviation is:
[0097] Time offset OffsetB = (sending timestamp TimeA + original propagation delay time T / 2 - counter time CountB of the bus module master).
[0098] Specifically, in this embodiment, the time offset OffsetB is used to adjust the local clock of the bus module master station to achieve time synchronization with the bus module slave station.
[0099] Specifically, the bus module master station first estimates the theoretical time for the synchronization calibration frame to arrive at the bus module master station based on the sending timestamp TimeA of the synchronization calibration frame and the original propagation delay time T / 2. Since the transmission delay is symmetrical, T / 2 represents the transmission delay from the synchronization calibration frame bus module slave station to the bus module master station.
[0100] Specifically, CountB represents the local clock counter value recorded by the bus module master when receiving the synchronization calibration frame. Subtracting TimerA + T / 2 from CountB, that is, (TimerA + T / 2) - CountB, can obtain the time offset OffsetB of the bus module master, which represents the difference between the local clock counter value of the bus module master and the theoretical local time when the bus module slave sends the synchronization calibration frame.
[0101] Specifically, in this embodiment, if OffsetB is a positive value, the local clock of the bus module is slower than the theoretical time, which means that the local clock of the bus module needs to be adjusted forward. If OffsetB is a negative value, the local clock of the bus module is faster than the theoretical time, which means that the local clock of the bus module needs to be adjusted backward.
[0102] See also Figure 4 , Figure 4The present application provides a flow chart for controlling a bus module master station to obtain a first local time error of the bus module master station according to a sending timestamp, a corrected local time of the bus module master station and an original propagation delay time.
[0103] As a preferred embodiment, controlling the bus module master station to extract the sending timestamp and the original propagation delay time of the synchronization calibration frame, and obtaining the first local time error of the bus module master station according to the sending timestamp and the original propagation delay time includes:
[0104] S51, obtaining the original propagation delay time;
[0105] S52, calculating a first local time error according to the original propagation delay time, the sending timestamp and the local time;
[0106] Among them, the first local time error D1=(sending timestamp TimerA+original propagation delay time / 2-local time TimerB).
[0107] As a preferred embodiment, controlling each bus module to receive a response message from a station, and correcting the original propagation delay time according to a receiving timestamp of the response message and a sending timestamp of a synchronization calibration frame includes:
[0108] The corrected original propagation delay time = the receiving timestamp of the response message - the sending timestamp of the synchronization calibration frame.
[0109] Among them, the original propagation delay time T' (= TimerA' - TimerA) is corrected. It can be understood that the purpose of correcting the original propagation delay of the entire transmission system is to ensure the time synchronization of all devices in the network in subsequent message transmission, ensure data consistency, and improve system stability.
[0110] As a preferred embodiment, controlling each bus module slave station to determine the second local time error of the bus module master station according to the local time of the bus module master station and the receiving timestamp information of the response message includes:
[0111] The second local time error D2 = (the receiving timestamp of the response message TimerA' - the local time TimerB + the original propagation delay time T / 2).
[0112] Specifically, in this embodiment, the first local time error D1=(sending timestamp TimerA of the synchronization calibration frame+original propagation delay time / 2-local time TimerB).
[0113] Specifically, in the calculation of the first local time error D1, TimerA is the timestamp when the synchronization calibration frame is sent, and TimerB is the timestamp when the synchronization calibration frame is received.
[0114] Specifically, in the calculation of the second local time error D2, TimerA' is the timestamp when the response message is received, and TimerB is the timestamp when the response message is sent.
[0115] It can be understood that the first local time error D1 and the second local time error D2 are measuring the same time deviation, but from different endpoints, so theoretically the values of the first local time error D1 and the second local time error D2 are the same. Therefore, the present application evaluates the accuracy of time synchronization by comparing the values of the first local time error D1 and the second local time error D2, and has high reliability.
[0116] See also Figure 5 , Figure 5 A schematic diagram of the structure of a bus communication module automatic calibration device provided in this application.
[0117] An embodiment of the present invention provides a bus communication module automatic calibration device, the device comprising:
[0118] A synchronization frame sending module 1, used to control the synchronization controller of each bus module slave station to send a synchronization calibration frame to the bus module master station;
[0119] The timing control module 2 is used to control the bus module master station to perform timing control on the synchronization calibration frame after receiving the synchronization calibration frame, so as to restore the original sending order of the synchronization calibration frame;
[0120] Information extraction module 3, used to control the bus module master station to extract the sending timestamp and original propagation delay time of the synchronization calibration frame;
[0121] A first correction module 4, used to control the bus module master station to correct the local time of the bus module master station according to the sending timestamp and the original propagation delay time;
[0122] A first time error confirmation module 5, used to control the bus module master station to obtain a first local time error of the bus module master station according to the sending timestamp, the corrected local time of the bus module master station and the original propagation delay time;
[0123] The broadcast module 6 is used to control the bus module master station to encapsulate the first local time error and the corrected local time of the bus module master station in a response message, and broadcast the response message to each bus module slave station on the CAN bus;
[0124] A second correction module 7, used for controlling each bus module to receive a response message from the station, and correcting the original propagation delay time according to the receiving timestamp of the response message and the sending timestamp of the synchronization calibration frame;
[0125] A second time error confirmation module 8, used for controlling each bus module slave station to determine a second local time error of the bus module slave station;
[0126] The controlling each of the bus module slave stations to determine the second local time error of the bus module slave station comprises:
[0127] Control each of the bus module slave stations to determine a second local time error of the bus module slave station according to the local time of the bus module master station, the receiving timestamp of the response message and the original propagation delay time;
[0128] The synchronization checking module 9 is used to determine the synchronization of the automatic calibration according to the comparison result of the first local time error and the second local time error.
[0129] In addition, combined Figure 1 The bus communication module automatic calibration method described in the embodiment of the present invention can be implemented by a network bus communication module automatic calibration device. Figure 6 A schematic diagram of the hardware structure of a bus communication module automatic calibration device provided in an embodiment of the present invention is shown.
[0130] The bus communication module automatic calibration device may include a processor 401 and a memory 402 storing computer program instructions.
[0131] Specifically, the processor 401 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiment of the present invention.
[0132] The memory 402 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 402 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. Where appropriate, the memory 402 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 402 may be inside or outside the data processing device. In a specific embodiment, the memory 402 is a non-volatile solid-state memory. In a specific embodiment, the memory 402 includes a read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM) or a flash memory or a combination of two or more of these.
[0133] The processor 401 reads and executes the computer program instructions stored in the memory 402 to implement any one of the bus communication module automatic calibration methods in the above embodiments.
[0134] In one example, the bus communication module automatic calibration device may further include a communication interface 403 and a bus 410. Figure 6 As shown, the processor 401, the memory 402, and the communication interface 403 are connected via a bus 410 and communicate with each other.
[0135] The communication interface 403 is mainly used to implement the communication between the modules, devices, units and / or equipment in the embodiment of the present invention.
[0136] Bus 410 includes hardware, software or both, and couples the components of the bus communication module automatic calibration device to each other. For example, but not limitation, the bus may include an accelerated graphics port (AGP) or other graphics bus, an enhanced industrial standard architecture (EISA) bus, a front-side bus (FSB), a hypertransport (HT) interconnection, an industrial standard architecture (ISA) bus, an infinite bandwidth interconnection, a low pin count (LPC) bus, a memory bus, a microchannel architecture (MCA) bus, a peripheral component interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a serial advanced technology attachment (SATA) bus, a video electronics standard association local (VLB) bus or other suitable bus or a combination of two or more of these. Where appropriate, bus 410 may include one or more buses. Although the embodiments of the present invention describe and illustrate a specific bus, the present invention contemplates any suitable bus or interconnection.
[0137] In addition, in combination with a bus communication module automatic calibration method in the above embodiment, an embodiment of the present invention can provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any bus communication module automatic calibration method in the above embodiment is implemented.
[0138] It should also be noted that the exemplary embodiments mentioned in the present invention describe some methods or systems based on a series of steps or devices. However, the present invention is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiments, or in a different order from the embodiments, or several steps can be performed simultaneously.
[0139] The above is only a specific implementation of the present invention. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present invention is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be covered within the protection scope of the present invention.
Claims
1. A bus communication module automatic calibration method, characterized in that: The bus communication module automatic calibration method comprises: The synchronization controller controlling each bus module slave station sends a synchronization calibration frame to the bus module master station; Controlling the bus module master station to perform timing maintenance control on the synchronization calibration frame after receiving the synchronization calibration frame, so as to restore the original sending order of the synchronization calibration frame; Control the bus module master station to extract the sending timestamp and original propagation delay time of the synchronization calibration frame; Controlling the bus module master station to correct the local time of the bus module master station according to the sending timestamp and the original propagation delay time; Control the bus module master station to obtain a first local time error of the bus module master station according to the sending timestamp, the corrected local time of the bus module master station and the original propagation delay time; Control the bus module master station to encapsulate the first local time error and the corrected local time of the bus module master station in a response message, and broadcast the response message to each of the bus module slave stations on the CAN bus; Control each of the bus modules to receive the response message from the station, and correct the original propagation delay time according to the receiving timestamp of the response message and the sending timestamp of the synchronization calibration frame; Control each of the bus module slave stations to determine a second local time error of the bus module slave station; determining the synchronization of the automatic calibration according to a comparison result of the first local time error and the second local time error; The controlling each of the bus module slave stations to determine the second local time error of the bus module slave station comprises: Control each of the bus module slave stations to determine a second local time error of the bus module slave station according to the local time of the bus module master station, the receiving timestamp of the response message and the original propagation delay time.
2. A bus communication module automatic calibration method according to claim 1, characterized in that: The determining the synchronization of the automatic calibration according to the comparison result of the first local time error and the second local time error comprises: Determining whether the first local time error and the second local time error are the same; If the first local time error and the second local time error are the same, it is determined that the automatic calibration is successful.
3. A bus communication module automatic calibration method according to claim 1, characterized in that: The controlling the bus module master station to correct the local time of the bus module master station according to the sending timestamp and the original propagation delay time comprises: Control the bus module master station to obtain the time deviation according to the sending timestamp, the local clock counter value of the bus module master station and the original propagation delay time; The bus module master station is controlled to correct the local time of the bus module master station according to the local clock counter value and the time deviation.
4. A bus communication module automatic calibration method according to claim 1, characterized in that: The controlling the bus module master station to obtain a first local time error of the bus module master station according to the sending timestamp, the corrected local time of the bus module master station and the original propagation delay time comprises: Obtaining the original propagation delay time; Calculating the first local time error according to the original propagation delay time, the sending timestamp and the local time of the bus module master station; The first local time error=the sending timestamp+the original propagation delay time / 2-the local time of the bus module master station.
5. A bus communication module automatic calibration method according to claim 4, characterized in that: In controlling the bus module master station to obtain the time deviation according to the sending timestamp of the synchronization calibration frame, the local clock counter value of the bus module master station and the original propagation delay time, the time deviation is: The time deviation=the sending timestamp+the original propagation delay time / 2-the local clock counter value of the bus module master station.
6. A bus communication module automatic calibration method according to claim 1, characterized in that: The controlling each of the bus modules to receive the response message from the station, and correcting the original propagation delay time according to the receiving timestamp of the response message and the sending timestamp of the synchronization calibration frame comprises: Corrected original propagation delay time=receiving timestamp of the response message−sending timestamp of the synchronization calibration frame.
7. A bus communication module automatic calibration device, characterized in that: The device comprises: A synchronization frame sending module, used to control the synchronization controller of each bus module slave station to send a synchronization calibration frame to the bus module master station; A timing control module, used for controlling the bus module master station to perform timing control on the synchronization calibration frame after receiving the synchronization calibration frame, so as to restore the original sending order of the synchronization calibration frame; An information extraction module, used for controlling the bus module master station to extract the sending timestamp and original propagation delay time of the synchronization calibration frame; A first correction module, used for controlling the bus module master station to correct the local time of the bus module master station according to the sending timestamp and the original propagation delay time; A first time error confirmation module, used for controlling the bus module master station to obtain a first local time error of the bus module master station according to the sending timestamp, the corrected local time of the bus module master station and the original propagation delay time; A broadcast module, used for controlling the bus module master station to encapsulate the first local time error and the corrected local time of the bus module master station in a response message, and broadcasting the response message to each of the bus module slave stations on the CAN bus; A second correction module, used for controlling each of the bus modules to receive the response message from the station, and correcting the original propagation delay time according to the receiving timestamp of the response message and the sending timestamp of the synchronization calibration frame; A second time error confirmation module, used for controlling each of the bus module slave stations to determine a second local time error of the bus module slave station; The controlling each of the bus module slave stations to determine the second local time error of the bus module slave station comprises: Control each of the bus module slave stations to determine a second local time error of the bus module slave station according to the local time of the bus module master station, the receiving timestamp of the response message and the original propagation delay time; A synchronization verification module is used to determine the synchronization of automatic calibration according to a comparison result of the first local time error and the second local time error.
8. A bus communication module automatic calibration device, characterized in that: include: At least one processor, at least one memory and computer program instructions stored in the memory, when the computer program instructions are executed by the processor, implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.
