WO2022111419A1 - 时间同步方法及控制装置、设备、存储介质 - Google Patents
时间同步方法及控制装置、设备、存储介质 Download PDFInfo
- Publication number
- WO2022111419A1 WO2022111419A1 PCT/CN2021/132132 CN2021132132W WO2022111419A1 WO 2022111419 A1 WO2022111419 A1 WO 2022111419A1 CN 2021132132 W CN2021132132 W CN 2021132132W WO 2022111419 A1 WO2022111419 A1 WO 2022111419A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- time
- electronic device
- bluetooth
- message
- bluetooth message
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W56/00—Synchronisation arrangements
- H04W56/001—Synchronization between nodes
- H04W56/0015—Synchronization between nodes one node acting as a reference for the others
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04J—MULTIPLEX COMMUNICATION
- H04J3/00—Time-division multiplex systems
- H04J3/02—Details
- H04J3/06—Synchronising arrangements
- H04J3/0635—Clock or time synchronisation in a network
- H04J3/0638—Clock or time synchronisation among nodes; Internode synchronisation
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04J—MULTIPLEX COMMUNICATION
- H04J3/00—Time-division multiplex systems
- H04J3/02—Details
- H04J3/06—Synchronising arrangements
- H04J3/0635—Clock or time synchronisation in a network
- H04J3/0682—Clock or time synchronisation in a network by delay compensation, e.g. by compensation of propagation delay or variations thereof, by ranging
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/80—Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W84/00—Network topologies
- H04W84/18—Self-organising networks, e.g. ad-hoc networks or sensor networks
Definitions
- the present invention relates to the technical field of time synchronization, and in particular, to a time synchronization method, a control device, a device and a storage medium.
- Motion characteristics are the main function of smart wearable devices.
- Current smart wearable devices such as smart watches, bracelets, rings, and earphones can provide basic motion features such as step counting. Since most of the movements are movements of multiple parts of the body, current wearable devices can only support single-point movement detection, and cannot provide assessment of the movement posture of multiple parts of the human body in motion.
- the detection results of each smart wearable device can be provided individually, lacking high-precision comprehensive motion posture and health assessment functions. In order to obtain the high-precision comprehensive motion posture and health assessment information, multiple sensors of multiple wearable devices need to be detected at multiple points, and precise time synchronization between multiple sensors is required.
- the master device obtains the Network Time Reference (NTR) at the application layer, and sends the NTR to the slave device that needs time synchronization through the BLE data channel.
- NTR Network Time Reference
- each device obtains the standard time separately, and adjusts the local time according to the standard time, so as to realize time synchronization among multiple devices.
- the device that needs to obtain the network time needs to add a network time entry.
- the transmission time information through the data channel is subject to the uncertainty of BLE scheduling and the underlying transmission delay. Unfixed influence, poor time accuracy, cannot meet the requirements of ms-level high precision.
- the present application provides a time synchronization method, a control device, a device, and a storage medium, wherein the time synchronization method can add time stamp information to the physical frame of a Bluetooth message sent between master and slave devices, and the time stamp information is the At the time of sending a Bluetooth packet, the slave device corrects the local time of the slave device according to the timestamp information in the Bluetooth packet sent by the master device.
- the time synchronization of the master and slave devices can be performed through the timestamp added in the Bluetooth message between the master and slave devices without the need to obtain the network time, and the method of sending Bluetooth messages can overcome the inability to meet the ms-level high-level in the prior art.
- the above-mentioned time synchronization method can enable smart wearable devices to achieve high-precision comprehensive motion posture and health assessment functions.
- the present application provides a time synchronization method, the method comprising:
- the first electronic device acquires the first Bluetooth message sent by the second electronic device, wherein the first Bluetooth message carries first time stamp information, and the first time stamp information indicates the sending time t 1 of the first Bluetooth message, and the first time stamp information
- the timestamp information is a field in the protocol data unit of the Bluetooth physical frame in the first Bluetooth message
- the first electronic device corrects the local time of the first electronic device according to the first timestamp information
- the sending time t 1 of the first Bluetooth message is determined in the following manner:
- the second electronic device Before the second electronic device sends the first Bluetooth message to the first electronic device, obtain the clock information of the second electronic device, and determine the pre-start sending time of the first Bluetooth message based on the clock information of the second electronic device;
- the second electronic device determines the sending time of the first bit of the access address in the first Bluetooth message according to the pre-start sending time of the first Bluetooth message, and sends the determined first bit of the access address in the first Bluetooth message
- the sending time of the first Bluetooth message is taken as the sending time t 1 of the first Bluetooth message.
- the field includes a first field and a second field
- the first field and the second field are a time stamp and a time stamp, respectively.
- the time stamp indicates that the Bluetooth physical frame carries a time stamp, and the time stamp includes the sending time t 1 .
- correcting the local time of the slave device according to the first timestamp information includes:
- the sending time t 1 is taken as the current local time of the first electronic device.
- the method further includes:
- the second Bluetooth message carries second time stamp information, and the second time stamp information indicates the sending time t 2 of the second Bluetooth message, and the sending of the second Bluetooth message Time t2 is the sending time of the first bit of the access address in the second Bluetooth message;
- the local time of the first electronic device is corrected according to the average one-way transmission delay.
- the present application also provides a time synchronization method, including:
- the first electronic device acquires the first Bluetooth packet sent by the second electronic device, wherein the first Bluetooth packet carries first time stamp information, and the first time stamp information represents the first time stamp determined based on the clock information of the second electronic device.
- the first timestamp information is a field in the protocol data unit of the Bluetooth physical frame in the first Bluetooth message;
- the sending time t 1 of the first Bluetooth message is determined in the following manner:
- the second electronic device Before the second electronic device sends the first Bluetooth message to the first electronic device, obtain the clock information of the second electronic device, and determine the pre-start sending time of the first Bluetooth message based on the clock information of the second electronic device;
- the second electronic device determines the sending time of the first bit of the access address in the first Bluetooth message according to the pre-start sending time of the first Bluetooth message, and sends the determined first bit of the access address in the first Bluetooth message
- the sending time of the first Bluetooth message is taken as the sending time t 1 of the first Bluetooth message
- the first electronic device determines, based on the local clock, a reception time t 4 at which the first Bluetooth message is received;
- a fourth Bluetooth message sent to the second electronic device wherein the fourth Bluetooth message carries fourth time stamp information, and the fourth time stamp information includes the reception time t4 of the first Bluetooth message and the fourth Bluetooth message
- the sending time t5 is the sending time of the first bit of the access address in the fourth Bluetooth message
- the first electronic device acquires the fifth Bluetooth packet sent by the second electronic device, where the fifth Bluetooth packet carries fifth time stamp information, and the fifth time stamp information includes the average single-bit value between the second electronic device and the first electronic device. to the transmission delay, the frequency offset time difference between the second electronic device and the first electronic device, and the reception time t 6 of the fourth Bluetooth message;
- the first electronic device corrects the local time of the first electronic device according to the average one - way transmission delay, the frequency offset time difference, and the reception time t6 of the fourth Bluetooth message.
- the present application also provides a time synchronization method, including:
- the second electronic device Before the second electronic device sends the first Bluetooth message to the first electronic device, obtain the clock information of the second electronic device, and determine the pre-start sending time of the first Bluetooth message based on the clock information of the second electronic device;
- the second electronic device determines the sending time of the first bit of the access address in the first Bluetooth message according to the pre-start sending time of the first Bluetooth message, and sends the determined first bit of the access address in the first Bluetooth message
- the sending time of the first Bluetooth message is taken as the sending time t 1 of the first Bluetooth message
- the second electronic device starts to send the first Bluetooth message to the first electronic device at the pre-start sending moment of the first Bluetooth message, wherein the first Bluetooth message carries first time stamp information, and the first time stamp information indicates the first time stamp
- the sending time t 1 of the Bluetooth message, and the first timestamp information is a field in the protocol data unit of the Bluetooth physical frame in the first Bluetooth message.
- the field includes a first field and a second field
- the first field and the second field are a time stamp and a time stamp, respectively.
- the time stamp indicates that the Bluetooth physical frame carries a time stamp, and the time stamp includes the sending time t 1 of the first Bluetooth packet.
- the method further includes:
- the second electronic device acquires a second Bluetooth message sent by the first electronic device, wherein the second Bluetooth message carries second time stamp information, and the second time stamp information represents the sending time t 2 of the second Bluetooth message;
- the second electronic device determines the receiving time t 3 of the second Bluetooth message based on the clock information of the second electronic device, and according to the sending time t 1 of the first Bluetooth message, the sending time t 2 of the second Bluetooth message, and the third Bluetooth message 2. Calculate the average one-way transmission delay between the second electronic device and the first electronic device at the receiving time t3 of the Bluetooth message;
- the second electronic device sends a third Bluetooth packet to the first electronic device, where the third Bluetooth packet carries third time stamp information, and the third time stamp information represents the average one-way average between the second electronic device and the first electronic device transmission delay.
- the average value between the second electronic device and the first electronic device is calculated.
- the one-way transmission delay is calculated by the following formula:
- T 1 represents the average one-way transmission delay between the second electronic device and the first electronic device.
- the present application also provides a time synchronization method, including:
- the second electronic device Before the second electronic device sends the first Bluetooth message to the first electronic device, obtain the clock information of the second electronic device, and determine the pre-start sending time of the first Bluetooth message based on the clock information of the second electronic device;
- the second electronic device determines the sending time of the first bit of the access address in the first Bluetooth message according to the pre-start sending time of the first Bluetooth message, and sends the determined first bit of the access address in the first Bluetooth message
- the sending time of the first Bluetooth message is taken as the sending time t 1 of the first Bluetooth message
- the second electronic device starts to send the first Bluetooth message to the first electronic device at the pre-start sending moment of the first Bluetooth message, wherein the first Bluetooth message carries first time stamp information, and the first time stamp information indicates the first time stamp the sending time t 1 of the Bluetooth message, and the first timestamp information is a field in the protocol data unit of the Bluetooth physical frame in the first Bluetooth message;
- the second electronic device acquires the fourth Bluetooth packet sent by the first electronic device, where the fourth Bluetooth packet carries fourth timestamp information, the fourth Bluetooth packet carries fourth timestamp information, and the fourth timestamp information includes the receiving time t4 of the first Bluetooth message and the sending time t5 of the fourth Bluetooth message ;
- the second electronic device determines, based on the clock information of the second electronic device, the receiving time t 6 of the fourth Bluetooth message, and according to the sending time t 1 of the first Bluetooth message, the receiving time t 4 of the first Bluetooth message, and the first Bluetooth message
- the sending time t5 of the four Bluetooth messages and the receiving time t6 of the fourth Bluetooth message are calculated to calculate the average one - way transmission delay between the second electronic device and the first electronic device and the difference between the second electronic device and the first electronic device.
- the frequency deviation time difference between the clocks, the frequency deviation time difference is the time deviation caused by the frequency deviation between the clocks;
- the second electronic device sends a fifth Bluetooth packet to the first electronic device, where the fifth Bluetooth packet carries fifth time stamp information, and the fifth time stamp information includes the average one-way average between the first electronic device and the second electronic device.
- the average one - way transmission delay between the second electronic device and the first electronic device and the second electronic device and the first electronic device are calculated .
- the frequency offset time difference between electronic devices is calculated by the following formula:
- T 2 represents the average one-way transmission delay between the second electronic device and the first electronic device
- T 3 represents the frequency offset time difference between the second electronic device and the first electronic device.
- the application provides an electronic device, comprising:
- the present application provides a computer-readable storage medium on which a computer program is stored, and when it runs on a computer, enables the computer to implement any one of the following methods when executed:
- the program in the sixth aspect may be stored in whole or in part on a storage medium packaged with the processor, or may be stored in part or in part in a memory not packaged with the processor.
- the slave device when the slave device receives the Bluetooth message carrying the time stamp information sent by the master device, it can correct the local time of the slave device according to the time stamp information in the Bluetooth message sent by the master device. Without the need to obtain the network time, the time synchronization of the master and slave devices is carried out through the timestamp added in the Bluetooth message between the master and slave devices, and the method of sending the Bluetooth message overcomes the inability to meet the ms-level high precision in the prior art
- the above-mentioned time synchronization method can enable the smart wearable device to achieve high-precision comprehensive motion posture and health assessment functions.
- the above technical solution is to calculate the time delay information between the first electronic device and the second electronic device on the side of the second electronic device.
- the above-mentioned first electronic device can also be calculated on the side of the first electronic device. Delay information between the device and the second electronic device, as follows:
- the present application also provides a time synchronization method, comprising:
- the first electronic device acquires the first Bluetooth message sent by the second electronic device, wherein the first Bluetooth message carries first time stamp information, and the first time stamp information indicates the sending time t 1 of the first Bluetooth message, and the first time stamp information
- the timestamp information is a field in the protocol data unit of the Bluetooth physical frame in the first Bluetooth message
- the sending time t 1 of the first Bluetooth message is determined in the following manner:
- the second electronic device Before the second electronic device sends the first Bluetooth message to the first electronic device, obtain the clock information of the second electronic device, and determine the pre-start sending time of the first Bluetooth message based on the clock information of the second electronic device;
- the second electronic device determines the sending time of the first bit of the access address in the first Bluetooth message according to the pre-start sending time of the first Bluetooth message, and sends the determined first bit of the access address in the first Bluetooth message
- the sending time of the first Bluetooth message is taken as the sending time t 1 of the first Bluetooth message
- the first electronic device corrects the local time of the first electronic device according to the first timestamp information
- the first electronic device sends a second Bluetooth message to the second electronic device, wherein the second Bluetooth message carries second time stamp information, and the second time stamp information indicates the sending time t 2 of the second Bluetooth message, and the second Bluetooth message carries second time stamp information.
- the sending time t2 of the message is the sending time of the first bit of the access address in the second Bluetooth message;
- the first electronic device obtains the sixth Bluetooth message sent by the second electronic device, wherein the sixth Bluetooth message carries sixth time stamp information, and the sixth time stamp information represents the time t 3 of receiving the second Bluetooth message, and the second The reception time t3 of the Bluetooth message is the reception time t3 determined by the second electronic device based on the clock information of the second electronic device to receive the second Bluetooth message;
- the first electronic device calculates the distance between the second electronic device and the first electronic device according to the sending time t 1 of the first Bluetooth message, the sending time t 2 of the second Bluetooth message, and the receiving time t 3 of the second Bluetooth message. the average one-way transmission delay;
- the local time of the first electronic device is corrected according to the average one-way transmission delay.
- the average value between the second electronic device and the first electronic device is calculated.
- the one-way transmission delay is calculated by the following formula:
- T 1 represents the average one-way transmission delay between the second electronic device and the first electronic device.
- the present application also provides a time synchronization method, including:
- the first electronic device acquires the first Bluetooth packet sent by the second electronic device, wherein the first Bluetooth packet carries first time stamp information, and the first time stamp information represents the first time stamp determined based on the clock information of the second electronic device.
- the first timestamp information is a field in the protocol data unit of the Bluetooth physical frame in the first Bluetooth message;
- the sending time t 1 of the first Bluetooth message is determined in the following manner:
- the second electronic device Before the second electronic device sends the first Bluetooth message to the first electronic device, obtain the clock information of the second electronic device, and determine the pre-start sending time of the first Bluetooth message based on the clock information of the second electronic device;
- the second electronic device determines the sending time of the first bit of the access address in the first Bluetooth message according to the pre-start sending time of the first Bluetooth message, and sends the determined first bit of the access address in the first Bluetooth message
- the sending time of the first Bluetooth message is taken as the sending time t 1 of the first Bluetooth message
- the first electronic device determines, based on the local clock, a reception time t 4 at which the first Bluetooth message is received;
- a fourth Bluetooth message sent by the first electronic device to the second electronic device wherein the fourth Bluetooth message carries fourth time stamp information, and the fourth time stamp information includes the reception time t4 and the first time stamp of the first Bluetooth message.
- sending time t5 is the sending time of the first bit of the access address in the fourth bluetooth message ;
- the first electronic device acquires the seventh Bluetooth message sent by the second electronic device, wherein the seventh Bluetooth message carries seventh time stamp information, and the seventh time stamp information represents the receiving time t 6 of the fourth Bluetooth message, and the seventh time stamp information 4.
- the reception time t6 of the Bluetooth message is the reception time t6 determined by the second electronic device based on the clock information of the second electronic device to receive the second Bluetooth message ;
- the first electronic device calculates the first Bluetooth message according to the sending time t 1 of the first Bluetooth message, the receiving time t 4 of the first Bluetooth message, the sending time t 5 of the fourth Bluetooth message, and the receiving time t 6 of the fourth Bluetooth message.
- the average one-way transmission delay between the second electronic device and the first electronic device and the frequency deviation time difference between the second electronic device and the first electronic device, the frequency deviation time difference is the time deviation caused by the frequency deviation between the clocks;
- the first electronic device corrects the local time of the first electronic device according to the average one - way transmission delay, the frequency offset time difference, and the reception time t6 of the fourth Bluetooth message.
- the average one - way transmission delay between the second electronic device and the first electronic device and the second electronic device and the first electronic device are calculated .
- the frequency offset time difference between electronic devices is calculated by the following formula:
- T 2 represents the average one-way transmission delay between the second electronic device and the first electronic device
- T 3 represents the frequency offset time difference between the second electronic device and the first electronic device.
- the present application also provides a time synchronization method, comprising:
- the second electronic device Before the second electronic device sends the first Bluetooth message to the first electronic device, obtain the clock information of the second electronic device, and determine the pre-start sending time of the first Bluetooth message based on the clock information of the second electronic device;
- the second electronic device determines the sending time of the first bit of the access address in the first Bluetooth message according to the pre-start sending time of the first Bluetooth message, and sends the determined first bit of the access address in the first Bluetooth message
- the sending time of the first Bluetooth message is taken as the sending time t 1 of the first Bluetooth message
- the second electronic device starts to send the first Bluetooth message to the first electronic device at the pre-start sending moment of the first Bluetooth message, wherein the first Bluetooth message carries first time stamp information, and the first time stamp information indicates the first time stamp the sending time t 1 of the Bluetooth message, and the first timestamp information is a field in the protocol data unit of the Bluetooth physical frame in the first Bluetooth message;
- the second electronic device acquires a second Bluetooth message sent by the first electronic device, wherein the second Bluetooth message carries second time stamp information, and the second time stamp information represents the sending time t 2 of the second Bluetooth message;
- the second electronic device determines, based on the clock information of the second electronic device, the reception time t 3 at which the second Bluetooth message is received;
- the second electronic device sends a sixth Bluetooth message to the first electronic device, wherein the sixth Bluetooth message carries sixth time stamp information, and the sixth time stamp information represents the receiving time t 3 of the second Bluetooth message.
- the present application also provides a time synchronization method, comprising:
- the second electronic device Before the second electronic device sends the first Bluetooth message to the first electronic device, obtain the clock information of the second electronic device, and determine the pre-start sending time of the first Bluetooth message based on the clock information of the second electronic device;
- the second electronic device determines the sending time of the first bit of the access address in the first Bluetooth message according to the pre-start sending time of the first Bluetooth message, and sends the determined first bit of the access address in the first Bluetooth message
- the sending time of the first Bluetooth message is taken as the sending time t 1 of the first Bluetooth message
- the second electronic device starts to send the first Bluetooth message to the first electronic device at the pre-start sending moment of the first Bluetooth message, wherein the first Bluetooth message carries first time stamp information, and the first time stamp information indicates the first time stamp the sending time t 1 of the Bluetooth message, and the first timestamp information is a field in the protocol data unit of the Bluetooth physical frame in the first Bluetooth message;
- the second electronic device acquires the fourth Bluetooth packet sent by the first electronic device, where the fourth Bluetooth packet carries fourth timestamp information, the fourth Bluetooth packet carries fourth timestamp information, and the fourth timestamp information includes the receiving time t4 of the first Bluetooth message and the sending time t5 of the fourth Bluetooth message ;
- the second electronic device determines, based on the clock information of the second electronic device, the reception time t6 at which the fourth Bluetooth message is received;
- the second electronic device sends a seventh Bluetooth message to the first electronic device, wherein the seventh Bluetooth message carries seventh time stamp information, and the seventh time stamp information represents the receiving time t 6 of the fourth Bluetooth message.
- the application further provides an electronic device, comprising:
- a processor a memory
- the memory is used to store at least one instruction
- the instruction is loaded and executed by the processor to implement any one of the following methods:
- the present application also provides a computer-readable storage medium on which a computer program is stored,
- the computer program when executed by a processor, implements any of the following methods:
- the program in the twelfth aspect may be stored in whole or in part on a storage medium packaged with the processor, or may be stored in part or in part in a memory not packaged with the processor.
- the slave device when the slave device receives the Bluetooth message carrying the time stamp information sent by the master device, it can correct the local time of the slave device according to the time stamp information in the Bluetooth message sent by the master device. Without the need to obtain the network time, the time synchronization of the master and slave devices is carried out through the timestamp added in the Bluetooth message between the master and slave devices, and the method of sending the Bluetooth message overcomes the inability to meet the ms-level high precision in the prior art
- the above-mentioned time synchronization method can enable the smart wearable device to achieve high-precision comprehensive motion posture and health assessment functions.
- FIG. 1 is a schematic diagram of an application scenario provided by the present application.
- FIG. 2 is a schematic diagram of a reference position at the moment of message transmission provided by the present application
- FIG. 3a is a schematic diagram of a timestamp location provided by the present application.
- Figure 3b is a schematic diagram of the structure of a Bluetooth broadcast message provided by the application.
- 3c is a schematic diagram of the structure of a Bluetooth data message provided by the application.
- FIG. 4 is a schematic diagram of a time synchronization method provided by the present application.
- 5a is a schematic diagram of another time synchronization manner provided by the application.
- 5b is a schematic diagram of another time synchronization manner provided by the application.
- 6a is a schematic diagram of another time synchronization manner provided by the present application.
- 6b is a schematic diagram of another time synchronization manner provided by the application.
- FIG. 7a is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
- FIG. 7b is a schematic structural diagram of an electronic device provided by another embodiment of the present application.
- FIG. 8 is a schematic diagram of information transfer from a device provided by the present application.
- FIG. 9 is a schematic diagram of signaling about sampling control of a sports health monitoring system provided by the present application.
- the time synchronization method provided in the embodiments of the present application may be applied to electronic devices, where the electronic devices may be smart phones, tablet computers, wearable devices, augmented reality (AR)/virtual reality (VR) devices and other devices; the embodiments of this application do not impose any restrictions on the specific types of electronic devices.
- the electronic devices may be smart phones, tablet computers, wearable devices, augmented reality (AR)/virtual reality (VR) devices and other devices; the embodiments of this application do not impose any restrictions on the specific types of electronic devices.
- AR augmented reality
- VR virtual reality
- FIG. 1 is a schematic diagram of an application scenario provided by the present application.
- the time synchronization method provided by the present application is applied to a scenario composed of a master device and a slave device, wherein the master device may be the above-mentioned second electronic device. M1, the slave device may be the above-mentioned first electronic device S1, and the scenario may include multiple slave devices.
- the master device is a smart phone M1
- the slave devices are smart wearable devices S1-S4. Multiple smart wearable devices are respectively worn on different parts of the user, and the motion posture evaluation of the corresponding parts is performed when the user is exercising.
- FIG. 1 is an example diagram, and the number of slave devices is not limited here.
- the time synchronization between multiple sensors of multiple smart wearable devices has high accuracy time synchronization standards, such as time synchronization requirements ⁇ 100us or even ⁇ 10uS.
- the time synchronization method of the master and slave devices is performed by the time synchronization method provided in the present application, wherein the master device is the central device in the scene, and the local time of the master device is used as the standard time for time synchronization of the master and slave devices.
- the master device sends a Bluetooth packet to the slave device, and carries the local time of the master device as a timestamp in the Bluetooth packet, and the slave device performs time synchronization according to the time information represented by the timestamp carried in the received Bluetooth packet. operate.
- the time synchronization information (timestamp information) is carried in the Bluetooth message, and the master device sends the Bluetooth message carrying the time stamp information to the slave device, wherein the time stamp information indicates that the time stamp information is based on The sending time of the Bluetooth message determined by the clock of the master device.
- a bit in a certain byte in a certain field of the Bluetooth message can be used as the timing reference position for the sending time of the message. Since the Bluetooth message has different structures, as shown in Figure 2, The bluetooth packet P1 is the BLE physical layer, which is a bluetooth packet of the uncoded physical layer, and the bluetooth packet P2 is the BLE physical layer, which is a bluetooth packet of the coded physical layer. As shown in Figure 2, the composition structure of the Bluetooth message P1 is different from that of the Bluetooth message P2. Therefore, the timing reference position needs to be a position shared by the Bluetooth messages of different structures. Specifically, the access address in the Bluetooth message can be used. The sending time of the first bit is used as the sending time of the BLE Bluetooth message.
- the BLE Bluetooth packet P1 as shown in Figure 2 starts with a preamble field, and the preamble field is generally followed by an Access-Address field.
- the Preamble field is mainly used to synchronize the sending and receiving clock frequencies.
- the sending time of the first bit A1 of the access address in the BLE Bluetooth message P1 may be used as the sending time of the BLE Bluetooth message P1.
- the sending moment of the first bit A2 of the access address in the BLE Bluetooth packet P2 as shown in FIG. 2 is taken as the sending moment of the BLE Bluetooth packet P2.
- the sending time of the Bluetooth message can be determined, and the determined sending time of the Bluetooth message needs to be carried in the Bluetooth message as a timestamp, so that the receiving end can pass the Bluetooth message when receiving the Bluetooth message.
- the time stamp in the Bluetooth message determines the sending time of the Bluetooth message, that is, the receiving end can know the local time of the sending end when the sending end sends the Bluetooth message (standard time).
- the sending time of the Bluetooth message may be used as a timestamp and carried in a header (PDU header) of a protocol data unit (PDU, protocol Data Unit) of the Bluetooth message.
- the sending time of the Bluetooth message may be a preset time t A , that is, the preset Bluetooth message starts to be sent at a certain time (pre-start sending time t 0 ), so that the Bluetooth message is connected to the The first bit of the address is sent at time tA .
- the method for determining the transmission time t A of the first bit of the access address in the Bluetooth message is as follows:
- the composition structure of the Bluetooth message shown in FIG. 2 it can be determined that the area before the access address is the preamble, and the time TP that the preamble takes from the start of transmission to the completion of transmission can be determined according to the historical transmission data of the Bluetooth message, And determine the advance sending time of the Bluetooth message according to the time TP that the preamble takes from the start of sending to the completion of the sending.
- the time TP is determined, and the average transmission time ⁇ TP from the start of transmission of the preamble to the completion of the transmission is determined according to the above-mentioned multiple times TP .
- the sending time t A (t of the first bit of the access address in the Bluetooth message can be determined 0 + ⁇ TP ), and then when editing the Bluetooth message, the transmission time tA of the first bit of the access address obtained by the above calculation is carried in the PDU header of the Bluetooth message as a timestamp, and the The time stamp indicates that the sending time of the first bit of the access address in the Bluetooth message is t A .
- the above-mentioned time stamp information (which may include a time stamp and a time stamp) may be carried in the Bluetooth message by adding a field to the PDU header of the Bluetooth message.
- Bluetooth message type different Bluetooth message types have different PDU structures in the Bluetooth message.
- the structure of the PDU header in the Bluetooth broadcast message is shown in Figure 3a.
- U1a in Figure 3a when the Bluetooth packet type is a data packet, the structure of the PDU header in the Bluetooth data packet is as shown in U2a in Figure 3a.
- the above-mentioned newly-added fields as timestamp information may include a first field and a second field, where the first field and the second field are respectively a timestamp mark (TSI, Time Slot Indication) and a timestamp (TS, Time Slot Indication) ).
- the time stamp TSI indicates whether a time stamp is carried in the PDU header of the Bluetooth physical frame in the Bluetooth message. Specifically, if it is determined that the time stamp TSI is carried in the Bluetooth physical frame, it means that the Bluetooth physical frame also carries a time stamp. Timestamp TS, otherwise, there is no timestamp TS.
- the carried time stamp TS includes the sending time of the Bluetooth message, that is, the time stamp may be the sending time of the first bit of the access address of the Bluetooth message.
- the Bluetooth message can be a broadcast message and a data message, and both the broadcast message and the data message can carry the time indicating the sending moment of the first bit of the access address in the Bluetooth message stamp information.
- the PDU header in the broadcast message is shown as U1a in Figure 3a. By adding a field to the PDU header U1a, that is, the timestamp information T1 is encapsulated in the protocol data unit header.
- a PDU header U1b with time stamp information T1 is obtained from the above, wherein the time stamp information T1 may include a time stamp TSI and a time stamp TS.
- the PDU header in the broadcast message is shown as U2a in Figure 3a, by adding fields to the PDU header U2a, that is, encapsulating the timestamp information T2 in the protocol data unit header
- the PDU header U2b with the timestamp information T2 is obtained in .
- the receiving end of the Bluetooth message can determine whether there is a new field in the PDU header in the received Bluetooth message. Specifically, the receiving end can determine whether there is an indication time in the newly added field in the PDU header.
- the stamp marks the first field of the TSI, and if the first field exists, the corresponding information of the second field representing the timestamp in the newly added field is further obtained. On the contrary, if the receiving end determines that there are no newly added fields (the above-mentioned first field and second field) in the PDU header, the above-mentioned time stamp information is not carried in this Bluetooth message.
- the time stamp and the time stamp may be carried in the Bluetooth message without the above-mentioned method of adding fields, as follows:
- Fig. 3b shows a schematic structural diagram of a Bluetooth broadcast message provided by the present application.
- the information meaning indicated by the message type field shown in Fig. 3b can also be extended.
- the reserved bits of the message type are extended and used.
- the LSB 0001
- attribute values can be added to the LSB (lowest bit) field that indicates the message type in the PDU header.
- the LSB of the type is 1010
- the broadcast message type is a time-synchronized broadcast message
- the PDU header of the Bluetooth physical frame carries timestamp information (the sending time of the Bluetooth message).
- the slave device can adjust the local time to the sending time.
- the slave device determines that the broadcast message type is a time-synchronized broadcast message, and the PDU header of the Bluetooth physical frame carries timestamp information (the sending time of this Bluetooth message and the master-slave message). delay information between devices).
- the slave device can adjust the local time according to the sending time of the Bluetooth message in the timestamp information and the delay information between the master and slave devices, so as to realize the adjusted local time of the slave device and Time synchronization of the master device.
- Bluetooth message is a data message
- time synchronization is implemented based on the above-mentioned same principle, and details are not repeated here.
- 1 bit or more bits of the reserved field (RFU, reserved for future use) in the PDU header of the Bluetooth broadcast message as shown in FIG. 3b may also be used as the timestamp mark TSI.
- bit0 of the reserved field (RFU) in the PDU header of the Bluetooth broadcast message is used as TSI.
- the timestamp TS is carried.
- FIG. 3c shows a schematic diagram of the structure of the Bluetooth data packet provided by the present application.
- 1 bit or more bits in the reserved field in the PDU header of the Bluetooth data packet shown in FIG. 3c can be to mark the TSI as a timestamp.
- the timestamp information may be directly transmitted in the form of payload (payload) in the Bluetooth broadcast message or the Bluetooth data message. Specifically, if the Bluetooth broadcast message or the Bluetooth data message carries the time stamp TSI, the time stamp information is passed through the partial length ( N bits) or the full length to transfer.
- the present invention provides the following embodiments to illustrate the time synchronization between master and slave devices.
- the time synchronization method between the master and slave devices provided in the following embodiment 1 is provided without considering the transmission delay Delay between the master and slave devices and the time difference Offset caused by the frequency deviation between the clocks of the master and slave devices.
- FIG. 4 shows a schematic diagram of a time synchronization method provided by the present application.
- the master device sends a first Bluetooth message to the slave device, and the first Bluetooth message carries first time stamp information.
- the first time stamp information is the transmission time t 1 of the first bit of the access address of the first Bluetooth packet determined based on the clock of the master device.
- the slave device When receiving the first Bluetooth message sent by the master device, the slave device obtains the sending time t 1 in the first timestamp information in the first Bluetooth message, and the slave device sends the sending time carried in the first Bluetooth message t 1 is regarded as the reception time when the slave device receives the first Bluetooth message, that is, the slave device can correct the local time of the slave device when it obtains the sending time t 1 , specifically, it can be adjusted by the local time of the slave device. is the transmission time t 1 .
- the time synchronization method provided in the first embodiment, wherein the BLE transmission distance is generally ⁇ 100m, the wireless signal transmission speed is 3*10 ⁇ 8m/s, the transmission time required for a distance of 100m is 0.3uS, and the round-trip transmission delay ⁇ 1us. Therefore, the transmission delay is negligible relative to the 100uS synchronization requirement.
- the local time of the slave device is determined according to the timestamp sent by the master device through the Bluetooth message
- the correction is performed without acquiring network time and avoiding the uncertainty of BLE scheduling caused by the transmission time information band of the BLE data channel and the influence of the unfixed underlying transmission delay, and the time synchronization method provided in the first embodiment can meet the 100uS level time synchronization requirements for common scenarios.
- the time synchronization method between master and slave devices provided in the second embodiment below is provided.
- Fig. 5a shows a schematic diagram of another time synchronization method provided by the present application.
- the master device sends a first Bluetooth message to the slave device, and the first Bluetooth message carries first time stamp information
- the first time stamp information is the sending time t 1 of the master device
- the sending time t 1 is the sending time of the first bit of the access address of the first Bluetooth packet determined based on the clock of the master device.
- the slave device When receiving the first Bluetooth message sent by the master device, the slave device obtains the sending time t 1 in the first timestamp information in the first Bluetooth message, and the slave device sends the sending time carried in the first Bluetooth message t 1 is regarded as the receiving time when the slave device receives the first Bluetooth message, that is, the slave device can correct the local time of the slave device when it obtains the sending time t 1 , specifically, it can be pre-adjusted to the local time of the slave device.
- the local time of the slave device is the sending time t 1 , or the local time of the slave device can be pre-adjusted to the sending time t 1 +dt1, where dt1 is the sending time according to the first Bluetooth message after the slave device receives the first Bluetooth message
- Time t1 adjusts the processing time dt1 spent by the local time of the slave device, that is, the slave device starts timing when it receives the first Bluetooth packet, and ends the timing and determines the processing time dt1 before performing local time adjustment
- the device's local time is adjusted to send time t 1 +dt1.
- the master device Since the master device transmits the first Bluetooth packet to the slave device, there is a transmission delay Delay, so there is a time difference between the current local time of the slave device and the current local time of the master device, and the time difference is the transmission delay Delay.
- the slave device sends a second Bluetooth message to the master device, and the second Bluetooth message carries second time stamp information, and the second time stamp information represents the sending time t of the second Bluetooth message 2.
- the sending time t 2 is the sending time of the first bit of the access address of the second Bluetooth packet determined based on the current clock of the slave device.
- the master device determines, based on the local clock, a reception time t 3 at which the second Bluetooth message sent by the slave device is received, and acquires a transmission time t 2 carried in the second Bluetooth message.
- the master device determines the transmission delay between the master and slave devices according to the sending time t 1 of the first Bluetooth message, the sending time t 2 of the second Bluetooth message, and the receiving time t 3 of the second Bluetooth message.
- the calculation process is as follows:
- t 3 -t 1 is the time used for an information exchange between the master device and the slave device
- t 2 -t 1 is the local processing delay between the slave device receiving the first Bluetooth message and sending the second Bluetooth message
- t 2 - t 1 includes the processing time dt1 spent in adjusting the local time of the slave device
- T 1 represents the average one-way transmission delay between the master device and the slave device.
- the master device When the master device calculates the average one -way transmission delay T1 between the master device and the slave device, it sends a third Bluetooth packet to the slave device, where the third Bluetooth packet carries third time stamp information,
- the third time stamp information represents the average one-way transmission delay T 1 between the master device and the slave device.
- the time stamp information carried in the Bluetooth message can also be the corresponding information representing the time delay between the master and slave devices in addition to the information representing the sending time of the Bluetooth message.
- the average one-way transmission delay T 1 can also be the corresponding information representing the time delay between the master and slave devices in addition to the information representing the sending time of the Bluetooth message.
- the time stamp TS in the time stamp information may include, in addition to the information indicating the sending time of the Bluetooth message or the information indicating the delay between the master and slave devices, the corresponding information identifier, for example, in the time stamp TS at the same time It includes first information indicating the sending time of the Bluetooth message, first identification information indicating that the first information is the sending time of the Bluetooth message, second information indicating the transmission delay between the master and slave devices, and second information indicating the second information The second identification information of the transmission delay between the master and slave devices.
- the slave device may determine the received information type based on the above-mentioned identification information in the timestamp TS, and perform a corresponding time synchronization operation after determining the information type.
- the slave device receives the third Bluetooth message sent by the master device, obtains the average one-way transmission delay T 1 in the third time stamp, and corrects the local time of the slave device according to the average one-way transmission delay T 1 , Specifically, the average one-way transmission delay T 1 can be added to the current local time of the slave device (the current local time after any of the above pre-adjustments) to obtain the corrected local time of the slave device, thereby realizing
- the slave device time is time synchronized with the master device time.
- the above time synchronization method provided in the second application compared with the first embodiment, takes into account the transmission delay between the master and slave devices when synchronizing the time between the master and slave devices. After the time synchronization operation in the second embodiment, The time difference accuracy of the master-slave device is improved again, and the time synchronization method provided in the second embodiment can meet the time synchronization requirements of higher-precision scenarios.
- the following third embodiment provides a time synchronization method between master and slave devices.
- the above method is to calculate the delay information between the master device and the slave device on the master device side.
- the delay information between the master device and the slave device can also be calculated on the slave device side. details as follows:
- Fig. 5b shows a schematic diagram of another time synchronization method provided by the present application.
- the master device sends a first Bluetooth message to the slave device, and the first Bluetooth message carries first time stamp information
- the first time stamp information is the sending time t 1 of the master device
- the sending time t 1 is the sending time of the first bit of the access address of the first Bluetooth packet determined based on the clock of the master device.
- the slave device When receiving the first Bluetooth message sent by the master device, the slave device obtains the sending time t 1 in the first timestamp information in the first Bluetooth message, and the slave device sends the sending time carried in the first Bluetooth message t 1 is regarded as the receiving time when the slave device receives the first Bluetooth message, that is, the slave device can correct the local time of the slave device when it obtains the sending time t 1 , specifically, it can be pre-adjusted to the local time of the slave device.
- the local time of the slave device is the sending time t 1 , or the local time of the slave device can be pre-adjusted to the sending time t 1 +dt1, where dt1 is the sending time according to the first Bluetooth message after the slave device receives the first Bluetooth message
- Time t1 adjusts the processing time dt1 spent by the local time of the slave device, that is, the slave device starts timing when it receives the first Bluetooth packet, and ends the timing and determines the processing time dt1 before performing local time adjustment
- the device's local time is adjusted to send time t 1 +dt1.
- the master device Since the master device transmits the first Bluetooth packet to the slave device, there is a transmission delay Delay, so there is a time difference between the current local time of the slave device and the current local time of the master device, and the time difference is the transmission delay Delay.
- the slave device sends a second Bluetooth message to the master device, and the second Bluetooth message carries second time stamp information, and the second time stamp information represents the sending time t of the second Bluetooth message 2.
- the sending time t 2 is the sending time of the first bit of the access address of the second Bluetooth packet determined based on the current clock of the slave device.
- the master device After determining the reception time t3 of the second Bluetooth packet sent by the slave device based on the local clock, the master device sends a sixth Bluetooth packet to the slave device, where the sixth Bluetooth packet carries sixth time stamp information, and the The sixth time stamp information includes the reception time t 3 of the second Bluetooth message.
- the slave device After receiving the above-mentioned sixth Bluetooth message sent by the master device, the slave device obtains the reception time t 3 of the second Bluetooth message in the sixth time stamp information. Then, the transmission delay between the master and slave devices is determined according to the sending time t 1 of the first Bluetooth message, the sending time t 2 of the second Bluetooth message, and the receiving time t 3 of the second Bluetooth message, specifically , the calculation process is as follows:
- t 3 -t 1 is the time used for an information exchange between the master device and the slave device
- t 2 -t 1 is the local processing delay between the slave device receiving the first Bluetooth message and sending the second Bluetooth message
- t 2 - t 1 includes the processing time dt1 spent in adjusting the local time of the slave device
- T 1 represents the average one-way transmission delay between the master device and the slave device.
- the slave device corrects the local time of the slave device according to the average one-way transmission delay T 1 , which can be specifically added by adding the The average one-way transmission delay T 1 is used to obtain the corrected local time of the slave device, thereby realizing the time synchronization between the slave device time and the master device time.
- Fig. 6a shows a schematic diagram of another time synchronization method provided by the present application.
- the master device sends a first Bluetooth message to the slave device, and the first Bluetooth message carries first time stamp information
- the first time stamp information is the sending time t 1 of the master device
- the sending time t 1 is the sending time of the first bit of the access address of the first Bluetooth packet determined based on the clock of the master device.
- the slave device When receiving the first Bluetooth message, the slave device determines the reception time t 4 at which the first Bluetooth message is received based on its own clock.
- Delay Delay in order to achieve high-precision time synchronization, it is necessary to determine the time difference (frequency offset time difference) Offset caused by the transmission delay Delay and the frequency deviation between the clocks of the master and slave devices. Adjust the local time of the slave device to synchronize the time between the slave device and the master device.
- the slave device sends a fourth Bluetooth message to the master device, where the fourth Bluetooth message carries fourth time stamp information, and the fourth time stamp information includes: The receiving time t 4 of a Bluetooth message and the sending time t 5 of the fourth Bluetooth message.
- the master device When receiving the fourth Bluetooth message, the master device determines the reception time t 6 of the fourth Bluetooth message based on the local clock, and obtains the reception time t of the first Bluetooth message in the fourth timestamp in the fourth Bluetooth message 4 and the sending time t 5 of the fourth Bluetooth message.
- the master device can be based on the time t 1 when the master device sends the first Bluetooth message, the time t 4 when the slave device receives the first Bluetooth message, the time t 5 when the slave device sends the fourth Bluetooth message, and the time t 5 when the master device receives the fourth Bluetooth message.
- Time t 6 of the Bluetooth message determines the following information:
- the master device can also be based on the time t 1 when the master device sends the first Bluetooth message, the time t 4 when the slave device receives the first Bluetooth message, the time t 5 when the slave device sends the fourth Bluetooth message, and the master device.
- the time t6 when the fourth Bluetooth message is received is calculated to obtain the average one - way transmission delay Delay and the frequency offset time difference Offset between the master device and the slave device, and the specific calculation process is as follows:
- T 2 represents the average one-way transmission delay Delay between the master device and the slave device
- T 3 represents the frequency offset time difference Offset between the master device and the slave device.
- the master device When the master device calculates the average one-way transmission delay Delay between the master device and the slave device, and the frequency offset time difference Offset between the master device and the slave device, it sends a fifth Bluetooth message to the slave device. 5.
- the Bluetooth packet carries a fifth time stamp, and the fifth time stamp includes the average one-way transmission delay Delay between the master device and the slave device, the frequency offset time difference Offset between the master device and the slave device, and the transmission by the master device. Time t 7 of the fifth Bluetooth message.
- the time stamp TS in the time stamp information may include, in addition to the information indicating the sending time of the Bluetooth message or the information indicating the delay between the master and slave devices, the corresponding information identifier, for example, in the time stamp TS at the same time It includes first information indicating the sending time of the Bluetooth message, first identification information indicating that the first information is the sending time of the Bluetooth message, second information indicating the transmission delay between the master and slave devices, and second information indicating the second information The second identification information of the transmission delay between the master and slave devices, the third information representing the frequency offset time difference between the master and slave devices, and the third identification information representing the frequency offset time difference between the master and slave devices.
- the slave device may determine the received information type based on the above-mentioned identification information in the timestamp TS, and perform a corresponding time synchronization operation after determining the information type.
- the slave device determines, based on its own clock, that it has received the fifth Bluetooth packet sent by the master device at time t 8 , and obtains the average one-way transmission delay Delay between the master device and the slave device in the fifth timestamp, the master device and the slave device.
- the frequency offset time difference Offset between the slave devices When the slave device receives the fifth Bluetooth packet, it adjusts the slave device's local time to (t 8 +Offset) based on the local time of the slave device and the frequency offset time difference Offset between the master and slave devices.
- the transmission delay Delay when the message is sent to the slave device, and the transmission delay Delay is further eliminated on the basis of (t 8 +Offset), that is, when the slave device receives the fifth Bluetooth message, it adjusts the local time to ( t 8 +Offset)+Delay.
- the local data processing delay dt2 can be further eliminated on the basis of (t 8 +Offset)+Delay.
- the dt2 is for the slave device to adjust the local time t 8 to ( t 8 +Offset)+Delay processing time dt2.
- the third embodiment not only considers the transmission delay delay between the master and slave devices, but also considers the master and slave devices when synchronizing the time between the master and slave devices. For the time difference Offset caused by the frequency deviation between the clocks of the slave devices, after the time synchronization operation in the third embodiment, the time difference accuracy of the master and slave devices is improved again, and the time synchronization method provided in the third embodiment can meet the time of higher precision scenarios. synchronization requirements.
- the above method is to calculate the delay information between the master device and the slave device on the master device side.
- the delay information between the master device and the slave device can also be calculated on the slave device side. details as follows:
- Fig. 6b shows a schematic diagram of another time synchronization method provided by the present application.
- the master device sends a first Bluetooth message to the slave device, and the first Bluetooth message carries first time stamp information
- the first time stamp information is the sending time t 1 of the master device
- the sending time t 1 is the sending time of the first bit of the access address of the first Bluetooth packet determined based on the clock of the master device.
- the slave device When receiving the first Bluetooth message, the slave device determines the reception time t 4 at which the first Bluetooth message is received based on its own clock.
- Delay Delay in order to achieve high-precision time synchronization, it is necessary to determine the time difference (frequency offset time difference) Offset caused by the transmission delay Delay and the frequency deviation between the clocks of the master and slave devices. Adjust the local time of the slave device to synchronize the time between the slave device and the master device.
- the slave device sends a fourth Bluetooth message to the master device, where the fourth Bluetooth message carries fourth time stamp information, and the fourth time stamp information includes: The receiving time t 4 of a Bluetooth message and the sending time t 5 of the fourth Bluetooth message.
- the master device After the master device determines the reception time t6 of the fourth Bluetooth message based on the local clock when receiving the fourth Bluetooth message, the master device sends a seventh Bluetooth message to the slave device, and the seventh Bluetooth message carries the seventh Bluetooth message. timestamp information, and the seventh timestamp information includes the reception time t 6 of the above-mentioned fourth Bluetooth message.
- the slave device determines, based on its own clock, that it has received the seventh Bluetooth message at time t8, and the slave device obtains the fourth Bluetooth message in the seventh time stamp information after receiving the seventh Bluetooth message sent by the master device.
- the reception time t 6 of the message Further, the slave device can determine the following according to the time t 1 of the first Bluetooth message, the time t 4 of the first Bluetooth message, the time t 5 of the fourth Bluetooth message, and the time t 6 of the fourth Bluetooth message. information:
- the slave device may also be based on the time t 1 of the first Bluetooth message, the reception time t 4 of the first Bluetooth message, the time t 5 of the fourth Bluetooth message, and the time of the fourth Bluetooth message.
- t 6 Calculate the average one-way transmission delay Delay and frequency offset time difference Offset between the master device and the slave device. The specific calculation process is as follows:
- T 2 represents the average one-way transmission delay Delay between the master device and the slave device
- T 3 represents the frequency offset time difference Offset between the master device and the slave device.
- the slave device can adjust the local time of the slave device to (t 8 +Offset) based on the local time of the slave device and the frequency offset time difference Offset between the master and slave devices. Since the master device sends the fifth Bluetooth packet to the slave device, there is a transmission on the way. For the delay Delay, the transmission delay Delay is further eliminated on the basis of (t 8 +Offset), that is, when the slave device receives the fifth Bluetooth packet, the local time is adjusted to (t 8 +Offset)+Delay. In this synchronization process, there is also a local data processing delay, and the local data processing delay dt2 can be further eliminated on the basis of (t 8 +Offset)+Delay. The dt2 is for the slave device to adjust the local time t 8 to ( t 8 +Offset)+Delay processing time dt2.
- FIG. 7a is a schematic structural diagram of an electronic device provided by an embodiment of the application.
- the electronic device can be It includes a processor 701 and a memory 702, wherein the memory 702 is used to store at least one instruction, and the above-mentioned instruction is loaded and executed by the processor 701 to implement any of the above-mentioned time synchronization operations provided in this application.
- another embodiment of the present application provides an electronic device as shown in FIG. 7b
- the electronic device may be the above-mentioned slave device or the above-mentioned master device, as shown in FIG. 7b
- the electronic device may include a BLE Bluetooth module 30, a controller c1, and a plurality of sensors Sen1 ⁇ Senn.
- the processor 701 and the memory 702 in the embodiment shown in FIG. 7a are packaged together to form the controller c1 in the embodiment shown in FIG. 7b, and the slave device shown in FIG.
- the master device shown in FIG. 7b communicates to implement any of the above-mentioned time synchronization operations provided in this application.
- the smart wearable device has multiple sensors, for example, a smart watch or a wristband includes an IMU sensor (Inertial Measurement Unit, inertial measurement unit), a PPG sensor (photoplethysmography, optical plethysmography) technique), in which the IMU sensor can be used to measure the motion state of the human body, and the PPG sensor can be used to measure the human body's heart rate.
- the sensor is generally connected to the controller through a digital interface (receives the controller's instructions, transmits configuration data, sampling data, status information, etc. to the controller), and the digital interface is generally a low-speed serial interface (such as SPI or I2C).
- the sensor generally also integrates a micro controller inside to complete the internal configuration and control of the sensor itself.
- the sensor can generally use a built-in clock signal or an external clock signal, and the external clock signal is generally provided by the controller of the smart wearable device or the clock on the motherboard.
- the sampling time of each sensor is different, and the delay of the internal signal chain of the sensor is different, including the delay of the Analog Front End (AFE).
- AFE Analog Front End
- Option 1 Pass time synchronization information through a separate pin, as shown in Figure 8.
- a time synchronization pin is added to the interfaces of the sensors Sen1 to Senn and the controller c1, and the controller c1 periodically sends time synchronization information to the sensors Sen1 to Senn.
- the time synchronization signal may be one or more pulse signals, or a level signal or the like.
- the sensors Sen1 to Senn can perform data sampling in two ways. The first is to reset the internal counter each time a time synchronization signal is received. This internal counter is used to divide the frequency of the internal clock or the external clock. The frequency-divided signal is used as the sampling clock of the sensors Sen1 to Senn, and the sensors Sen1 to Senn are sampled with this sampling clock. The second is that the sensors Sen1 to Senn are sampled based on the internal clock or external clock. When receiving the time synchronization information, the time delay is recorded in the current sampling or the next sampling (for example, the delay of recording the current sampling or the next sampling relative to the time synchronization information is recorded). number of internal or external clock cycles). The current sampling indicates that the sensors Sen1 to Senn perform a time synchronization operation according to the information sent by the master device before the sampling ends.
- the sensors Sen1 to Senn upload data to the controller c1
- the first way is to add a bit to each sampled data to identify whether the sampled data is the first sampled data or the latest sampled data after receiving the time synchronization information.
- Second, when transmitting sampled data additionally transmit one or more bytes of data to identify which data (for example, the Nth) is the first sample after receiving the time synchronization information in the transmitted data. data or the most recent sampled data.
- the sampling offset time information can be transmitted to the controller c1 (the offset time of the sampling time relative to the first sampling data or the latest sampling data when the time synchronization information is received, or the sampling time relative to the receiving time. The offset time of the first sampled data or the latest sampled data when synchronizing the information + the delay time of the signal path of the AFE).
- Option 2 Send time synchronization information through the signal line of the serial communication interface
- serial peripheral interface SPI, Serial Peripheral Interface
- chip select signal CS, chip select
- MISO Master Input Slave Output
- MOSI Master Output Slave Input
- CLK clock signal
- any one signal or a combination of signals is multiplexed to transmit time synchronization information, for example, multiple narrow pulses can be sent continuously on CS to transmit time synchronization information, or when CS is disabled , the time synchronization information is transmitted by pulling MISO, MOSI, and CLK low at the same time.
- time synchronization information can be transmitted by multiplexing any one of the serial data line signal (SCL), the serial clock line signal (SDA), or a combination of signals.
- SCL serial data line signal
- SDA serial clock line signal
- Start or Stop signals can be sent continuously within a certain period of time to transmit the time synchronization message.
- Time synchronization information is transmitted through control commands. For example, write a set value to the set address (eg, write 0xaa to 0x6f). It can be agreed that the starting position of the time synchronization information is a certain setting position of the sent control command. For example, for the I2C interface, it can be agreed that the position of the Start signal to send the control command or the R/W to indicate the BIT position.
- the present application also provides a sports health monitoring system, which can be used to obtain high-precision comprehensive sports posture and/or health assessment information of a user.
- the system includes a master device and one or more slave devices.
- the structure of the system can be shown in Figure 1.
- the slave device in the system can be a smart wearable device, and the slave device can be a smart phone, as shown in Figure 1, wherein the above system can be It includes the smart phone M1 as the master device, and the smart wearable devices S1, S2, S3 and S4 as the slave devices.
- the master device is not limited to a smart phone, but can also be other smart mobile terminals.
- the master and slave devices are all smart wearable devices.
- FIG. 9 shows a schematic diagram of signaling of sampling control of a sports health monitoring system provided by an embodiment of the present application.
- the sports health monitoring system includes a master device and multiple slave devices, and completes data through the following steps Sampling, data upload and data fusion processing:
- Step S1 the master device sends a Bluetooth message carrying time synchronization information to the slave device;
- Step S2 the slave device performs time synchronization with the master device based on the received time synchronization information
- Step S3 the controller c1 sends time synchronization information to one or more sensors Sen1 to Senn;
- Step S4 the sensors Sen1 to Senn adjust the internal clock to achieve time synchronization with the controller
- Step S5 sampling according to the internal clock, and uploading the sampling data to the controller c1;
- Step S6 adding a timestamp to the sampling data according to the sampling time of the sampling data
- Step S7 transmitting the sampled data with the timestamp to the master device
- Step S8 Perform data fusion processing on the sampled data (sensor data with time stamps) sent by the multiple sensors Sen1 to Senn.
- the time synchronization between the master and slave devices can be performed according to any one of the above-mentioned time synchronization methods in the first embodiment, the second embodiment or the third embodiment, and the time synchronization process is not repeated here.
- step S3-S8 After the master and slave devices complete the time synchronization, the operation process of the corresponding data interaction performed by the master and slave devices is as follows (steps S3-S8):
- the BLE time synchronization method is used for synchronization between the master device (Master) and one or more slave devices (Slave), wherein the above-mentioned time synchronization operation (such as Embodiment 1 to Embodiment 1) can be provided for the slave device according to the present application. Any one of 3) realizes time synchronization with the master device, and can periodically perform the above time synchronization operation as .
- the controller c1 inside the device periodically transmits time synchronization messages to the sensors Sen1 to Senn.
- the sensors synchronize the time of the sensors to the controller according to the time synchronization messages, and perform sampling based on the time-synchronized internal clock. Specifically, after the sensors Sen1 to Senn receive the time synchronization message, they are used to reset the frequency division counter of the sampling clock, or record the first sampling data or the latest sampling data mark after the time synchronization message, and optionally record the time synchronization message after receiving the time synchronization message.
- the sampling time offset of the first sample or the most recent sample relative to the time synchronization message are used to reset the frequency division counter of the sampling clock, or record the first sampling data or the latest sampling data mark after the time synchronization message.
- the sensors Sen1 to Senn time stamp the sampled data (for example, the sampling data point when the time synchronization message is received can be marked), and transmit the marked data to the controller c1.
- the controller c1 adds time stamps to the sensor sampling data. For example, assuming that there are 100 pieces of data in the time [T, T+10 seconds] and the sampling rate is 10Hz, the start time T or end time T+10 seconds of the 100 pieces of data can be used as a timestamp and added to the time stamp to be transmitted to the host. device data.
- the controller c1 of the slave device passes the time stamped data to the master device.
- the master device performs fused data processing according to the sample data uploaded by multiple slave devices with time-synchronized timestamp information. For example, according to the data uploaded by the wearable devices on the hands and feet, the fusion processing calculates the motion state of the limbs or the coordination of the limbs of the user at that time.
- the multiple sensors of multiple wearable devices can be detected at multiple points simultaneously, which can meet the needs of ordinary scenes or high-speed motion scenes.
- the application may be an application program (nativeApp) installed on the terminal, or may also be a web page program (webApp) of a browser on the terminal, which is not limited in this application.
- nativeApp application program
- webApp web page program
- the disclosed system, apparatus and method may be implemented in other manners.
- the apparatus embodiments described above are only illustrative.
- the division of the units is only a logical function division. In actual implementation, there may be other division methods.
- multiple units or components may be combined. Either it can be integrated into another system, or some features can be omitted, or not implemented.
- the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
- the units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
- each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
- the above-mentioned integrated unit may be implemented in the form of hardware, or may be implemented in the form of hardware plus software functional units.
- the above-mentioned integrated units implemented in the form of software functional units can be stored in a computer-readable storage medium.
- the above-mentioned software functional unit is stored in a storage medium, and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (Processor) to execute the methods described in the various embodiments of the present invention. some steps.
- the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes .
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
本申请提供一种时间同步方法及控制装置、设备、存储介质,基于从设备的时间同步方法包括获取主设备发送的第一蓝牙报文,其中,第一蓝牙报文携带第一时间戳信息,第一时间戳信息表示基于主设备的时钟所确定的第一蓝牙报文的发送时刻t1;以及根据第一时间戳信息对从设备的本地时间进行修正。可以在无需获取网络时间的情况下,通过主从设备间的蓝牙报文中添加的时间戳进行主从设备的时间同步,并且通过发送蓝牙报文的方式克服现有技术中无法满足ms级高精度需求的问题,通过上述时间同步方法可以使智能穿戴设备实现高精度的综合运动姿态和健康评估功能。
Description
本发明涉及时间同步技术领域,尤其涉及一种时间同步方法及控制装置、设备、存储介质。
运动特性是智能穿戴设备的主要功能。当前的智能手表、手环、戒指、耳机等智能穿戴设备可提供计步等基础运动特性。由于绝大部分运动都是身体多个部位的运动,当前的穿戴设备只能支持单点运动检测,无法提供运动状态下,人体多个部分的运动姿态评估。当用户佩戴多个智能穿戴设备,只能单独提供每个智能穿戴设备的检测结果,缺少高精度的综合运动姿态和健康评估功能。若想获得该高精度的综合运动姿态和健康评估信息,需要多个穿戴设备的多个传感器多点同步检测,需要多传感器间有精确的时间同步。
目前蓝牙标准中没有时间同步的机制,现有技术中主设备通过在应用层获取网络时钟参考(Network Time Reference,NTR),并通过BLE数据通道将NTR发送给需要时间同步的从设备。或者是每个设备分别获取标准时间,根据该标准时间调整本地时间,以实现多设备之间的时间同步。
现有技术中的上述方案存在以下缺陷:
若通过获取网络时间进行时间同步,则需要获取网络时间的设备需增设网络时间入口,然而大多数应用不需要网络时间,且通过数据通道传输时间信息受到BLE调度的不确定性和底层传输时延不固定的影响,时间精度差,无法满足ms级高精度需求。
申请内容
本申请提供一种时间同步方法及控制装置、设备、存储介质,其中该时间同步方法,可以在主从设备之间发送的蓝牙报文的物理帧中添加时间戳信息,该时间戳信息为该条蓝牙报文的发送时刻,从设备根据主设备发送的蓝牙报文中的时间戳信息对从设备的本地时间进行修正。可以在无需获取网络时间的情况下,通过主从设备间的蓝牙报文中添加的时间戳进行主从设备的时间同步,并且通过发送蓝牙报文的方式克服现有技术中无法满足ms级高精度需求的问题,通过上述时间同步方法可以使智能穿戴设备实现高精度的综合运动姿态和健康评估功能。
第一方面,本申请提供一种时间同步方法,方法包括:
第一电子设备获取第二电子设备发送的第一蓝牙报文,其中,第一蓝牙报文携带第一时间戳信息,第一时间戳信息表示第一蓝牙报文的发送时刻t
1,第一时间戳信息为第一蓝牙报文中蓝牙物理帧的协议数据单元中的字段;以及
第一电子设备根据第一时间戳信息对第一电子设备的本地时间进行修正;
其中,第一蓝牙报文的发送时刻t
1通过下方式确定:
第二电子设备向第一电子设备发送第一蓝牙报文前,获取第二电子设备的时钟信息,并基于第二电子设备的时钟信息确定第一蓝牙报文的预开始发送时刻;以及
第二电子设备根据第一蓝牙报文的预开始发送时刻确定第一蓝牙报文中接入地址的第一比特的发送时刻,并将确定的第一蓝牙报文中接入地址的第一比特的发送时刻作为第一蓝牙报文的发送时刻t
1。
进一步地,字段包括第一字段和第二字段;
第一字段和第二字段分别为时间戳标记和时间戳,时间戳标记表示蓝牙物理帧携带时间戳,时间戳包括发送时刻t
1。
进一步地,根据第一时间戳信息对从设备的本地时间进行修正包括:
将发送时刻t
1作为第一电子设备的当前本地时间。
进一步地,根据第一时间戳信息对从设备的本地时间进行修正之后还包括:
向第二电子设备发送第二蓝牙报文,其中,第二蓝牙报文携带第二时间戳信息,第二时间戳信息表示第二蓝牙报文的发送时刻t
2,第二蓝牙报文的发送时刻t
2为第二蓝牙报文中接入地址的第一个比特的发送时刻;
获取第二电子设备发送的第三蓝牙报文,其中,第三蓝牙报文携带第三时间戳信息,第三时间戳信息表示第二电子设备与第二电子设备之间的平均单向传输时延;以及
根据平均单向传输时延对第一电子设备的本地时间进行修正。
第二方面,本申请还提供一种时间同步方法,包括:
第一电子设备获取第二电子设备发送的第一蓝牙报文,其中,第一蓝牙报文携带第一时间戳信息,第一时间戳信息表示基于第二电子设备的时钟信息所确定的第一蓝牙报文的发送时刻t
1,第一时间戳信息为第一蓝牙报文中蓝牙物理帧的协议数据单元中的字段;
其中,第一蓝牙报文的发送时刻t
1通过下方式确定:
第二电子设备向第一电子设备发送第一蓝牙报文前,获取第二电子设备的时钟信息,并基于第二电子设备的时钟信息确定第一蓝牙报文的预开始发送时刻;以及
第二电子设备根据第一蓝牙报文的预开始发送时刻确定第一蓝牙报文中接入地址的第一比特的发送时刻,并将确定的第一蓝牙报文中接入地址的第一比特的发送时刻作为第一蓝牙报文的发送时刻t
1;
第一电子设备基于本地时钟确定接收到第一蓝牙报文的接收时刻t
4;
向第二电子设备发送的第四蓝牙报文,其中,第四蓝牙报文携带第四时间戳信息,第四时间戳信息中包括第一蓝牙报文的接收时刻t
4和第四蓝牙报文的发送时刻t
5,发送时刻t5为第四蓝牙报文中接入地址的第一个比特的发送时刻;
第一电子设备获取第二电子设备发送的第五蓝牙报文,其中第五蓝牙报文携带第五时间戳信息,第五时间戳信息包括第二电子设备与第一电子设备之间的平均单向传输时延、第二电子设备与第一电子设备之间的频偏时差以及第四蓝牙报文的接收时刻t
6;
第一电子设备根据平均单向传输时延、频偏时差以及第四蓝牙报文的接收时刻t
6对第一电子设备的本地时间进行修正。
第三方面,本申请还提供一种时间同步方法,包括:
第二电子设备向第一电子设备发送第一蓝牙报文前,获取第二电子设备的时钟信息,并基于第二电子设备的时钟信息确定第一蓝牙报文的预开始发送时刻;
第二电子设备根据第一蓝牙报文的预开始发送时刻确定第一蓝牙报文中接入地址的第一比特的发送时刻,并将确定的第一蓝牙报文中接入地址的第一比特的发送时刻作为第一蓝牙报文的发送时刻t
1;以及
第二电子设备在第一蓝牙报文的预开始发送时刻开始向第一电子设备发送第一蓝牙报文,其中,第一蓝牙报文携带第一时间戳信息,第一时间戳信息表示第一蓝牙报文的发送时刻t
1,且第一时间戳信息为第一蓝牙报文中蓝牙物理帧的协议数据单元中的字段。
进一步地,字段包括第一字段和第二字段;
第一字段和第二字段分别为时间戳标记和时间戳,时间戳标记表示蓝牙物理帧携带时间戳,时间戳包括第一蓝牙报文的发送时刻t
1。
进一步地,第二电子设备在第一蓝牙报文的预开始发送时刻开始向第一电子设备发送第一蓝牙报文之后,还包括:
第二电子设备获取第一电子设备发送的第二蓝牙报文,其中,第二蓝牙报文携带第二时间戳信息,第二时间戳信息表示第二蓝牙报文的发送时刻t
2;
第二电子设备基于第二电子设备的时钟信息确定接收到第二蓝牙报文的接收时刻t
3,根据第一蓝牙报文的发送时刻t
1、第二蓝牙报文的发送时刻t
2以及第二蓝牙报文的接收时刻t
3计算第二电子设备与第一电子设备之间的平均单向传输时延;
第二电子设备向第一电子设备发送第三蓝牙报文,其中第三蓝牙报文携带第三时间戳信息,第三时间戳信息表示第二电子设备与第一电子设备之间的平均单向传输时延。
进一步地,根据第一蓝牙报文的发送时刻t
1、第二蓝牙报文的发送时刻t
2以及第二蓝牙报文的接收时刻t
3计算第二电子设备与第一电子设备之间的平均单向传输时延包括通过以下公式计算:
其中,T
1表示第二电子设备与第一电子设备之间的平均单向传输时延。
第四方面,本申请还提供一种时间同步方法,包括:
第二电子设备向第一电子设备发送第一蓝牙报文前,获取第二电子设备的时钟信息,并基于第二电子设备的时钟信息确定第一蓝牙报文的预开始发送时刻;
第二电子设备根据第一蓝牙报文的预开始发送时刻确定第一蓝牙报文中接入地址的第一比特的发送时刻,并将确定的第一蓝牙报文中接入地址的第一比特的发送时刻作为第一蓝牙报文的发送时刻t
1;
第二电子设备在第一蓝牙报文的预开始发送时刻开始向第一电子设备发送第一蓝牙报文,其中,第一蓝牙报文携带第一时间戳信息,第一时间戳信息表示第一蓝牙报文的发送时刻t
1,且第一时间戳信息为第一蓝牙报文中蓝牙物理帧的协议数据单元中的字段;
第二电子设备获取第一电子设备发送的第四蓝牙报文,其中,第四蓝牙报文携带第四时间戳信息,第四蓝牙报文携带第四时间戳信息,第四时间戳信息中包括第一蓝牙报文的接收时刻t
4和第四蓝牙报文的发送时刻t
5;
第二电子设备基于第二电子设备的时钟信息确定接收到第四蓝牙报文的接收时刻t
6,根据第一蓝牙报文的发送时刻t
1、第一蓝牙报文的接收时刻t
4、第四蓝牙报文的发送时刻t
5以及第四蓝牙报文的接收时刻t
6计算第二电子设备与第一电子设备之间的平均单向传输时延和第二电子设备与第一电子设备之间的频偏时差,频偏时差为时钟间的频率偏差导致的时间偏差;
第二电子设备向第一电子设备发送第五蓝牙报文,其中第五蓝牙报文携带第五时间戳信息,第五时间戳信息包括第一电子设备与第二电子设备之间的平均单向传输时延、第二电子设备与第一电子设备之间的频偏时差以及第四蓝牙报文的接收时刻t
6。
进一步地,根据发送时刻t
1、接收时刻t
4、发送时刻t
5以及接收时刻t
6计算第二电子设备与第一电子设备之间的平均单向传输时延和第二电子设备与第一电子设备之间的频偏时差包括通过以下公式计算:
其中,T
2表示第二电子设备与第一电子设备之间的平均单向传输时延;
其中,T
3表示第二电子设备与第一电子设备之间的频偏时差。
第五方面,本申请提供一种电子设备,包括:
处理器和存储器,存储器用于存储至少一条指令,指令由处理器加载并执行时以实现如下方法中的任一者:
上述第一方面提供的时间同步方法;
上述第二方面提供的时间同步方法;
上述第三方面提供的时间同步方法;或者
上述第四方面提供的时间同步方法。
第六方面,本申请提供一种计算机可读存储介质,其上存储有计算机程序,当其在计算机上运行时,使得计算机执行时实现如下方法中的任一者:
上述第一方面提供的时间同步方法;
上述第二方面提供的时间同步方法;
上述第三方面提供的时间同步方法;或者
上述第四方面提供的时间同步方法。
在一种可能的设计中,第六方面中的程序可以全部或者部分存储在与处理器封装在一起的存储介质上,也可以部分或者全部存储在不与处理器封装在一起的存储器上。
通过上述技术方案,从设备在接收到主设备发送的携带时间戳信息的蓝牙报文的情况下,可以根据主设备发送的蓝牙报文中的时间戳信息对从设备的本地时间进行修正。在无需获取网络时间的情况下,通过主从设备间的蓝牙报文中添加的时间戳进行主从设备的时间同步,并且通过发送蓝牙报文的方式克服现有技术中无法满足ms级高精度需求的问题,通过上述时间同步方法可以使智能穿戴设备实现高精度的综合运动姿态和健康评估功能。
上述技术方案为在第二电子设备一侧计算第一电子设备和第二电子设备之间的时延信息,在另一种实现方式中,还可以在第一电子设备一侧计算上述第一电子设备和第二电子设备之间的时延信息,具体如下:
第七方面,本申请还提供一种时间同步方法,包括:
第一电子设备获取第二电子设备发送的第一蓝牙报文,其中,第一蓝牙报文携带第一时间戳信息,第一时间戳信息表示第一蓝牙报文的发送时刻t
1,第一时间戳信息为第一蓝牙报文中蓝牙物理帧的协议数据单元中的字段;
其中,第一蓝牙报文的发送时刻t
1通过下方式确定:
第二电子设备向第一电子设备发送第一蓝牙报文前,获取第二电子设备的时钟信息,并基于第二电子设备的时钟信息确定第一蓝牙报文的预开始发送时刻;以及
第二电子设备根据第一蓝牙报文的预开始发送时刻确定第一蓝牙报文中接入地址的第一比特的发送时刻,并将确定的第一蓝牙报文中接入地址的第一比特的发送时刻作为第一蓝牙报文的发送时刻t
1;
第一电子设备根据第一时间戳信息对第一电子设备的本地时间进行修正;
第一电子设备向第二电子设备发送第二蓝牙报文,其中,第二蓝牙报文携带第二时间戳信息,第二时间戳信息表示第二蓝牙报文的发送时刻t
2,第二蓝牙报文的发送时刻t
2为第二蓝牙报文中接入地址的第一个比特的发送时刻;
第一电子设备获取第二电子设备发送的第六蓝牙报文,其中,第六蓝牙报文携带第六时间戳信息,第六时间戳信息表示第二蓝牙报文的接收时刻t
3,第二蓝牙报文的接收时刻t
3为第二电子设备基于第二电子设备的时钟信息确定的接收到第二蓝牙报文的接收时刻t
3;
第一电子设备根据第一蓝牙报文的发送时刻t
1、第二蓝牙报文的发送时刻t
2以及第二蓝牙报文的接收时刻t
3计算第二电子设备与第一电子设备之间的平均单向传输时延;以及
根据平均单向传输时延对第一电子设备的本地时间进行修正。
进一步地,根据第一蓝牙报文的发送时刻t
1、第二蓝牙报文的发送时刻t
2以及第二蓝牙报文的接收时刻t
3计算第二电子设备与第一电子设备之间的平均单向传输时延包括通过以下公式计算:
其中,T
1表示第二电子设备与第一电子设备之间的平均单向传输时延。
第八方面,本申请还提供一种时间同步方法,包括:
第一电子设备获取第二电子设备发送的第一蓝牙报文,其中,第一蓝牙报文携带第一时间戳信息,第一时间戳信息表示基于第二电子设备的时钟信息所确定的第一蓝牙报文的发送时刻t
1,第一时间戳信息为第一蓝牙报文中蓝牙物理帧的协议数据单元中的字段;
其中,第一蓝牙报文的发送时刻t
1通过下方式确定:
第二电子设备向第一电子设备发送第一蓝牙报文前,获取第二电子设备的时钟信息,并基于第二电子设备的时钟信息确定第一蓝牙报文的预开始发送时刻;以及
第二电子设备根据第一蓝牙报文的预开始发送时刻确定第一蓝牙报文中接入地址的第一比特的发送时刻,并将确定的第一蓝牙报文中接入地址的第一比特的发送时刻作为第一蓝牙报文的发送时刻t
1;
第一电子设备基于本地时钟确定接收到第一蓝牙报文的接收时刻t
4;
第一电子设备向第二电子设备发送的第四蓝牙报文,其中,第四蓝牙报文携带第四时间戳信息,第四时间戳信息中包括第一蓝牙报文的接收时刻t
4和第四蓝牙报文的发送时刻t
5,发送时刻t
5为第四蓝牙报文中接入地址的第一个比特的发送时刻;
第一电子设备获取第二电子设备发送的第七蓝牙报文,其中,第七蓝牙报文中携带第七时间戳信息,第七时间戳信息表示第四蓝牙报文的接收时刻t
6,第四蓝牙报文的接收时刻t
6为第二电子设备基于第二电子设备的时钟信息确定的接收到第二蓝牙报文的接收时刻t
6;
第一电子设备根据第一蓝牙报文的发送时刻t
1、第一蓝牙报文的接收时刻t
4、第四蓝牙报文的发送时刻t
5以及第四蓝牙报文的接收时刻t
6计算第二电子设备与第一电子设备之间的平均单向传输时延和第二电子设备与第一电子设备之间的频偏时差,频偏时差为时钟间的频率偏差导致的时间偏差;
第一电子设备根据平均单向传输时延、频偏时差以及第四蓝牙报文的接收时刻t
6对第一电子设备的本地时间进行修正。
进一步地,根据发送时刻t
1、接收时刻t
4、发送时刻t
5以及接收时刻t
6计算第二电子设备与第一电子设备之间的平均单向传输时延和第二电子设备与第一电子设备之间的频偏时差包括通过以下公式计算:
其中,T
2表示第二电子设备与第一电子设备之间的平均单向传输时延;
其中,T
3表示第二电子设备与第一电子设备之间的频偏时差。
第九方面,本申请还提供一种时间同步方法,包括:
第二电子设备向第一电子设备发送第一蓝牙报文前,获取第二电子设备的时钟信息,并基于第二电子设备的时钟信息确定第一蓝牙报文的预开始发送时刻;
第二电子设备根据第一蓝牙报文的预开始发送时刻确定第一蓝牙报文中接入地址的第一比特的发送时刻,并将确定的第一蓝牙报文中接入地址的第一比特的发送时刻作为第一蓝牙报文的发送时刻t
1;以及
第二电子设备在第一蓝牙报文的预开始发送时刻开始向第一电子设备发送第一蓝牙报文,其中,第一蓝牙报文携带第一时间戳信息,第一时间戳信息表示第一蓝牙报文的发送时刻t
1,且第一时间戳信息为第一蓝牙报文中蓝牙物理帧的协议数据单元中的字段;
第二电子设备获取第一电子设备发送的第二蓝牙报文,其中,第二蓝牙报文携带第二时间戳信息,第二时间戳信息表示第二蓝牙报文的发送时刻t
2;
第二电子设备基于第二电子设备的时钟信息确定接收到第二蓝牙报文的接收时刻t
3;
第二电子设备向第一电子设备发送第六蓝牙报文,其中,该第六蓝牙报文中携带第六时间戳信息,第六时间戳信息表示第二蓝牙报文的接收时刻t
3。
第十方面,本申请还提供一种时间同步方法,包括:
第二电子设备向第一电子设备发送第一蓝牙报文前,获取第二电子设备的时钟信息,并基于第二电子设备的时钟信息确定第一蓝牙报文的预开始发送时刻;
第二电子设备根据第一蓝牙报文的预开始发送时刻确定第一蓝牙报文中接入地址的第一比特的发送时刻,并将确定的第一蓝牙报文中接入地址的第一比特的发送时刻作为第一蓝牙报文的发送时刻t
1;
第二电子设备在第一蓝牙报文的预开始发送时刻开始向第一电子设备发送第一蓝牙报文,其中,第一蓝牙报文携带第一时间戳信息,第一时间戳信息表示第一蓝牙报文的发送时刻t
1,且第一时间戳信息为第一蓝牙报文中蓝牙物理帧的协议数据单元中的字段;
第二电子设备获取第一电子设备发送的第四蓝牙报文,其中,第四蓝牙报文携带第四时间戳信息,第四蓝牙报文携带第四时间戳信息,第四时间戳信息中包括第一蓝牙报文的接收时刻t
4和第四蓝牙报文的发送时刻t
5;
第二电子设备基于第二电子设备的时钟信息确定接收到第四蓝牙报文的接收时刻t6;
第二电子设备向第一电子设备发送第七蓝牙报文,其中,该第七蓝牙报文中携带第七时间戳信息,第七时间戳信息表示第四蓝牙报文的接收时刻t
6。
第十一方面,本申请还提供一种电子设备,包括:
处理器、存储器,存储器用于存储至少一条指令,指令由处理器加载并执行时以实现如下方法中的任一者:
上述第七方面提供的时间同步方法;
上述第八方面提供的时间同步方法;
上述第九方面提供的时间同步方法;或者
上述第十方面提供的时间同步方法。
第十二方面,本申请还提供一种计算机可读存储介质,其上存储有计算机程序,
计算机程序被处理器执行时实现如下方法中的任一者:
上述第七方面提供的时间同步方法;
上述第八方面提供的时间同步方法;
上述第九方面提供的时间同步方法;或者
上述第十方面提供的时间同步方法。
在一种可能的设计中,第十二方面中的程序可以全部或者部分存储在与处理器封装在一起的存储介质上,也可以部分或者全部存储在不与处理器封装在一起的存储器上。
通过上述技术方案,从设备在接收到主设备发送的携带时间戳信息的蓝牙报文的情况下,可以根据主设备发送的蓝牙报文中的时间戳信息对从设备的本地时间进行修正。在无需获取网络时间的情况下,通过主从设备间的蓝牙报文中添加的时间戳进行主从设备的时间同步,并且通过发送蓝牙报文的方式克服现有技术中无法满足ms级高精度需求的问题,通过上述时间同步方法可以使智能穿戴设备实现高精度的综合运动姿态和健康评估功能。
为了更清楚地说明本申请或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本申请提供的应用场景的示意图;
图2为本申请提供的报文发射时刻参考位置的示意图;
图3a为本申请提供的时间戳位置的示意图;
图3b为本申请提供的蓝牙广播报文结构示意图;
图3c为本申请提供的蓝牙数据报文结构示意图;
图4为本申请提供的一种时间同步方式的示意图;
图5a为本申请提供的另一种时间同步方式的示意图;
图5b为本申请提供的另一种时间同步方式的示意图;
图6a为本申请提供的另一种时间同步方式的示意图;
图6b为本申请提供的另一种时间同步方式的示意图;
图7a为本申请一个实施例提供的电子设备的结构示意图;
图7b为本申请另一个实施例提供的电子设备的结构示意图;
图8为本申请提供的从设备中信息传递的示意图;
图9为本申请提供的关于运动健康监测系统采样控制的信令示意图。
为使本申请的目的、技术方案和优点更加清楚,下面将结合本申请中的附图,对本申请中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本申请实施例提供的时间同步方法可以应用于电子设备,其中,上述电子设备可以为智能手机、平板电脑、可穿戴设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备等设备;本申请实施例对电子设备的具体类型不作任何限制。
图1为本申请提供的应用场景的示意图,如图1所示,本申请提供的时间同步方法,应用于由主设备和从设备构成的场景,其中,该主设备可以为上述第二电子设备M1,该从设备可以为上述第一电子设备S1,且该场景中可以包括多个从设备。例如,主设备为智能手机M1,从设备为智能穿戴设备S1~S4,多个智能穿戴设备分别穿戴在用户不同部位,在用户进行运动时对相应部位进行运动姿态评估。需要说明的是,图1为示例图,从设备的数量在此不作限定。由于用户在普通运动场景(跑步或骑行等)或高速运动场景中(如打羽毛球或进行某种极限运动时),对多个智能穿戴设备的多个传感器间的时间同步有较高精确度的时间同步标准,如时间同步需求<100us甚至<10uS。通过本申请提供的时间同步方法进行主从设备的时间同步,其中主设备为该场景中的中心设备,并以主设备的本地时间作为主从设备时间同步的标准时间。主设备向从设备发送蓝牙报文,并将主设备的本地时间作为时间戳携带在该蓝牙报文中,从设备根据接收到的蓝牙报文中携带的时间戳所表示的时间信息进行时间同步操作。
本申请提供的时间同步方法通过将时间同步信息(时间戳信息)携带在蓝牙报文中,主设备将该携带该时间戳信息的蓝牙报文发送至从设备,其中,该时间戳信息表示基于主设备的时钟所确定的蓝牙报文的发送时刻。
关于蓝牙报文的发送时刻,可以将蓝牙报文中某个域中某个字节中某个比特作为报文发送时刻的计时参考位置,由于蓝牙报文存在不同结构,如图2所示,蓝牙报文P1为BLE的物理层为无编码物理层的蓝牙报文,蓝牙报文P2为BLE的物理层为编码物理层的蓝牙报文。如图2所示,蓝牙报文P1与蓝牙报文P2的组成结构不同,因此,该计时参考位置需要为不同结构蓝牙报文所共有的位置,具体地可以将蓝牙报文中接入地址的第一个比特的发送时刻作为该条BLE蓝牙报文的发送时刻。
在BLE的物理层为无编码物理层的情况下,如图2所示的BLE蓝牙报文P1以前导码(preamble)字段开始,preamble字段后一般为接入地址(Access-Address)字段。Preamble字段主要用于收发时钟频率同步。可以将BLE蓝牙报文P1中接入地址的第一个比特A1的发送时刻作为该条BLE蓝牙报文P1的发送时刻。
在BLE的物理层为编码物理层的情况下,将如图2所示的BLE蓝牙报文P2中接入地址的第一个比特A2的发送时刻作为该条BLE蓝牙报文P2的发送时刻。
通过以上操作可以确定蓝牙报文的发送时刻,还需将所确定的蓝牙报文的发送时刻作为时间戳携带在该蓝牙报文中,以使接收端在接收到该蓝牙报文时可以通过该蓝牙报文中的时间戳确定该蓝牙报文的发送时刻,即接收端可以在获取到该时间戳(蓝牙报文发送时刻)时得知发送端发送该蓝牙报文时发送端的本地时间(标准时间)。
具体地,蓝牙报文发送时刻可以作为时间戳并携带在蓝牙报文的协议数据单元(PDU,protocol Data Unit)的报头(PDU报头)中。其中,该蓝牙报文的发送时刻可以为某一预设时刻t
A,即,预设蓝牙报文在某一时刻(预开始发送时刻t
0)开始发送,进而使该蓝牙报文中接入地址的第一个比特在t
A时刻发出。其中蓝牙报文中接入地址的第一个比特发送时刻t
A的确定方式如下:
基于图2所示的蓝牙报文的组成结构,可以确定接入地址前的区域为前导码,可以根据蓝牙报文的历史发送数据确定前导码从开始发送至发送完成所花费的时间T
P,并根据前导码从开始发送至发送完成所花费的时间T
P确定蓝牙报文的提前发送时间,例如,首先 根据蓝牙报文的历史发送数据确定多个前导码从开始发送至发送完成所花费的时间T
P,并根据上述多个时间T
P确定前导码从开始发送至发送完成的平均发送时间△T
P。若预设主设备在t
0时刻开始向从设备发送蓝牙报文中前导码的第一个比特,则可以确定该蓝牙报文中接入地址的第一个比特的发送时刻t
A=(t
0+△T
P),进而在编辑该蓝牙报文时,将通过上述计算得到的接入地址的第一个比特的发送时刻tA作为时间戳携带在该蓝牙报文的PDU报头中,且该时间戳表示该蓝牙报文中接入地址的第一个比特的发送时刻为t
A。
在一些实施例中,可以通过在蓝牙报文的PDU报头中增加字段来实现在蓝牙报文中携带上述时间戳信息(可以包括时间戳标记和时间戳)。
跟据蓝牙报文类型,不同的蓝牙报文类型,其蓝牙报文中PDU的结构也不同,具体地,蓝牙报文类型为广播报文时,蓝牙广播报文中PDU报头的结构如图3a中的U1a所示;蓝牙报文类型为数据报文时,蓝牙数据报文中的PDU报头的结构如图3a中的U2a所示。
其中,在发送的蓝牙报文需要携带上述时间戳信息的情况下,在如图3a所示的PDU报头结构U1a或PDU报头结构U2a中增加新的字段来实现在发送的蓝牙报文中携带时间戳信息以提供给接收端。
具体地,上述作为时间戳信息的新增字段可以包括第一字段和第二字段,该第一字段和第二字段分别为时间戳标记(TSI,Time Slot Indication)和时间戳(TS,Time Slot)。其中,该时间戳标记TSI表示蓝牙报文中蓝牙物理帧的PDU报头中是否携带时间戳,具体地,若确定该蓝牙物理帧中携带该时间戳标记TSI则表示该蓝牙物理帧中还携带有时间戳TS,反之,则不存在时间戳TS。并且所携带的时间戳TS包括蓝牙报文的发送时刻,即该时间戳可以为蓝牙报文接入地址的第一个比特的发送时刻。具体地,如图3a所示,该蓝牙报文可以为广播报文和数据报文,广播报文和数据报文均可携带表示蓝牙报文中接入地址的第一个比特发送时刻的时间戳信息。在蓝牙报文为广播报文的情况下,该广播报文中的PDU报头如图3a中U1a所示,通过在PDU报头U1a中增加字段,即,将时间戳信息T1封装在协议数据单元报头中得到具有时间戳信息T1的PDU报头U1b,其中,上述时间戳信息T1中可以包括时间戳标记TSI和时间戳TS。在蓝牙报文为数据报文的情况下,该广播报文中的PDU报头如图3a中U2a所示,通过在PDU报头U2a中增加字段,即,将时间戳信息T2封装在协议数据单元报头中得到具有时间戳信息T2的PDU报头U2b。
在本实施例中,蓝牙报文的接收端可以通过确定接收到的蓝牙报文中的PDU报头中是否有新增字段,具体地,接收端可以确定PDU报头中新增字段中是否存在表示时间戳标记TSI的第一字段,若存在第一字段,则进一步获取新增字段中表示时间戳的第二字段的相应信息。反之,接收端确定PDU报头中不存在新增字段(上述第一字段和第二字段)则本次蓝牙报文中未携带上述时间戳信息。
在其他一些实施例中,可以不通过上述增加字段的方式实现在蓝牙报文中携带时间戳标记和时间戳,具体如下:
图3b示出了本申请提供的蓝牙广播报文的结构示意图,在一种可实现的方式中,还可以对如图3b所示的报文类型字段指示的信息含义进行扩展,在原有报文类型的基础上对报文类型的保留位进行扩展使用,以广播报文类型为例,若原有的报文类型有7种,其中,LSB=0000的报文类型表示通用广播指示、LSB=0001的报文类型表示定向连接指示、LSB=0010的报文类型表示不可连接指示、LSB=0011的报文类型表示主动扫描请求、 LSB=0100的报文类型表示主动扫描响应、LSB=0101的报文类型表示连接请求、LSB=0110的报文类型表示可扫描指示、LSB=0111~1111为保留字段。对保留字段进行拓展使用,可以在PDU报头中表示报文类型的LSB(最低位)字段增加属性值,例如,可以使LSB=1010的报文类型表示时间同步指令,即,从设备在报文类型的LSB=1010的情况下确定广播报文类型为时间同步广播报文,且该蓝牙物理帧的PDU报头中携带时间戳信息(本蓝牙报文的发送时刻)。在报文类型的LSB=1010的情况下从设备可以将本地时间调整为该发送时刻。
从设备在报文类型的LSB=1011,的情况下确定广播报文类型为时间同步广播报文,且该蓝牙物理帧的PDU报头中携带时间戳信息(本蓝牙报文的发送时刻以及主从设备之间的时延信息)。在报文类型的LSB=1011的情况下从设备可以根据时间戳信息中的蓝牙报文的发送时刻以及主从设备之间的时延信息调整本地时间,以实现从设备调整后的本地时间与主设备的时间同步。
若蓝牙报文为数据报文,基于上述同理实现时间同步,在此不再赘述。
在一种可实现的方式中,还可以将如图3b所示的蓝牙广播报文的PDU报头中的保留字段(RFU,reserved for future use)的1bit或多bit作为时间戳标记TSI。例如,蓝牙广播报文的PDU报头中的保留字段(RFU)的bit0作为TSI,当bit0为1时,即RFU=X1(bit1为X,X为0或1),则表示该蓝牙物理帧中携带时间戳TS,反之,当bit0为0时,即RFU=X0(bit1为X,X为0或1),则表示该蓝牙物理帧的PDU报头中没有携带时间戳TS。
图3c示出了本申请提供的蓝牙数据报文结构示意图,在一种可实现的方式中,可以将图3c所示的蓝牙数据报文的PDU报头中的保留字段中的1bit或多个bit来作为时间戳标记TSI。例如,蓝牙数据报文的PDU报头中的保留字段(RFU)的bit0作为TSI,当bit0为1时,即RFU=X
2X
11(bit1为X
1,bit2为X
2,X
1为0或1且X
2为0或1),表示该蓝牙物理帧中携带时间戳TS,反之,当bit0为0时,即RFU=X
2X
10(bit1为X1,bit2为X2,X1为0或1且X2为0或1),则表示该蓝牙物理帧中没有携带时间戳TS。
在一种可实现的方式中,可以直接在蓝牙广播报文或蓝牙数据报文中直接以净荷(payload)的形式来传输时间戳信息。具体地,如果蓝牙广播报文或蓝牙数据报文携带时间戳标记TSI,则在时间戳信息通过图3b或图3c中所示的该广播报文或数据报文的净荷中的部分长度(N个bit)或全部长度来传递。
本发明提供了以下实施例对主从设备间的时间同步进行说明。
在不考虑主从设备之间的传输时延Delay以及主从设备的时钟之间的频率偏差导致的时间差Offset的情况下,提供如下实施例一提供的主从设备之间的时间同步方法。
实施例一
图4示出了本申请提供的一种时间同步方式的示意图,如图4所示,主设备向从设备发送第一蓝牙报文,该第一蓝牙报文中携带第一时间戳信息,该第一时间戳信息为基于主设备的时钟所确定的第一蓝牙报文的接入地址的第一个比特的发送时刻t
1。从设备在接收到主设备发送的第一蓝牙报文时,获取该第一蓝牙报文中的第一时间戳信息中的发送时刻t
1,从设备将第一蓝牙报文中携带的发送时刻t
1视为从设备接收到该第一蓝牙报文的接 收时刻,即,从设备可以在获取到该发送时刻t
1时将从设备本地时间进行修正,具体可以为将从设备的本地时间调整为该发送时刻t
1。
以上为实施例一所提供的时间同步方法,其中,BLE传输距离一般<100m,无线信号传输速度3*10^8m/s,100m的距离需要的传输时间为0.3uS,往返的传输时延<1us。所以传输时延相对100uS同步诉求可以忽略不计。即使在不考虑主从设备之间的传输时延Delay以及主从设备的时钟之间的频率偏差导致的时间差Offset的情况下,根据主设备通过蓝牙报文发送的时间戳对从设备的本地时间进行修正,无需获取网络时间且避免了通过BLE数据通道传输时间信息带导致的BLE调度的不确定性和底层传输时延不固定的影响,并且实施例一所提供的时间同步方法可以满足100uS级的普通场景的时间同步需求。
在考虑主从设备之间的传输时延Delay且不考虑主从设备的时钟之间的频率偏差导致的时间差Offset的情况下,提供如下实施例二提供的主从设备之间的时间同步方法。
实施例二
图5a示出了本申请提供的另一种时间同步方式的示意图,如图5a所示,主设备向从设备发送第一蓝牙报文,该第一蓝牙报文中携带第一时间戳信息,该第一时间戳信息为主设备的发送时刻t
1,该发送时刻t
1为基于主设备的时钟所确定的第一蓝牙报文的接入地址的第一个比特的发送时刻。从设备在接收到主设备发送的第一蓝牙报文时,获取该第一蓝牙报文中的第一时间戳信息中的发送时刻t
1,从设备将第一蓝牙报文中携带的发送时刻t
1视为从设备接收到该第一蓝牙报文的接收时刻,即从设备可以在获取到该发送时刻t
1时将从设备本地时间进行修正,具体可以为将从设备的本地时间预调整为该发送时刻t
1,或者可以将从设备的本地时间预调整为该发送时刻t
1+dt1,其中dt1为从设备接收到第一蓝牙报文后,根据该第一蓝牙报文中的发送时刻t
1调整从设备本地时间所花费的处理时间dt1,即,从设备在接收到第一蓝牙报文时开始计时,并在执行本地时间调整前结束该计时并确定处理时间dt1,并将从设备的本地时间调整为发送时刻t
1+dt1。
由于主设备将第一蓝牙报文传输给从设备的传输阶段存在传输时延Delay,因此,从设备的当前本地时间与主设备的当前本地时间存在时间差,且该时间差为该传输时延Delay。为获取该传输时延Delay,从设备向主设备发送第二蓝牙报文,该第二蓝牙报文中携带第二时间戳信息,该第二时间戳信息表示第二蓝牙报文的发送时刻t
2,发送时刻t
2为基于从设备的当前时钟所确定的第二蓝牙报文的接入地址的第一个比特的发送时刻。
主设备基于本地时钟确定接收到从设备发送的第二蓝牙报文的接收时刻t
3,并获取到第二蓝牙报文中携带的发送时刻t
2。
主设备根据第一蓝牙报文的发送时刻t
1、第二蓝牙报文的发送时刻t
2以及第二蓝牙报文的接收时刻t
3确定主从设备之间的传输时延,具体地,其计算过程如下:
其中t
3-t
1为主设备与从设备之间一次信息往来所用时间,t
2-t
1为从设备接收到第一蓝牙报文至发送第二蓝牙报文间本地处理时延,其中t
2-t
1中包含上述调整从设备本地时间所花费的处理时间dt1,进而可以得出(t
3-t
1)-(t
2-t
1)为第一蓝牙报文和第二蓝牙报文传输阶段所用时间的总和,进一步可以通过以下公式计算得到主设备与从设备之间的平均单向传输时延:
其中,T
1表示主设备与从设备之间的平均单向传输时延。
主设备在计算得到该主设备与从设备之间的平均单向传输时延T
1的情况下,向从设备发送第三蓝牙报文,该第三蓝牙报文中携带第三时间戳信息,该第三时间戳信息表示主设备与从设备之间的平均单向传输时延T
1。需要说明的是,蓝牙报文中携带的时间戳信息除表示蓝牙报文的发送时刻的信息外还可以为表示主从设备之间时延的相应信息,如上述表示主设备与从设备之间的平均单向传输时延T
1。该时间戳信息中的时间戳TS中除包括表示蓝牙报文的发送时刻的信息或表示主从设备之间时延的信息外,还可以包括相应的信息标识,例如,在时间戳TS中同时包括表示蓝牙报文的发送时刻的第一信息以及表示该第一信息为蓝牙报文的发送时刻的第一标识信息、表示主从设备之间传输时延的第二信息以及表示该第二信息为主从设备之间传输时延的第二标识信息。从设备可以基于时间戳TS中的上述标识信息确定接收到的信息类型,并在确定信息类型后执行相应时间同步操作。
从设备接收主设备发送的第三蓝牙报文,并获取该第三时间戳中的平均单向传输时延T
1,根据该平均单向传输时延T
1对从设备的本地时间进行修正,具体可以为在从设备的当前本地时间(经过上述任一种预调整的当前本地时间)的基础上加上该平均单向传输时延T
1,得到修正后的从设备的本地时间,进而实现从设备时间与主设备时间的时间同步。
以上为本申请二提供的时间同步方法,相比于实施例一,其进行主从设备时间同步时考虑到主从设备之间的传输时延Delay,经过实施例二中的时间同步操作后,主从设备的时间差精度再次提高,实施例二提供的时间同步方法可以满足更高精度场景的时间同步需求。
在同时考虑到主从设备之间存在传输时延Delay以及主从设备的时钟之间的频率偏差导致的时间差Offset的情况下,提供如下实施例三提供的主从设备之间的时间同步方法。
上述方式为在主设备一侧计算主设备和从设备之间的时延信息,在另一种实现方式中,还可以在从设备一侧计算上述主设备和从设备之间的时延信息,具体如下:
图5b示出了本申请提供的另一种时间同步方式的示意图,如图5b所示,主设备向从设备发送第一蓝牙报文,该第一蓝牙报文中携带第一时间戳信息,该第一时间戳信息为主设备的发送时刻t
1,该发送时刻t
1为基于主设备的时钟所确定的第一蓝牙报文的接入地址的第一个比特的发送时刻。从设备在接收到主设备发送的第一蓝牙报文时,获取该第一蓝牙报文中的第一时间戳信息中的发送时刻t
1,从设备将第一蓝牙报文中携带的发送时刻t
1视为从设备接收到该第一蓝牙报文的接收时刻,即从设备可以在获取到该发送时刻t
1时将从设备本地时间进行修正,具体可以为将从设备的本地时间预调整为该发送时刻t
1,或者可以将从设备的本地时间预调整为该发送时刻t
1+dt1,其中dt1为从设备接收到第一蓝牙报文后,根据该第一蓝牙报文中的发送时刻t
1调整从设备本地时间所花费的处理时间dt1,即,从设备在接收到第一蓝牙报文时开始计时,并在执行本地时间调整前结束该计时并确定处理时间dt1,并将从设备的本地时间调整为发送时刻t
1+dt1。
由于主设备将第一蓝牙报文传输给从设备的传输阶段存在传输时延Delay,因此,从设备的当前本地时间与主设备的当前本地时间存在时间差,且该时间差为该传输时延Delay。为获取该传输时延Delay,从设备向主设备发送第二蓝牙报文,该第二蓝牙报文中携带第二时间戳信息,该第二时间戳信息表示第二蓝牙报文的发送时刻t
2,发送时刻t
2为基于从设备的当前时钟所确定的第二蓝牙报文的接入地址的第一个比特的发送时刻。
主设备基于本地时钟确定接收到从设备发送的第二蓝牙报文的接收时刻t
3后,向从设备发送第六蓝牙报文,该第六蓝牙报文中携带第六时间戳信息,且该第六时间戳信息中包括上述第二蓝牙报文的接收时刻t
3。
从设备在接收到主设备发送的上述第六蓝牙报文中,获取其中第六时间戳信息中的第二蓝牙报文的接收时刻t
3。进而根据上述第一蓝牙报文的发送时刻t
1、上述第二蓝牙报文的发送时刻t
2以及上述第二蓝牙报文的接收时刻t
3确定主从设备之间的传输时延,具体地,其计算过程如下:
其中t
3-t
1为主设备与从设备之间一次信息往来所用时间,t
2-t
1为从设备接收到第一蓝牙报文至发送第二蓝牙报文间本地处理时延,其中t
2-t
1中包含上述调整从设备本地时间所花费的处理时间dt1,进而可以得出(t
3-t
1)-(t
2-t
1)为第一蓝牙报文和第二蓝牙报文传输阶段所用时间的总和,进一步可以通过以下公式计算得到主设备与从设备之间的平均
单向传输时延:
其中,T
1表示主设备与从设备之间的平均单向传输时延。
从设备根据该平均单向传输时延T
1对从设备的本地时间进行修正,具体可以为在从设备的当前本地时间(经过上述任一种预调整的当前本地时间)的基础上加上该平均单向传输时延T
1,得到修正后的从设备的本地时间,进而实现从设备时间与主设备时间的时间同步。
实施例三
图6a示出了本申请提供的另一种时间同步方式的示意图,如图6a所示,主设备向从设备发送第一蓝牙报文,该第一蓝牙报文中携带第一时间戳信息,该第一时间戳信息为主设备的发送时刻t
1,该发送时刻t
1为基于主设备的时钟所确定的第一蓝牙报文的接入地址的第一个比特的发送时刻。
在接收到第一蓝牙报文时,从设备基于自己的时钟确定接收到第一蓝牙报文的接收时刻t
4。
由于考虑到主设备时钟和从设备时钟之间的存在频率偏差,导致从设备的当前本地时间与主设备的当前本地时间存在时间差,且主设备将蓝牙报文传输给从设备的传输阶段存在传输时延Delay,为实现高精度时间同步,需要确定该传输时延Delay和主从设备的时钟之间的频率偏差导致的时间差(频偏时差)Offset,以通过传输时延Delay和频偏时差Offset对从设备本地时间进行调整以实现从设备与主设备时间同步。
为获取该传输时延Delay和频偏时差Offset,从设备向主设备发送第四蓝牙报文,该第四蓝牙报文中携带第四时间戳信息,该第四时间戳信息包括:接收到第一蓝牙报文的接收时刻t
4、以及第四蓝牙报文的发送时刻t
5。
主设备在接收到该第四蓝牙报文时基于本地时钟确定第四蓝牙报文的接收时刻t
6,并获取第四蓝牙报文中第四时间戳中的第一蓝牙报文的接收时刻t
4和第四蓝牙报文的发送时刻t
5。
其中,主设备可以根据主设备发送第一蓝牙报文的时刻t
1、从设备接收第一蓝牙报文的时刻t
4、从设备发送第四蓝牙报文的时刻t
5以及主设备接收第四蓝牙报文的时刻t
6确定以下信息:
(t
4-t
1)=Delay-Offset;
(t
6-t
5)=Delay+Offset;
进一步地,主设备还可以根据主设备发送第一蓝牙报文的时刻t
1、从设备接收第一蓝牙报文的接收时刻t
4、从设备发送第四蓝牙报文的时刻t
5以及主设备接收第四蓝牙报文的时刻t
6计算得到主设备与从设备之间的平均单向传输时延Delay和频偏时差Offset,具体计算过程如下:
其中,T
2表示主设备与从设备之间的平均单向传输时延Delay;
其中,T
3表示主设备与从设备之间的频偏时差Offset。计算得到的Offset为带符号的数值,上述t
4-t
1=Delay-Offset,假定是从设备相对主设备的慢Offset的时间。计算所得的Offset值如果为“正值”表示从设备慢;“负值”表示从设备快。因为t
4-t
1=Delay-Offset假定从设备相对主设备慢Offset,也就是假定主设备比从设备快Offset.因此,t
6-t
5=Delay+Offset,且计算所得的Offset值如果为“正值”表示从设备慢;“负值”表示从设备快。
主设备在计算得到该主设备与从设备之间的平均单向传输时延Delay、主设备与从设备之间的频偏时差Offset的情况下,向从设备发送第五蓝牙报文,该第五蓝牙报文携带第五时间戳,且该第五时间戳中包括主设备与从设备之间的平均单向传输时延Delay、主设备与从设备之间的频偏时差Offset以及主设备发送第五蓝牙报文的时刻t
7。
该时间戳信息中的时间戳TS中除包括表示蓝牙报文的发送时刻的信息或表示主从设备之间时延的信息外,还可以包括相应的信息标识,例如,在时间戳TS中同时包括表示蓝牙报文的发送时刻的第一信息以及表示该第一信息为蓝牙报文的发送时刻的第一标识信息、表示主从设备之间传输时延的第二信息以及表示该第二信息为主从设备之间传输时延的第二标识信息、表示主从设备之间频偏时差的第三信息,以及表示该第三信息为主从设备之间频偏时差的第三标识信息。从设备可以基于时间戳TS中的上述标识信息确定接收到的信息类型,并在确定信息类型后执行相应时间同步操作。
从设备基于自己的时钟确定在t
8时刻接收到主设备发送的第五蓝牙报文,并获取第五时间戳中的主设备与从设备之间的平均单向传输时延Delay、主设备与从设备之间的频偏时差Offset。从设备在接收到第五蓝牙报文时,基于从设备的本地时间以及主从设备之间的频偏时差Offset将从设备本地时间调整为(t
8+Offset),由于主设备将第五蓝牙报文发送至从设备途中存在传输时延Delay,进一步在(t
8+Offset)的基础上消除传输时延Delay,即,从设备在接收到第五蓝牙报文时,将本地时间调整为(t
8+Offset)+Delay。在此同步过程中还存在本地数据处理的时延,还可以在(t
8+Offset)+Delay的基础上进一步消除本地数据处理时延dt2,该dt2为从设备将本地时间t
8调整为(t
8+Offset)+Delay所花费的处理时间dt2。
以上为本申请三提供的时间同步方法,相比于实施例一和实施例二,实施例三在进行主从设备时间同步时既考虑了主从设备之间的传输时延Delay还考虑到主从设备的时钟之间的频率偏差导致的时间差Offset,经过实施例三中的时间同步操作后,主从设备的时间差精度再次提高,实施例三提供的时间同步方法可以满足更高精度场景的时间同步需求。
上述方式为在主设备一侧计算主设备和从设备之间的时延信息,在另一种实现方式中,还可以在从设备一侧计算上述主设备和从设备之间的时延信息,具体如下:
图6b示出了本申请提供的另一种时间同步方式的示意图,如图6b所示,主设备向从设备发送第一蓝牙报文,该第一蓝牙报文中携带第一时间戳信息,该第一时间戳信息为主设备的发送时刻t
1,该发送时刻t
1为基于主设备的时钟所确定的第一蓝牙报文的接入地址的第一个比特的发送时刻。
在接收到第一蓝牙报文时,从设备基于自己的时钟确定接收到第一蓝牙报文的接收时刻t
4。
由于考虑到主设备时钟和从设备时钟之间的存在频率偏差,导致从设备的当前本地时间与主设备的当前本地时间存在时间差,且主设备将蓝牙报文传输给从设备的传输阶段存在传输时延Delay,为实现高精度时间同步,需要确定该传输时延Delay和主从设备的时钟之间的频率偏差导致的时间差(频偏时差)Offset,以通过传输时延Delay和频偏时差Offset对从设备本地时间进行调整以实现从设备与主设备时间同步。
为获取该传输时延Delay和频偏时差Offset,从设备向主设备发送第四蓝牙报文,该第四蓝牙报文中携带第四时间戳信息,该第四时间戳信息包括:接收到第一蓝牙报文的接收时刻t
4、以及第四蓝牙报文的发送时刻t
5。
主设备在接收到该第四蓝牙报文时基于本地时钟确定第四蓝牙报文的接收时刻t
6后,主设备向从设备发送第七蓝牙报文,该第七蓝牙报文中携带第七时间戳信息,且该第七时间戳信息中包括上述第四蓝牙报文的接收时刻t
6。
从设备基于自己的时钟确定在t
8时刻接收到该第七蓝牙报文,从设备在接收到主设备发送的上述第七蓝牙报文中,获取其中第七时间戳信息中的上述第四蓝牙报文的接收时刻t
6。进而从设备可以根据上述第一蓝牙报文的时刻t
1、上述第一蓝牙报文的时刻t
4、上述第四蓝牙报文的时刻t
5以及上述第四蓝牙报文的时刻t
6确定以下信息:
(t
4-t
1)=Delay-Offset;
(t
6-t
5)=Delay+Offset;
进一步地,从设备还可以根据上述第一蓝牙报文的时刻t
1、上述第一蓝牙报文的接收时刻t
4、上述第四蓝牙报文的时刻t
5以及上述第四蓝牙报文的时刻t
6计算得到主设备与从设备之间的平均单向传输时延Delay和频偏时差Offset,具体计算过程如下:
其中,T
2表示主设备与从设备之间的平均单向传输时延Delay;
其中,T
3表示主设备与从设备之间的频偏时差Offset。计算得到的Offset为带符号的数值,上述t
4-t
1=Delay-Offset,假定是从设备相对主设备的慢Offset的时间。计算所得的Offset值如果为“正值”表示从设备慢;“负值”表示从设备快。因为t
4-t
1=Delay-Offset假定从设备相对主设备慢Offset,也就是假定主设备比从设备快Offset.因此,t
6-t
5=Delay+Offset,且计算所得的Offset值如果为“正值”表示从设备慢;“负值”表示从设备快。
从设备可以基于从设备的本地时间以及主从设备之间的频偏时差Offset将从设备本地时间调整为(t
8+Offset),由于主设备将第五蓝牙报文发送至从设备途中存在传输时延Delay,进一步在(t
8+Offset)的基础上消除传输时延Delay,即,从设备在接收到第五蓝牙报文时,将本地时间调整为(t
8+Offset)+Delay。在此同步过程中还存在本地数据处理的时延,还可以在(t
8+Offset)+Delay的基础上进一步消除本地数据处理时延dt2,该dt2为从设备将本地时间t
8调整为(t
8+Offset)+Delay所花费的处理时间dt2。
本申请还提供一种电子设备,该电子设备可以为上述从设备也可以为上述主设备,图7a为本申请一个实施例提供的电子设备的结构示意图,如图7a所示,该电子设备可以包括处理器701以及存储器702,其中该存储器702用于存储至少一条指令,上述指令由处理器701加载并执行时以实现本申请提供的上述任一时间同步操作。
在一种可能的实现方式中,本申请另一个实施例提供一种如图7b所示的电子设备,该电子设备可以为上述从设备也可以为上述主设备,如图7b所示,该电子设备可以包括BLE蓝牙模块30、控制器c1、以及多个传感器Sen1~Senn。其中,图7a所示实施例中的处理器701以及存储器702封装在一起构成图7b所示实施例中的控制器c1,且如图7b所示的从设备可以通过该BLE蓝牙模块30与如图7b所示的主设备进行通信以实现本申请提供的上述任一时间同步操作。
在主从设备均为智能穿戴设备的实施例中,该智能穿戴设备具有多个传感器,例如智能手表或手环包括IMU传感器(Inertial Measurement Unit,惯性测量单元)、PPG传感器(photoplethysmography,光学体积描记术),其中IMU传感器可用来测量人体的运动状态,PPG传感器可用于测量人体的心率。传感器一般通过数字接口与控制器相连(接收控制器的指令,向控制器传输配置数据、采样数据、状态信息等),数字接口一般为低速的串行接口(如SPI或I2C)。传感器一般内部也集成微型的控制器,完成传感器自身内部的配置和控制。传感器一般可以采用内置的时钟信号或者外部时钟信号,外部时钟信号一般由智能穿戴设备的控制器或主板上的时钟来提供。
由于每个传感器时钟频率可能不一样,每个传感器采样时刻不一样,传感器内部信号链路的延迟不一样,其中包括模拟前端(Analog Front End,AFE)的延迟不同。当前多个传感器采样数据在时间上没有对齐,导致进行联合数据处理时,存在数据对齐的问题或者联合数据处理得到的结果与真实结果差异过大。为了解决穿戴设备内部多传感器采样数据时间同步问题,可以采用以下方案:
方案1:通过单独引脚传递时间同步信息,如图8所示。
具体的,传感器Sen1~Senn与控制器c1的接口增加一个时间同步引脚,控制器c1周期性的发送时间同步信息给传感器Sen1~Senn。时间同步信号可以是一个或多个脉冲信号,或者是电平信号等。
传感器Sen1~Senn可以采用两种方式进行数据采样。第一种,每次收到时间同步信号时,对内部计数器进行复位。此内部计数器用于对内部时钟或外部时钟进行分频,分频后的信号作为传感器Sen1~Senn的采样时钟,传感器Sen1~Senn以此采样时钟进行采样。第二种,传感器Sen1~Senn基于内部时钟或外部时钟进行采样,收到时间同步信息时,在当前采样或下一次采样时记录时间延迟(如,记录当前采样或下一次采样相对时间同步信息延迟了多少个内部或外部时钟周期)。其中,当前采样表示传感器Sen1~Senn在采样结束前从设备根据主设备发送信息执行一次时间同步操作。
传感器Sen1~Senn向控制器c1上传数据时,可以有两种方式实现对采样数据的标识。第一种方式可以为在每个采样数据中增加一个bit,标识此采样数据是否为收到时间同步信息后的第一个采样数据或最近的一个采样数据。第二种,传输采样数据时,额外多传输一个或多个字节的数据,用于标识所传输的数据中,哪个数据(例如第N个)是收到时间同步信息后的第一个采样数据或者最近的一个采样数据。可选的,可以把采样偏移时间信息传递给控制器c1(采样时刻相对收到时间同步信息时的第一个采样数据或最近的一个采样数据的偏移时间,或者采样时刻相对收到时间同步信息时的第一个采样数据或最近的一个采样数据的偏移时间+AFE的信号通路的延迟时间)。
方案2:通过串行通信接口的信号线进行发送时间同步信息
对串行外设接口(SPI,Serial Peripheral Interface),可以通过片选信号(CS,chip select)、主机输入/从机输出数据(MISO,Master Input Slave Output)、主机输出/从机输入数据(MOSI,Master Output Slave Input)、时钟信号(CLK,Clock)任何一个信号或组合信号复用来传递时间同步信息,如可以在CS上连续发送多个窄脉冲传递时间同步信息,或者在CS禁止时,通过MISO、MOSI、CLK同时拉低来传递时间同步信息。
对I2C接口,可以通过串行数据线信号(SCL)、串行时钟线信号(SDA)中任何一个信号或组合信号复用来传递时间同步信息。如可以一定时间内连续发送N个(N>=1)Start或Stop信号传递时间同步消息。或者连续一个Start和Stop来传递时间同步消息。
传感器Sen1~Senn向控制器c1传送数据的方法与方案1相同。
方案3:通过控制命令传递时间同步信息。例如对设定的地址写入一个设定的值(如对0x6f,写入0xaa)。可以约定时间同步信息的起始位置为发送的控制命令的某个设定位置。如对I2C接口,可以约定为发送控制命令的Start信号位置或者R/W指示BIT位置。
传感器Sen1~Senn向控制器c1传送数据的方法与方案1相同。
本申请还提供一种运动健康监测系统,该系统可以用于获得用户的高精度综合运动姿态和/或健康评估信息,该系统包括一个主设备和一个或多个从设备。该系统的结构可以如图1所示,在一种可能实现的方式中,该系统中的从设备可以为智能穿戴设备,从设备可以为智能手机,如图1所示,其中上述系统中可以包括作为主设备的智能手机M1、作为从设备的智能穿戴设备S1、S2、S3和S4。在该系统中,主设备并不限定于智能手机,还可以为其他智能移动终端,例如,主从设备均为智能穿戴设备。
图9示出了本申请一个实施例提供的运动健康监测系统采样控制的信令示意图,如图9所示,该运动健康监测系统包括一个主设备和多个从设备,并通过以下步骤完成数据采样、数据上传以及数据融合处理:
步骤S1:主设备向从设备发送携带时间同步信息的蓝牙报文;
步骤S2:从设备基于接收到的时间同步信息与主设备进行时间同步;
步骤S3:控制器c1向1个或多个传感器Sen1~Senn发送时间同步信息;
步骤S4:传感器Sen1~Senn调整内部时钟实现与控制器的时间同步;
步骤S5:根据内部时钟进行采样,并将采样数据上传至控制器c1;
步骤S6:根据采样数据的采样时间为采样数据添加时间戳;
步骤S7:将带有时间戳的采样数据传输至主设备;
步骤S8:将多个传感器Sen1~Senn发送的采样数据(带有时间戳的传感器数据)进行数据融合处理。
关于该步骤S1~S8的详细流程如下:
其中,该步骤S1-S2可以根据上述实施例一、实施例二或实施例三中任一种时间同步方式进行主从设备之间的时间同步,该时间同步流程在此不再赘述。
以下为主从设备完成时间同步后,主从设备所执行的进行相应数据交互的操作过程(步骤S3-S8):
具体地,主设备(Master)和一个或多个从设备(Slave)间采用BLE时间同步方法进行同步,其中,可以为从设备根据本申请提供的上述时间同步操作(如实施例一~实施例三中任一种)实现与主设备的时间同步,并且可以周期性执行上述时间同步操作为。
从设备内部的控制器c1周期性的发射时间同步消息给传感器Sen1~Senn,传感器根据时间同步消息将传感器的时间同步到控制器,并基于经过时间同步的内部时钟进行采样。具体为传感器Sen1~Senn收到时间同步消息后,用于复位采样的时钟的分频计数器或者记录与时间同步消息之后一次采样数据或最近一次采样数据标记,可选记录收到时间同步消息后的一次采样或最近一次采样相对时间同步消息的采样时间偏移。
传感器Sen1~Senn对采样数据进行时间标记(例如可以通过标记收到时间同步消息时的采样数据点),把标记过的数据传递给控制器c1。
控制器c1对传感器采样数据添加时间标签。例如,假定时间[T,T+10秒]内有100个数据,采样率10Hz,则可以把100个数据的起始时间T或结束时间T+10秒作为时间戳,添加到要传输给主设备的数据中。从设备的控制器c1把添加时间戳的数据传递给主设备。
主设备根据多个从设备的上传的带有经过时间同步后的时间戳信息的采样数据,进行融合的数据处理。例如根据手上和脚上的穿戴设备上传的数据,融合处理计算用户当时四肢运动状态或四肢的配合度。
在通过本申请提供的时间同步操作完成主从设备时间同步的基础上,多个穿戴设备的多个传感器多点同步检测,可以满足普通场景或高速运动场景。
可以理解的是,所述应用可以是安装在终端上的应用程序(nativeApp),或者还可以是终端上的浏览器的一个网页程序(webApp),本申请对此不进行限定。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本发明所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如,多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。
上述以软件功能单元的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能单元存储在一个存储介质中,包括若干指令用以使得一台计算机装置(可以是个人计算机,服务器,或者网络装置等)或处理器(Processor)执行本发明各个实施例所述方法的部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明保护的范围之内。
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。
Claims (13)
- 一种时间同步方法,其特征在于,所述方法包括:第一电子设备获取第二电子设备发送的第一蓝牙报文,其中,所述第一蓝牙报文携带第一时间戳信息,所述第一时间戳信息表示所述第一蓝牙报文的发送时刻t 1,所述第一时间戳信息为所述第一蓝牙报文中蓝牙物理帧的协议数据单元中的字段;以及所述第一电子设备根据所述第一时间戳信息对所述第一电子设备的本地时间进行修正;其中,所述第一蓝牙报文的发送时刻t 1通过下方式确定:第二电子设备向第一电子设备发送第一蓝牙报文前,获取所述第二电子设备的时钟信息,并基于所述第二电子设备的时钟信息确定所述第一蓝牙报文的预开始发送时刻;以及所述第二电子设备根据所述第一蓝牙报文的预开始发送时刻确定所述第一蓝牙报文中接入地址的第一比特的发送时刻,并将确定的所述第一蓝牙报文中接入地址的第一比特的发送时刻作为所述第一蓝牙报文的发送时刻t 1。
- 根据权利要求1所述的方法,其特征在于,所述字段包括第一字段和第二字段;所述第一字段和第二字段分别为时间戳标记和时间戳,所述时间戳标记表示所述蓝牙物理帧携带所述时间戳,所述时间戳包括所述发送时刻t 1。
- 根据权利要求1所述的方法,其特征在于,所述根据所述第一时间戳信息对从设备的本地时间进行修正包括:将所述发送时刻t 1作为所述第一电子设备的当前本地时间。
- 根据权利要求3所述的方法,其特征在于,所述根据所述第一时间戳信息对从设备的本地时间进行修正之后还包括:向所述第二电子设备发送第二蓝牙报文,其中,所述第二蓝牙报文携带第二时间戳信息,所述第二时间戳信息表示所述第二蓝牙报文的发送时刻t 2,所述第二蓝牙报文的发送时刻t 2为所述第二蓝牙报文中接入地址的第一个比特的发送时刻;获取第二电子设备发送的第三蓝牙报文,其中,所述第三蓝牙报文携带第三时间戳信息,所述第三时间戳信息表示所述第二电子设备与所述第二电子设备之间的平均单向传输时延;以及根据所述平均单向传输时延对所述第一电子设备的本地时间进行修正。
- 一种时间同步方法,其特征在于,所述方法包括:第一电子设备获取第二电子设备发送的第一蓝牙报文,其中,所述第一蓝牙报文携带第一时间戳信息,所述第一时间戳信息表示基于所述第二电子设备的时钟信息所确定的 所述第一蓝牙报文的发送时刻t 1,所述第一时间戳信息为所述第一蓝牙报文中蓝牙物理帧的协议数据单元中的字段;其中,所述第一蓝牙报文的发送时刻t 1通过下方式确定:第二电子设备向第一电子设备发送第一蓝牙报文前,获取所述第二电子设备的时钟信息,并基于所述第二电子设备的时钟信息确定所述第一蓝牙报文的预开始发送时刻;以及所述第二电子设备根据所述第一蓝牙报文的预开始发送时刻确定所述第一蓝牙报文中接入地址的第一比特的发送时刻,并将确定的所述第一蓝牙报文中接入地址的第一比特的发送时刻作为所述第一蓝牙报文的发送时刻t 1;所述第一电子设备基于本地时钟确定接收到所述第一蓝牙报文的接收时刻t 4;向所述第二电子设备发送的第四蓝牙报文,其中,所述第四蓝牙报文携带第四时间戳信息,所述第四时间戳信息中包括所述第一蓝牙报文的接收时刻t 4和所述第四蓝牙报文的发送时刻t 5,所述发送时刻t 5为所述第四蓝牙报文中接入地址的第一个比特的发送时刻;所述第一电子设备获取所述第二电子设备发送的第五蓝牙报文,其中所述第五蓝牙报文携带第五时间戳信息,所述第五时间戳信息包括所述第二电子设备与所述第一电子设备之间的平均单向传输时延、所述第二电子设备与所述第一电子设备之间的频偏时差以及所述第四蓝牙报文的接收时刻t 6;所述第一电子设备根据所述平均单向传输时延、所述频偏时差以及所述第四蓝牙报文的接收时刻t 6对所述第一电子设备的本地时间进行修正。
- 一种时间同步方法,其特征在于,所述方法包括:第二电子设备向第一电子设备发送第一蓝牙报文前,获取所述第二电子设备的时钟信息,并基于所述第二电子设备的时钟信息确定所述第一蓝牙报文的预开始发送时刻;所述第二电子设备根据所述第一蓝牙报文的预开始发送时刻确定所述第一蓝牙报文中接入地址的第一比特的发送时刻,并将确定的所述第一蓝牙报文中接入地址的第一比特的发送时刻作为所述第一蓝牙报文的发送时刻t 1;以及第二电子设备在所述第一蓝牙报文的预开始发送时刻开始向第一电子设备发送第一蓝牙报文,其中,所述第一蓝牙报文携带第一时间戳信息,所述第一时间戳信息表示所述第一蓝牙报文的发送时刻t 1,且所述第一时间戳信息为所述第一蓝牙报文中蓝牙物理帧的协议数据单元中的字段。
- 根据权利要求6所述的方法,其特征在于,所述字段包括第一字段和第二字段;所述第一字段和第二字段分别为时间戳标记和时间戳,所述时间戳标记表示所述蓝牙物理帧携带所述时间戳,所述时间戳包括所述第一蓝牙报文的发送时刻t 1。
- 根据权利要求6所述的方法,其特征在于,所述第二电子设备在所述第一蓝牙报文的预开始发送时刻开始向第一电子设备发送第一蓝牙报文之后,还包括:所述第二电子设备获取所述第一电子设备发送的第二蓝牙报文,其中,所述第二蓝牙报文携带第二时间戳信息,所述第二时间戳信息表示所述第二蓝牙报文的发送时刻t 2;所述第二电子设备基于所述第二电子设备的时钟信息确定接收到所述第二蓝牙报文的接收时刻t 3,根据所述第一蓝牙报文的发送时刻t 1、所述第二蓝牙报文的发送时刻t 2以及所述第二蓝牙报文的接收时刻t 3计算所述第二电子设备与所述第一电子设备之间的平均单向传输时延;所述第二电子设备向所述第一电子设备发送第三蓝牙报文,其中所述第三蓝牙报文携带第三时间戳信息,所述第三时间戳信息表示所述第二电子设备与所述第一电子设备之间的平均单向传输时延。
- 一种时间同步方法,其特征在于,所述方法包括:第二电子设备向第一电子设备发送第一蓝牙报文前,获取所述第二电子设备的时钟信息,并基于所述第二电子设备的时钟信息确定所述第一蓝牙报文的预开始发送时刻;所述第二电子设备根据所述第一蓝牙报文的预开始发送时刻确定所述第一蓝牙报文中接入地址的第一比特的发送时刻,并将确定的所述第一蓝牙报文中接入地址的第一比特的发送时刻作为所述第一蓝牙报文的发送时刻t 1;第二电子设备在所述第一蓝牙报文的预开始发送时刻开始向第一电子设备发送第一蓝牙报文,其中,所述第一蓝牙报文携带第一时间戳信息,所述第一时间戳信息表示所述第一蓝牙报文的发送时刻t 1,且所述第一时间戳信息为所述第一蓝牙报文中蓝牙物理帧的协议数据单元中的字段;所述第二电子设备获取所述第一电子设备发送的第四蓝牙报文,其中,所述第四蓝牙报文携带第四时间戳信息,所述第四蓝牙报文携带第四时间戳信息,所述第四时间戳信息中包括所述第一蓝牙报文的接收时刻t 4和所述第四蓝牙报文的发送时刻t 5;所述第二电子设备基于所述第二电子设备的时钟信息确定接收到所述第四蓝牙报文的接收时刻t 6,根据所述第一蓝牙报文的发送时刻t 1、所述第一蓝牙报文的接收时刻t 4、所述第四蓝牙报文的发送时刻t 5以及所述第四蓝牙报文的接收时刻t 6计算所述第二电子设备与所述第一电子设备之间的平均单向传输时延和所述第二电子设备与所述第一电子设备之间的频偏时差,所述频偏时差为时钟间的频率偏差导致的时间偏差;所述第二电子设备向所述第一电子设备发送第五蓝牙报文,其中所述第五蓝牙报文携带第五时间戳信息,所述第五时间戳信息包括所述第一电子设备与所述第二电子设备之间的平均单向传输时延、所述第二电子设备与所述第一电子设备之间的频偏时差以及所述第四蓝牙报文的接收时刻t 6。
- 一种电子设备,其特征在于,所述电子设备包括:处理器和存储器,所述存储器用于存储至少一条指令,所述指令由所述处理器加载并执行时以实现如下方法中的任一者:权利要求1-4中任意一项所述的时间同步方法;权利要求5所述的时间同步方法;权利要求6-9中任意一项所述的时间同步方法;或者权利要求10或11所述的时间同步方法。
- 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如下方法中的任一者:权利要求1-4中任意一项所述的时间同步方法;权利要求5所述的时间同步方法;权利要求6-9中任意一项所述的时间同步方法;或者权利要求10或11所述的时间同步方法。
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| EP21896920.2A EP4236122A4 (en) | 2020-11-24 | 2021-11-22 | TIME SYNCHRONIZATION METHOD, CONTROL APPARATUS, DEVICE, AND STORAGE MEDIUM |
| US18/254,057 US20240107470A1 (en) | 2020-11-24 | 2021-11-22 | Time Synchronization Method, Control Apparatus, Device, and Storage Medium |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202011331137.7 | 2020-11-24 | ||
| CN202011331137.7A CN114553351B (zh) | 2020-11-24 | 2020-11-24 | 时间同步方法及控制装置、设备、存储介质 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2022111419A1 true WO2022111419A1 (zh) | 2022-06-02 |
Family
ID=81660675
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2021/132132 Ceased WO2022111419A1 (zh) | 2020-11-24 | 2021-11-22 | 时间同步方法及控制装置、设备、存储介质 |
Country Status (4)
| Country | Link |
|---|---|
| US (1) | US20240107470A1 (zh) |
| EP (1) | EP4236122A4 (zh) |
| CN (1) | CN114553351B (zh) |
| WO (1) | WO2022111419A1 (zh) |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115022959A (zh) * | 2022-08-04 | 2022-09-06 | 绵阳优森科技有限公司 | 无线通讯中统一控制和计时系统、方法及体测穿戴设备 |
| CN115550855A (zh) * | 2022-11-24 | 2022-12-30 | 成都市安比科技有限公司 | 一种基于bis的分布式自组网实时对讲方法 |
| CN116725484A (zh) * | 2022-09-09 | 2023-09-12 | 荣耀终端有限公司 | 基于可穿戴设备的生理检测方法及可穿戴设备 |
| CN118260360A (zh) * | 2023-05-18 | 2024-06-28 | 华为技术有限公司 | 运动数据同步的方法和电子设备 |
Families Citing this family (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115107792B (zh) * | 2022-06-30 | 2025-10-28 | 南昌阿波罗智能科技有限公司 | 时间同步方法、装置、设备和自动驾驶车辆 |
| CN115225523B (zh) * | 2022-07-22 | 2024-02-27 | 四川长虹电器股份有限公司 | 智能终端设备信息采集时间校正系统及方法 |
| CN115038162B (zh) * | 2022-08-12 | 2022-11-18 | 广州安凯微电子股份有限公司 | 一种蓝牙时钟快速同频同相调节方法及装置 |
| US20240107426A1 (en) * | 2022-09-23 | 2024-03-28 | Apple Inc. | Systems and methods for improved range and performance for low power radios |
| CN115314080A (zh) * | 2022-09-29 | 2022-11-08 | 北京脑陆科技有限公司 | 数据传输方法、装置、系统、计算机设备和存储介质 |
| CN115499908A (zh) * | 2022-10-19 | 2022-12-20 | 深圳市中科蓝讯科技股份有限公司 | 一种时钟校准方法、装置及电子设备 |
| US12563598B2 (en) * | 2023-11-16 | 2026-02-24 | Infineon Technologies Americas Corp. | Bluetooth low energy based wireless air-time management system |
| CN117715171B (zh) * | 2024-02-04 | 2024-06-18 | 奉加微电子(昆山)有限公司 | 时间同步方法、电子设备及存储介质 |
| CN121126510A (zh) * | 2025-11-12 | 2025-12-12 | 上海矽昌通信技术有限公司 | 一种接入点、终端设备以及短距通信时间同步方法和系统 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20190045304A1 (en) * | 2017-10-05 | 2019-02-07 | Intel Corporation | Methods and apparatus to facilitate time synchronization of audio over bluetooth low energy |
| CN110568753A (zh) * | 2019-07-30 | 2019-12-13 | 青岛小鸟看看科技有限公司 | 一种手柄、头戴设备、头戴系统及其时间同步方法 |
| WO2020133183A1 (zh) * | 2018-12-28 | 2020-07-02 | 华为技术有限公司 | 音频数据的同步方法及设备 |
| CN111918261A (zh) * | 2020-08-13 | 2020-11-10 | 南京中感微电子有限公司 | 蓝牙音频设备同步播放方法、系统及蓝牙音频主、从设备 |
Family Cites Families (12)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8102836B2 (en) * | 2007-05-23 | 2012-01-24 | Broadcom Corporation | Synchronization of a split audio, video, or other data stream with separate sinks |
| CN102035639B (zh) * | 2009-09-30 | 2014-09-17 | 华为技术有限公司 | 时间同步方法、装置和系统 |
| US9288777B2 (en) * | 2012-05-11 | 2016-03-15 | Apple Inc. | Methods and apparatus for synchronizing clock signals in a wireless system |
| US8959381B2 (en) * | 2012-09-05 | 2015-02-17 | Khalifa University of Science, Technology, and Research | Method and system for clock offset and skew estimation |
| CN102833062B (zh) * | 2012-09-25 | 2015-08-12 | 广东电网公司珠海供电局 | 智能变电站ieee1588主从时钟同步报文对时方法及系统 |
| US9763029B2 (en) * | 2015-08-26 | 2017-09-12 | Verizon Patent And Licensing Inc. | Bluetooth internet of things sensor network |
| US10462759B2 (en) * | 2017-01-31 | 2019-10-29 | Dialog Semiconductor B.V. | System and method for clock synchronization on a wireless network |
| CN106817671B (zh) * | 2017-02-14 | 2020-04-07 | 腾讯科技(深圳)有限公司 | 一种联网信息共享方法、第一终端及系统 |
| EP3573386A1 (en) * | 2018-05-25 | 2019-11-27 | Sword Health, S.A. | Method and device for synchronizing data packets from embedded data sensors monitoring body motion of a patient |
| EP3644661B1 (en) * | 2018-10-26 | 2022-08-17 | Google LLC | A synchronization method for synchronizing clocks of a bluetooth device |
| CN110572230A (zh) * | 2019-09-10 | 2019-12-13 | 北京邮电大学 | 一种用于实现时间同步的修正方法及装置 |
| CN110784783B (zh) * | 2019-11-01 | 2020-11-06 | 清华大学 | 基于光纤网络的时钟同步方法及装置 |
-
2020
- 2020-11-24 CN CN202011331137.7A patent/CN114553351B/zh active Active
-
2021
- 2021-11-22 WO PCT/CN2021/132132 patent/WO2022111419A1/zh not_active Ceased
- 2021-11-22 EP EP21896920.2A patent/EP4236122A4/en active Pending
- 2021-11-22 US US18/254,057 patent/US20240107470A1/en active Pending
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20190045304A1 (en) * | 2017-10-05 | 2019-02-07 | Intel Corporation | Methods and apparatus to facilitate time synchronization of audio over bluetooth low energy |
| WO2020133183A1 (zh) * | 2018-12-28 | 2020-07-02 | 华为技术有限公司 | 音频数据的同步方法及设备 |
| CN110568753A (zh) * | 2019-07-30 | 2019-12-13 | 青岛小鸟看看科技有限公司 | 一种手柄、头戴设备、头戴系统及其时间同步方法 |
| CN111918261A (zh) * | 2020-08-13 | 2020-11-10 | 南京中感微电子有限公司 | 蓝牙音频设备同步播放方法、系统及蓝牙音频主、从设备 |
Non-Patent Citations (1)
| Title |
|---|
| See also references of EP4236122A4 * |
Cited By (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115022959A (zh) * | 2022-08-04 | 2022-09-06 | 绵阳优森科技有限公司 | 无线通讯中统一控制和计时系统、方法及体测穿戴设备 |
| CN116725484A (zh) * | 2022-09-09 | 2023-09-12 | 荣耀终端有限公司 | 基于可穿戴设备的生理检测方法及可穿戴设备 |
| CN116725484B (zh) * | 2022-09-09 | 2024-04-16 | 荣耀终端有限公司 | 基于可穿戴设备的生理检测方法及可穿戴设备 |
| CN115550855A (zh) * | 2022-11-24 | 2022-12-30 | 成都市安比科技有限公司 | 一种基于bis的分布式自组网实时对讲方法 |
| CN115550855B (zh) * | 2022-11-24 | 2023-02-03 | 成都市安比科技有限公司 | 一种基于bis的分布式自组网实时对讲方法 |
| CN118260360A (zh) * | 2023-05-18 | 2024-06-28 | 华为技术有限公司 | 运动数据同步的方法和电子设备 |
Also Published As
| Publication number | Publication date |
|---|---|
| EP4236122A1 (en) | 2023-08-30 |
| CN114553351B (zh) | 2023-12-08 |
| EP4236122A4 (en) | 2024-04-24 |
| US20240107470A1 (en) | 2024-03-28 |
| CN114553351A (zh) | 2022-05-27 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2022111419A1 (zh) | 时间同步方法及控制装置、设备、存储介质 | |
| CN110567453B (zh) | 仿生眼多通道imu与相机硬件时间同步方法和装置 | |
| US11588568B2 (en) | Packet processing method and network device | |
| JP6546357B2 (ja) | センシングシステム及び時刻同期方法 | |
| US10707984B2 (en) | Techniques for synchronizing slave devices | |
| CN105446130B (zh) | 一种指针式智能钟表的自动定期授时方法及授时系统 | |
| KR101722068B1 (ko) | 디바이스의 다수의 센서들로부터 수신된 데이터를 동기화시키는 방법들 및 시스템들 | |
| EP4044466B1 (en) | Synchronization method and device | |
| US20170041897A1 (en) | Apparatus and methods for synchronizing a controller and sensors | |
| CN110740227B (zh) | 基于gnss授时和图像显示信息编码方式的相机时间同步装置及方法 | |
| US9451218B2 (en) | Wireless synchronous system, radio apparatuses, sensor devices, wireless synchronizing method, and computer-readable recording medium | |
| US20170041688A1 (en) | Apparatus and methods for timestamping in a system synchronizing controller and sensors | |
| JP5470649B2 (ja) | 短距離無線通信システム及び方法 | |
| CA2999773A1 (en) | Apparatus and methods for timestamping in a system synchronizing controller and sensors | |
| CN101447861A (zh) | Ieee 1588时间同步系统及其实现方法 | |
| JP2018534688A (ja) | コントローラおよびセンサを同期するための装置および方法 | |
| WO2018077176A1 (zh) | 可穿戴设备及在可穿戴设备中确定用户位移的方法 | |
| JPWO2017179608A1 (ja) | 時刻同期方法、センサ収容端末、およびセンサネットワークシステム | |
| CN107579793A (zh) | 一种通信网络设备间时间同步的优化方法、装置及设备 | |
| CN114884605A (zh) | 基于fpga实现网络节点时间同步的方法 | |
| WO2024060763A1 (zh) | 一种无线智能可穿戴装置及其图像采集方法 | |
| CN110139041A (zh) | 远程多传感信号同步采集方法 | |
| CN117320144A (zh) | 基于无线通信的子母钟时间同步方法和系统 | |
| CN119805509A (zh) | 一种用于高可靠精密授时装置 | |
| CN117879747A (zh) | 报文时间戳的获取方法、装置、设备及存储介质 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21896920 Country of ref document: EP Kind code of ref document: A1 |
|
| WWE | Wipo information: entry into national phase |
Ref document number: 18254057 Country of ref document: US |
|
| ENP | Entry into the national phase |
Ref document number: 2021896920 Country of ref document: EP Effective date: 20230525 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |