Time synchronization method and device based on acknowledgement frame piggybacking timestamp, storage medium and electronic equipment
By using acknowledgment frames to piggyback timestamps in wireless communication, the high overhead and resource waste problems of time synchronization in wireless communication are solved, achieving high-precision, low-overhead time synchronization and improving synchronization frequency and accuracy.
Patent Information
- Application Number
- CN202511761599.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-02-27
AI Technical Summary
In wireless communication, existing time synchronization methods suffer from high interaction overhead and resource waste. In particular, when time synchronization is performed using application layer protocols or dedicated data frames in wireless communication, the frame header overhead occupies too much air time, affecting synchronization accuracy and efficiency.
By using acknowledgment frames to piggyback timestamps in wireless communication, the sending and receiving devices record and insert timestamps during data frame interaction, calculate time differences to achieve time synchronization, and reduce additional frame header overhead.
It achieves high-precision, low-overhead time synchronization, seamlessly integrating the synchronization process with data communication, saving valuable wireless channel resources, and improving the frequency and accuracy of time synchronization.
Smart Images

Figure CN121585302A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of time synchronization between wireless communication devices, and more specifically, to a time synchronization method, apparatus, storage medium, and electronic device based on acknowledgment frames piggybacked with timestamps. Background Technology
[0002] In modern communication and industrial applications, time synchronization between devices is crucial. In wired networks, high-precision time synchronization is usually achieved using the Precision Time Protocol (PTP). This protocol implements hardware timestamps through Ethernet frame interaction. As an IP layer protocol, its direct application in wireless communication has the following two drawbacks: (1) Wireless communication usually uses an active acknowledgment method to send and receive each data packet. That is, after the sender sends a data packet, the receiver needs to explicitly reply with an acknowledgment frame (i.e., Ack frame). Each PTP data frame interaction is amplified into four frames in wireless communication: request to send, response to send, data frame, and acknowledgment frame, which is very expensive; (2) In addition, in wireless communication based on CSMA / CA contention channels, the uncertainty of the channel contention process itself breaks the assumption of the same bidirectional data delay in PTP, which will greatly affect the time synchronization accuracy.
[0003] Furthermore, in the WiFi protocol, 802.11mc is a distance measurement protocol that completes ranging through precise time measurement. It uses dedicated request and response frames at the MAC (Medium Access Control) layer to complete time measurement. While this saves the overhead of the aforementioned data frame interaction process, it still incurs frame header overhead due to its use of separate frames for communication. Considering that timestamps are typically data within 8 bytes, using separate frames for synchronization results in a significant waste of resources because the airtime occupied by the physical layer frame header and MAC frame header is far greater than the airtime occupied by the actual data.
[0004] Therefore, we urgently need to develop a new high-precision, low-overhead time synchronization method. Summary of the Invention
[0005] The present invention aims to solve the problems of high interaction overhead and competition for communication resources with service data when using application layer protocols or dedicated data frames for time synchronization in wireless communication networks.
[0006] Therefore, in view of the shortcomings of the existing technology, the first objective of the present invention is to provide a time synchronization method for a transmitting device based on an acknowledgment frame piggybacked with a timestamp.
[0007] A second objective of this invention is to provide a time synchronization method for receiving devices based on acknowledgment frames carrying timestamps.
[0008] A third objective of this invention is to provide a time synchronization device for a transmitting device based on an acknowledgment frame piggybacked with a timestamp.
[0009] A fourth objective of this invention is to provide a time synchronization device for a receiving device based on an acknowledgment frame piggybacked with a timestamp.
[0010] The fifth objective of this invention is to provide a computer-readable storage medium in which a computer program, when executed by a processor, implements the steps of the time synchronization method for a transmitting device based on an acknowledgment frame piggybacked timestamp, as described in any of the above technical solutions.
[0011] The sixth objective of this invention is to provide an electronic device in which the processor of the electronic device executes a computer program to implement the steps of the time synchronization method for a transmitting device based on an acknowledgment frame piggybacked with a timestamp, as described in any of the above technical solutions.
[0012] A seventh objective of the present invention is to provide a computer-readable storage medium in which a computer program, when executed by a processor, implements the steps of the time synchronization method for a receiving device based on an acknowledgment frame piggybacked timestamp as described in any of the above technical solutions.
[0013] The eighth objective of this invention is to provide an electronic device in which the processor of the electronic device executes a computer program to implement the steps of the time synchronization method for receiving devices based on acknowledgment frames piggybacked with timestamps as described in any of the above technical solutions.
[0014] To achieve the above objectives, the first aspect of the present invention provides a time synchronization method for a transmitting device based on an acknowledgment frame piggybacked with a timestamp. The transmitting device interacts with a receiving device via a wireless communication network. The time synchronization method includes: Step S101: When the sending device sends any data frame to the receiving device, calculate and record the start transmission time of each data frame as T1; Step S102: When the sending device receives an acknowledgment frame sent by the receiving device, record the start reception time of the acknowledgment frame under the local clock of the sending device as T4, and extract the two timestamps T2 and T3 inserted by the receiving device in the acknowledgment frame; wherein, timestamp T2 is the start reception time of the corresponding data frame sent by the sending device under the local clock of the receiving device; timestamp T3 is the start transmission time of the acknowledgment frame under the local clock of the receiving device; Step S103: Based on the data frame transmission time T1, timestamp T2, timestamp T3 and acknowledgment frame reception time T4, calculate the time difference Offset between the local clock of the sending device and the local clock of the receiving device; Step S104: Transfer the time difference Offset to a high-precision clock to perform corresponding time compensation on the high-precision clock, so as to finally achieve time synchronization between the sending device and the receiving device.
[0015] Preferably, step S101 specifically involves: when the sending device sends any data frame to the receiving device, calculating the transmission time of each data frame based on the transmission parameters, the local clock of the sending device, and the hardware processing delay of the transmission data link of the sending device, and recording the transmission time of each data frame as T1.
[0016] Preferably, step S103 specifically includes: Step S1031: Calculate the loop delay time RTT for data interaction between the sending device and the receiving device based on the data frame transmission time T1, timestamp T2, timestamp T3, and acknowledgment frame reception time T4; wherein the expression for the loop delay time RTT is: RTT=(T4-T1)-(T3-T2); Step S1032: Calculate the one-way propagation delay time ToF for data interaction between the sending device and the receiving device based on the loop delay time RTT; wherein the expression for the one-way propagation delay time ToF is: ToF=RTT / 2; Step S1033: Calculate the time difference Offset between the local clock of the sending device and the local clock of the receiving device based on the one-way propagation delay time ToF; wherein the expression for the time difference Offset is Offset=(T2-T1)-ToF.
[0017] A second aspect of the present invention also provides a time synchronization method for a receiving device based on an acknowledgment frame piggybacked with a timestamp. The receiving device interacts with the sending device via a wireless communication network.
[0018] The time synchronization method includes: Step S201: When the receiving device begins to receive any data frame sent by the sending device, record the start time of receiving the arbitrary data frame under the local clock of the receiving device as T2; Step S202: After the receiving device finishes receiving the arbitrary data frame, it begins to prepare a reply acknowledgment frame; Step S203: Calculate and record the start time of sending the acknowledgment frame under the local clock of the receiving device as T3; Step S204: Insert the acknowledgment frame sending time T3 and the data frame receiving time T2 into the acknowledgment frame, and send it to the sending device, so that the sending device can record the start time of receiving the acknowledgment frame under the local clock of the sending device as T4, and extract the two timestamps T2 and T3 inserted by the receiving device in the acknowledgment frame.
[0019] Preferably, step S203 specifically involves: calculating the start time of the confirmation frame under the local clock of the receiving device based on the transmission parameters of the confirmation frame, the local clock of the receiving device, and the hardware processing delay of the transmission data link of the receiving device, and recording the start time of the confirmation frame under the local clock of the receiving device as T3.
[0020] The third aspect of the present invention also provides a time synchronization device for a transmitting device based on an acknowledgment frame piggybacked with a timestamp. The transmitting device interacts with a receiving device via a wireless communication network. The time synchronization device includes: a data frame transmission time calculation unit, used to calculate and record the start transmission time of each data frame as T1 when the transmitting device sends any data frame to the receiving device; an acknowledgment frame timestamp extraction unit, used to record the start reception time of the acknowledgment frame under the local clock of the transmitting device as T4 when the transmitting device receives the acknowledgment frame sent by the receiving device, and extract two timestamps T2 and T3 inserted by the receiving device in the acknowledgment frame; wherein, timestamp T2 is the start reception time of the corresponding data frame sent by the transmitting device under the local clock of the receiving device; timestamp T3 is the start transmission time of the acknowledgment frame under the local clock of the receiving device; a time difference calculation unit, used to calculate the time difference Offset between the local clock of the transmitting device and the local clock of the receiving device based on the data frame transmission time T1, timestamp T2, timestamp T3 and acknowledgment frame reception time T4; and a time compensation unit, used to transfer the time difference Offset to a high-precision clock to perform corresponding time compensation on the high-precision clock, so as to ultimately achieve time synchronization between the transmitting device and the receiving device.
[0021] The fourth aspect of the present invention also provides a time synchronization device for a receiving device based on an acknowledgment frame piggybacked with a timestamp. The receiving device interacts with a sending device via a wireless communication network. The time synchronization device includes: a data frame reception time recording unit, used to record the start reception time of the corresponding data frame under the local clock of the receiving device as T2 when the receiving device begins to receive the corresponding data frame sent by the sending device; an acknowledgment frame preparation unit, used to prepare a reply acknowledgment frame after the receiving device has finished receiving the corresponding data frame; an acknowledgment frame transmission time calculation unit, used to calculate and record the start transmission time of the acknowledgment frame under the local clock of the receiving device as T3; and an acknowledgment frame timestamp insertion unit, used to insert the acknowledgment frame transmission time T3 and the data frame reception time T2 into the acknowledgment frame and send it to the sending device, so that the sending device can record the start reception time T4 of the acknowledgment frame under the local clock of the sending device and extract the two timestamps T2 and T3 inserted by the receiving device into the acknowledgment frame.
[0022] The fifth aspect of the present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the time synchronization method for a transmitting device based on an acknowledgment frame piggybacking timestamp as described in any of the above technical solutions.
[0023] The sixth aspect of the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the time synchronization method for a transmitting device based on an acknowledgment frame piggybacking timestamp as described in any of the above technical solutions.
[0024] The seventh aspect of the present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the time synchronization method for a receiving device based on an acknowledgment frame piggybacking timestamp as described in any of the above technical solutions.
[0025] The eighth aspect of the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the time synchronization method for a receiving device based on an acknowledgment frame piggybacking timestamp as described in any of the above technical solutions.
[0026] The time synchronization method, apparatus, storage medium, and electronic device based on confirmation frames piggybacked with timestamps provided by this invention have the following beneficial technical effects: (1) Greatly reduces synchronization overhead: The timestamp of this invention is used as additional information in the acknowledgment frame, which hardly generates any additional frame header overhead, thus greatly saving valuable wireless channel resources; (2) Achieves efficient and seamless integration: This invention can be seamlessly integrated with existing data communication processes. When node A needs to send data to node B, a high-precision time synchronization can be completed simultaneously, eliminating the need to maintain an independent, periodic synchronization session, thus improving the overall efficiency of the system.
[0027] Additional aspects and advantages of the invention will become apparent from the description which follows, or may be learned by practice of the invention. Attached Figure Description
[0028] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.
[0029] Figure 1 A schematic flowchart of a time synchronization method based on acknowledgment frame piggyback timestamps for a transmitting device according to an embodiment of the present invention is shown. Figure 2 A schematic flowchart of a time synchronization method based on acknowledgment frame piggyback timestamp for a receiving device according to an embodiment of the present invention is shown. Figure 3 A schematic diagram of the MAC hardware with added time synchronization function according to an embodiment of the present invention is shown. Detailed Implementation
[0030] To better understand the above-mentioned objects, features, and advantages of the present invention, such as Figures 1 to 3 As shown in the accompanying drawings and specific embodiments, the present invention will be further described in detail below. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.
[0031] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and therefore the scope of protection of the invention is not limited to the specific embodiments disclosed below.
[0032] Figure 1 A schematic flowchart illustrating an embodiment of the present invention is shown for a time synchronization method based on acknowledgment frame piggybacking timestamps for a transmitting device. The transmitting device interacts with the receiving device via a wireless communication network. Figure 1 As shown, the time synchronization method includes: Step S101: When the sending device sends any data frame to the receiving device, calculate and record the start time of each data frame as T1; Step S102: When the sending device receives the acknowledgment frame sent by the receiving device, it records the start time of receiving the acknowledgment frame under the local clock of the sending device as T4, and extracts the two timestamps T2 and T3 inserted by the receiving device in the acknowledgment frame; wherein, timestamp T2 is the start time of receiving the corresponding data frame sent by the sending device under the local clock of the receiving device; timestamp T3 is the start time of sending the acknowledgment frame under the local clock of the receiving device; Step S103: Based on the data frame transmission time T1, timestamp T2, timestamp T3 and acknowledgment frame reception time T4, calculate the time difference Offset between the local clock of the sending device and the local clock of the receiving device; Step S104: Transfer the time difference Offset to the high-precision clock to perform corresponding time compensation on the high-precision clock, so as to finally achieve time synchronization between the transmitting end device and the receiving end device.
[0033] In this embodiment, compared to the method of using a dedicated time synchronization frame, the transmitting device of the present invention achieves time synchronization by piggybacking a high-precision timestamp on the acknowledgment frame of an existing data frame, without frame header overhead, thus saving valuable air time. At the same time, the time synchronization process is carried out along with the existing service data stream, rather than through independent data interaction, which enables high-frequency time synchronization with almost no impact on service communication, further improving the time synchronization accuracy.
[0034] In one embodiment of the present invention, step S101 specifically involves: when the transmitting device sends any data frame to the receiving device, calculating the transmission time of each data frame based on the transmission parameters, the local clock of the transmitting device, and the hardware processing delay of the transmission data link of the transmitting device, and recording the transmission time of each data frame as T1.
[0035] In one embodiment of the present invention, step S103 specifically includes: Step S1031: Calculating the loop delay time RTT for data interaction between the sending device and the receiving device based on the data frame transmission time T1, timestamp T2, timestamp T3, and acknowledgment frame reception time T4; wherein the expression for the loop delay time RTT is: RTT=(T4-T1)-(T3-T2); Step S1032: Calculating the one-way propagation delay time ToF for data interaction between the sending device and the receiving device based on the loop delay time RTT; wherein the expression for the one-way propagation delay time ToF is: ToF=RTT / 2; Step S1033: Calculating the time difference Offset between the local clock of the sending device and the local clock of the receiving device based on the one-way propagation delay time ToF; wherein the expression for the time difference Offset is Offset=(T2-T1)-ToF.
[0036] Figure 2 A schematic flowchart illustrating an embodiment of the present invention is shown for a time synchronization method for a receiving device based on an acknowledgment frame piggybacked timestamp. The receiving device interacts with the sending device via a wireless communication network. Figure 2 As shown, the time synchronization method includes: Step S201: When the receiving device starts receiving any data frame sent by the sending device, record the start time of receiving the arbitrary data frame under the local clock of the receiving device as T2; Step S202: After the receiving device has finished receiving any data frame, it begins to prepare the acknowledgment frame to reply; Step S203: Calculate and record the start time of the acknowledgment frame transmission under the local clock of the receiving device as T3; Step S204: Insert the acknowledgment frame sending time T3 and the data frame receiving time T2 into the acknowledgment frame and send it to the sending device so that the sending device can record the start receiving time T4 of the acknowledgment frame under the local clock of the sending device, and extract the two timestamps T2 and T3 inserted by the receiving device in the acknowledgment frame.
[0037] In this embodiment, compared to the method of using a dedicated time synchronization frame, the receiving device of the present invention inserts the acknowledgment frame sending time T3 and the data frame receiving time T2 into the acknowledgment frame when preparing the reply acknowledgment frame, and sends it to the sending device. This allows the sending device to achieve time synchronization by piggybacking a high-precision timestamp on the acknowledgment frame of the existing data frame, without frame header overhead, saving valuable air time. At the same time, the time synchronization process is carried out along with the existing service data stream, rather than independent data interaction, which can achieve high-frequency time synchronization with almost no impact on service communication, further improving the time synchronization accuracy.
[0038] In one embodiment of the present invention, step S203 specifically involves: calculating the start time of the confirmation frame under the local clock of the receiving device based on the transmission parameters of the confirmation frame, the local clock of the receiving device, and the hardware processing delay of the transmission data link of the receiving device, and recording the start time of the confirmation frame under the local clock of the receiving device as T3.
[0039] This invention also proposes a time synchronization device for a transmitting device based on an acknowledgment frame piggybacked with a timestamp. The transmitting device interacts with the receiving device via a wireless communication network. The time synchronization device includes: a data frame transmission time calculation unit, used to calculate and record the start transmission time of each data frame as T1 when the transmitting device sends any data frame to the receiving device; an acknowledgment frame timestamp extraction unit, used to record the start reception time of the acknowledgment frame under the local clock of the transmitting device as T4 when the transmitting device receives the acknowledgment frame sent by the receiving device, and extract two timestamps T2 and T3 inserted by the receiving device in the acknowledgment frame; wherein, timestamp T2 is the start reception time of the corresponding data frame sent by the transmitting device under the local clock of the receiving device; timestamp T3 is the start transmission time of the acknowledgment frame under the local clock of the receiving device; a time difference calculation unit, used to calculate the time difference Offset between the local clock of the transmitting device and the local clock of the receiving device based on the data frame transmission time T1, timestamp T2, timestamp T3 and acknowledgment frame reception time T4; and a time compensation unit, used to transfer the time difference Offset to a high-precision clock to perform corresponding time compensation on the high-precision clock, so as to ultimately achieve time synchronization between the transmitting device and the receiving device.
[0040] This invention also proposes a time synchronization device for a receiving device based on an acknowledgment frame piggybacked with timestamps. The receiving device interacts with a sending device via a wireless communication network. The time synchronization device includes: a data frame reception time recording unit, used to record the start reception time of the corresponding data frame under the local clock of the receiving device as T2 when the receiving device begins to receive the corresponding data frame sent by the sending device; an acknowledgment frame preparation unit, used to prepare a reply acknowledgment frame after the receiving device has finished receiving the corresponding data frame; an acknowledgment frame transmission time calculation unit, used to calculate and record the start transmission time of the acknowledgment frame under the local clock of the receiving device as T3; and an acknowledgment frame timestamp insertion unit, used to insert the acknowledgment frame transmission time T3 and the data frame reception time T2 into the acknowledgment frame and send it to the sending device, so that the sending device can record the start reception time T4 of the acknowledgment frame under the local clock of the sending device and extract the two timestamps T2 and T3 inserted by the receiving device in the acknowledgment frame. The present invention also proposes a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the time synchronization method for a transmitting device based on acknowledgment frame piggybacking timestamps as described in any of the above technical solutions.
[0041] The present invention also proposes an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the time synchronization method based on acknowledgment frame piggybacking timestamp for a transmitting device as described in any of the above technical solutions.
[0042] The present invention also proposes a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the time synchronization method for receiving devices based on acknowledgment frame piggyback timestamps as described in any of the above technical solutions.
[0043] The present invention also proposes an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the time synchronization method for a receiving device based on an acknowledgment frame piggybacking timestamp as described in any of the above technical solutions.
[0044] The following specific embodiment will illustrate the time synchronization method of the present invention based on acknowledgment frames piggybacked with timestamps. The transmitting device interacts with the receiving device via a wireless communication network. For example... Figure 3As shown, the transmission link of the original wireless MAC hardware is modified to include functions for calculating transmission time (i.e., calculating the transmitter's T1 and receiver's T3; the specific meanings of T1 and T3 will be explained later) and inserting acknowledgment frame timestamps (i.e., inserting T2 and T3; the specific meanings of T2 and T3 will be explained later). The transmission link then hands the processed data frames over to the wireless physical layer hardware (PHY) for transmission over the air. When the wireless physical layer hardware receives a wireless frame in the air, it transmits the frame content and received modulation parameter information to the receiving link. The receiving link is modified to include functions for receiving timestamp acquisition (i.e., receiver's T2 and transmitter's T4; the specific meanings of T2 and T4 will be explained later) and extracting acknowledgment frame timestamps (extracting T2 and T3; the specific meanings of T2 and T3 will be explained later). Furthermore, a time difference calculation function (i.e., calculating the time difference offset; the specific meaning of the time difference offset will be explained later) is added, and the time difference offset is passed to a high-precision clock for time compensation.
[0045] Specifically, when sending each data frame to the receiving end (i.e., the sending device), the sending end (i.e., the receiving device) calculates and records the precise time T1 at which each data frame begins transmission over the wireless interface (T1 being the start time of each data frame transmission) based on the transmission parameters, the current high-precision time value of the system (i.e., the sending device's local clock), and the hardware processing delay of the transmission data link (i.e., the transmission link). When the receiving end (i.e., the receiving device) begins receiving the corresponding data frame, it immediately records the start time T2 of frame reception under its local clock (T2 being the start time of reception of the corresponding data frame under the receiving device's local clock). After receiving the frame, the receiving end (i.e., the receiving device) begins preparing the acknowledgment frame to reply, i.e., the construction of the acknowledgment frame begins. The receiving end (i.e., the receiving device) calculates the precise time T3 at which the acknowledgment frame begins transmission over the wireless interface (i.e., the start time of transmission of the acknowledgment frame under the local clock of the receiving device) based on the transmission parameters of the acknowledgment frame, the current high-precision time value of the system (i.e., the local clock of the receiving device), and the hardware processing delay of the transmission data link (i.e., the transmission link). It then inserts T2 and T3 into the acknowledgment frame and sends it to the sending end. When the sending end (i.e., the sending device) receives the timestamped acknowledgment frame, it immediately records the local reception time T4 at which the acknowledgment frame begins reception (i.e., the start time of reception of the acknowledgment frame under the local clock of the sending device) and extracts the two timestamps T2 and T3 inserted by the receiving end (i.e., the receiving device) from the acknowledgment frame.
[0046] Based on the data frame transmission time T1, timestamp T2, timestamp T3, and acknowledgment frame reception time T4, calculate the time difference Offset between the local clock of the sending device and the local clock of the receiving device.
[0047] The time difference offset is transferred to a high-precision clock for time compensation, ultimately achieving time synchronization between the transmitting and receiving devices. This time difference offset is transferred to the high-precision clock via hardware to compensate for the clock's time difference.
[0048] Based on the data frame transmission time T1, timestamp T2, timestamp T3, and acknowledgment frame reception time T4, calculate the time difference Offset between the local clock of the sending device and the local clock of the receiving device, specifically including: Based on the data frame transmission time T1, timestamp T2, timestamp T3, and acknowledgment frame reception time T4, calculate the loop delay time RTT for data interaction between the sending and receiving devices; wherein, the expression corresponding to the loop delay time RTT is: RTT=(T4-T1)-(T3-T2); Based on the loop delay time RTT, the one-way propagation delay time ToF for data interaction between the transmitting and receiving devices is calculated; wherein, the bidirectional propagation time is equal, and the expression corresponding to the one-way propagation delay time ToF is: ToF=RTT / 2. Based on the one-way propagation delay time ToF, calculate the time difference Offset between the local clock of the transmitting device and the local clock of the receiving device; wherein, the expression corresponding to the time difference Offset is Offset=(T2-T1)-ToF.
[0049] This specific embodiment proposes a high-precision, low-overhead time synchronization method. This method utilizes existing wireless data communication traffic, with hardware inserting high-precision timestamps into service data frames and their corresponding acknowledgment frames, thereby achieving low-overhead, high-precision time synchronization without the need for additional frame interactions.
[0050] Based on the above specific embodiments, the core technical innovations of the time synchronization method, device, storage medium and electronic device based on the confirmation frame with timestamp provided by the present invention are as follows: (1) Time synchronization method based on service data stream and MAC layer confirmation frame: Utilizing the MAC layer interaction of the existing data frame-confirmation frame in wireless communication, by piggybacking the timestamp on the interaction, the synchronization process is combined with the data communication process, reducing the overhead of additional synchronization; (2) Synchronization data encapsulation method of inserting time synchronization information into the confirmation frame: The timestamp required for time synchronization is embedded in a specific position in the confirmation frame, realizing the integrated transmission of synchronization information and data.
[0051] In summary, the time synchronization method, apparatus, storage medium, and electronic device based on confirmation frames piggybacked with timestamps provided by this invention have unparalleled technical advantages.
[0052] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A time synchronization method based on piggybacking time stamp of acknowledgement frame, for a sending end device, the sending end device performing data interaction with a receiving end device through a wireless communication network, characterized in that, The time synchronization method comprises: Step S101: when the sending end device sends an arbitrary data frame to the receiving end device, the sending time of each data frame is calculated and recorded as T1; Step S102: when the sending end device receives an acknowledgement frame sent by the receiving end device, the receiving time of the acknowledgement frame under the local clock of the sending end device is recorded as T4, and two time stamps T2 and T3 inserted by the receiving end device in the acknowledgement frame are extracted; wherein the time stamp T2 is the receiving time of the corresponding data frame sent by the sending end device under the local clock of the receiving end device; the time stamp T3 is the sending time of the acknowledgement frame under the local clock of the receiving end device; Step S103: based on the data frame sending time T1, the time stamp T2, the time stamp T3 and the acknowledgement frame receiving time T4, the time difference Offset between the local clock of the sending end device and the local clock of the receiving end device is calculated; Step S104: the time difference Offset is transmitted to a high-precision clock, so that the high-precision clock is compensated in time, and finally the time synchronization between the sending end device and the receiving end device is realized.
2. The method of claim 1, wherein the time synchronization is based on a timestamp of a confirmation frame piggybacked. The step S101 specifically comprises: when the sending end device sends an arbitrary data frame to the receiving end device, the sending time of each data frame is calculated according to the sending parameters, the local clock of the sending end device and the hardware processing delay of the sending data link of the sending end device, and the sending time of each data frame is recorded as T1.
3. The method according to claim 1 or 2, characterized in that, The step S103 specifically comprises: Step S1031: based on the data frame sending time T1, the time stamp T2, the time stamp T3 and the acknowledgement frame receiving time T4, the loop delay time RTT of the data interaction between the sending end device and the receiving end device is calculated; wherein the expression corresponding to the loop delay time RTT is: RTT=(T4-T1)-(T3-T2); Step S1032: based on the loop delay time RTT, the one-way propagation delay time ToF of the data interaction between the sending end device and the receiving end device is calculated; wherein the expression corresponding to the one-way propagation delay time ToF is: ToF=RTT / 2; Step S1033: based on the one-way propagation delay time ToF, the time difference Offset between the local clock of the sending end device and the local clock of the receiving end device is calculated; wherein the expression corresponding to the time difference Offset is: Offset=(T2-T1)-ToF.
4. A time synchronization method based on acknowledgment frames piggybacked with timestamps, used in a receiving device, wherein the receiving device interacts with a sending device via a wireless communication network, characterized in that... The time synchronization method comprises: Step S201: when the receiving end device starts to receive an arbitrary data frame sent by the sending end device, the receiving time of the arbitrary data frame under the local clock of the receiving end device is recorded as T2; Step S202: after the receiving end device receives the arbitrary data frame, the sending end device starts to prepare a reply acknowledgement frame; Step S203: the sending time of the acknowledgement frame under the local clock of the receiving end device is calculated and recorded as T3; Step S204: inserting the confirmation frame sending time T3 and the data frame receiving time T2 into the confirmation frame, and sending to the sending end device for recording the starting receiving time T4 of the confirmation frame under the local clock of the sending end device, and extracting the two time stamps T2 and T3 inserted by the receiving end device in the confirmation frame.
5. The method of claim 4, wherein the time synchronization is based on a timestamp of a confirmation frame piggybacked. The step S203 specifically comprises: calculating the starting sending time of the confirmation frame under the local clock of the receiving end device according to the sending parameter of the confirmation frame, the local clock of the receiving end device, and the hardware processing delay of the sending data link of the receiving end device, and recording the starting sending time of the confirmation frame under the local clock of the receiving end device as T3.
6. A time synchronization apparatus based on piggybacking time stamp of acknowledgement frame, for a sending end device, wherein the sending end device interacts with a receiving end device through a wireless communication network, characterized in that, The time synchronization device comprises: a data frame sending time calculation unit, configured to calculate and record the starting sending time of each data frame as T1 when the sending end device sends any data frame to the receiving end device; a confirmation frame time stamp extraction unit, configured to record the starting receiving time of the confirmation frame under the local clock of the sending end device as T4 when the sending end device receives the confirmation frame sent by the receiving end device, and extract the two time stamps T2 and T3 inserted by the receiving end device in the confirmation frame; wherein the time stamp T2 is the starting receiving time of the receiving end device starting to receive the corresponding data frame sent by the sending end device under the local clock of the receiving end device; and the time stamp T3 is the starting sending time of the confirmation frame under the local clock of the receiving end device; a time difference calculation unit, configured to calculate the time difference Offset between the local clock of the sending end device and the local clock of the receiving end device based on the data frame sending time T1, the time stamp T2, the time stamp T3 and the confirmation frame receiving time T4; a time compensation unit, configured to pass the time difference Offset to the high-precision clock for corresponding time compensation of the high-precision clock, so as to finally realize the time synchronization between the sending end device and the receiving end device.
7. An apparatus for time synchronization based on piggybacked time stamp of acknowledgement frame, for a receiving end device, the receiving end device performing data interaction with a sending end device through a wireless communication network, characterized in that, The time synchronization device comprises: a data frame receiving time recording unit, configured to record the starting receiving time of the corresponding data frame as T2 under the local clock of the receiving end device when the receiving end device starts to receive the corresponding data frame sent by the sending end device a confirmation frame preparation unit, configured to start preparing the reply confirmation frame after the receiving end device receives the corresponding data frame; a confirmation frame sending time calculation unit, configured to calculate and record the starting sending time of the confirmation frame under the local clock of the receiving end device as T3; a confirmation frame time stamp insertion unit, configured to insert the confirmation frame sending time T3 and the data frame receiving time T2 into the confirmation frame, and send to the sending end device for recording the starting receiving time T4 of the confirmation frame under the local clock of the sending end device, and extracting the two time stamps T2 and T3 inserted by the receiving end device in the confirmation frame.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, wherein the computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 3.
9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the method in any one of claims 1 to 3.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the steps of the method in claim 4 or 5.
Citation Information
Patent Citations
Wireless sensor network time synchronization method based on partial timestamp information
CN114710828A
Method for realizing hardware time synchronization of industrial Internet of Things chip
CN118764126A
RTT based ranging system and method
US20130336131A1