WO2022048075A1 - 时钟同步方法、装置及存储介质 - Google Patents

时钟同步方法、装置及存储介质 Download PDF

Info

Publication number
WO2022048075A1
WO2022048075A1 PCT/CN2020/139742 CN2020139742W WO2022048075A1 WO 2022048075 A1 WO2022048075 A1 WO 2022048075A1 CN 2020139742 W CN2020139742 W CN 2020139742W WO 2022048075 A1 WO2022048075 A1 WO 2022048075A1
Authority
WO
WIPO (PCT)
Prior art keywords
moment
clock
time interval
measurements
time
Prior art date
Application number
PCT/CN2020/139742
Other languages
English (en)
French (fr)
Inventor
刘荣
郭玉峰
Original Assignee
广州视源电子科技股份有限公司
广州视睿电子科技有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 广州视源电子科技股份有限公司, 广州视睿电子科技有限公司 filed Critical 广州视源电子科技股份有限公司
Publication of WO2022048075A1 publication Critical patent/WO2022048075A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W56/00Synchronisation arrangements
    • H04W56/004Synchronisation arrangements compensating for timing error of reception due to propagation delay
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W56/00Synchronisation arrangements
    • H04W56/001Synchronization between nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W84/00Network topologies
    • H04W84/02Hierarchically pre-organised networks, e.g. paging networks, cellular networks, WLAN [Wireless Local Area Network] or WLL [Wireless Local Loop]
    • H04W84/10Small scale networks; Flat hierarchical networks
    • H04W84/12WLAN [Wireless Local Area Networks]

Definitions

  • the present application relates to the technical field of wireless audio transmission, and in particular, to a clock synchronization method, device and storage medium.
  • the key technical indicators include: the transmission bandwidth that determines the clarity of speech, the transmission delay that determines the system delay, and the anti-interference performance.
  • wireless audio is mostly insensitive to clock synchronization. In these application scenarios, only the audio data (signal) can be transmitted to the opposite end without packet loss. However, some application scenarios have strict requirements on clock synchronization.
  • the microphone is to be wireless
  • the clock deviation between two digital wireless devices needs to be considered, if the clock deviation exceeds 10ppm (ppm: one millionth) , the acoustic echo cancellation performance will be significantly reduced, which may cause echo, whistling and other interference in the conference system, which seriously affects the user experience and must be solved.
  • PTP Precision Time Protocol
  • wired-based clock synchronization technologies are implemented based on the Precision Time Protocol (PTP), which is already very mature.
  • PTP requires the round-trip time of the data packet to be as small as possible, and can accurately measure the time when the data packet is sent or arrived.
  • PTP it is difficult to stabilize the transmission time of data packets in wireless transmission. Therefore, the current clock synchronization technology based on wired mode is not suitable for the clock synchronization of wireless transmission.
  • the present application provides a clock synchronization method, device and storage medium to perform precise clock synchronization in wireless transmission.
  • an embodiment of the present application provides a clock synchronization method, which is applied to a slave device.
  • the slave device uses the clock of the master device as a standard clock.
  • the first moment is the moment when the slave device sends a clock synchronization request
  • the second time is the time when the master device receives the clock synchronization request
  • the third time is the time when the slave device receives the clock synchronization response
  • the clock synchronization response carries the second time.
  • the method includes: acquiring a time interval of two measurements, where the two measurements are two measurements with a time difference between the first moment and the third moment less than a preset time difference, and the time interval is based on the first moment and/or the third moment in the two measurements.
  • time is determined; if the time interval is greater than the preset time interval, the clock deviation of the slave device relative to the master device is determined according to the time interval and the third time in the two measurements, and the preset time interval is determined according to the preset clock deviation measurement accuracy ; Determine the synchronization clock of the master device according to the system clock and clock deviation of the slave device.
  • the above-mentioned determining the clock deviation of the slave device relative to the master device according to the time interval and the third moment in the two measurements may include: determining the clock deviation of the slave device relative to the master device according to the following formula:
  • ⁇ t A is the difference between the third time in the two measurements; ⁇ t B is the time interval.
  • an embodiment of the present application provides a clock synchronization device, which is applied to a slave device.
  • the slave device uses the clock of the master device as a standard clock.
  • the first moment is the moment when the slave device sends a clock synchronization request
  • the second time is the time when the master device receives the clock synchronization request
  • the third time is the time when the slave device receives the clock synchronization response
  • the clock synchronization response carries the second time.
  • the clock synchronization device includes:
  • the acquisition module is used to acquire the time interval of two measurements, where the two measurements are two measurements with the time difference between the first moment and the third moment being less than the preset time difference, and the time interval is based on the first moment and/or the second measurement in the two measurements. three times fixed;
  • the processing module is used to determine the clock deviation of the slave device relative to the master device according to the time interval and the third moment in the two measurements when the time interval is greater than the preset time interval, and the preset time interval is the measurement accuracy according to the preset clock deviation determined; and, based on the system clock and clock skew of the slave device, determining the synchronization clock of the master device.
  • the processing module determines the clock deviation of the slave device relative to the master device according to the time interval and the third moment in the two measurements, it can be used to: determine the clock deviation of the slave device relative to the master device according to the following formula: :
  • ⁇ t A is the difference between the third time in the two measurements; ⁇ t B is the time interval.
  • the preset time difference is determined according to the characteristics of the wireless technology.
  • the wireless technology may include at least one of the following:
  • WiFi wireless Internet access
  • Zigbee protocol Zigbee
  • Z-Wave home IoT communication protocol technology
  • the size of the preset time interval is a value obtained by dividing the preset time difference by the preset clock offset measurement accuracy.
  • the time interval is the difference between the first moments in the two measurements; or, the time interval is the difference between the third moments in the two measurements.
  • an electronic device including:
  • a processor configured to invoke and execute program instructions in the memory, to execute the method according to any one of the first aspects.
  • an embodiment of the present application provides a computer-readable storage medium, where program instructions are stored on the computer-readable storage medium; when the program instructions are executed, the method according to any one of the first aspects is implemented.
  • the clock synchronization method, device, and storage medium provided in the embodiments of the present application are applied to a slave device that uses the clock of the master device as a standard clock.
  • the first moment is the moment when the slave device sends a clock synchronization request
  • the second moment is The time when the master device receives the clock synchronization request
  • the third time is the time when the slave device receives the clock synchronization response
  • the clock synchronization response carries the second time.
  • the method includes: acquiring a time interval of two measurements, where the two measurements are two measurements with a time difference between the first moment and the third moment less than a preset time difference, and the time interval is based on the first moment and/or the third moment in the two measurements.
  • Time is determined; when the time interval is greater than the preset time interval, the clock deviation of the slave device relative to the master device is determined according to the time interval and the third time in the two measurements, and the preset time interval is determined according to the preset clock deviation measurement accuracy ; Determine the synchronization clock of the master device according to the system clock and clock deviation of the slave device. Since the second moment in a measurement is between the first moment and the third moment, the smaller the time difference between the first moment and the third moment, the more credible the second moment is.
  • the time difference between the time and the third time is less than the preset time difference; in addition, when the time interval between the two measurements is greater than the preset time interval, the clock deviation of the slave device relative to the master device is determined, and the preset clock deviation is satisfied by setting the preset time interval. Measurement accuracy for precise clock synchronization in wireless transmissions.
  • FIG. 1 is an example diagram of an application scenario provided by an embodiment of the present application
  • FIG. 2 is a flowchart of a clock synchronization method provided by an embodiment of the present application.
  • FIG. 3 is an example diagram of signaling interaction in a clock synchronization method provided by an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a clock synchronization apparatus provided by an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
  • wireless audio is mostly insensitive to clock synchronization, such as watching live broadcasts with mobile phones, wireless microphones, wireless walkie-talkies, and so on.
  • the delay is only required to be as low as possible, such as wireless microphone sound reinforcement.
  • some application scenarios have strict requirements on clock synchronization, for example, conference systems.
  • the microphone is to be wireless, due to the problem of acoustic echo cancellation, it is necessary to consider the clock deviation between the two digital wireless devices.
  • the clock deviation is caused by the error in the accuracy of devices such as crystal oscillators. This clock skew will cause the two digital wireless devices to sample the audio at slightly different rates, and this slight difference will have a big impact on the acoustic echo cancellation process. If the clock deviation exceeds 10ppm, the acoustic echo cancellation performance will be significantly reduced, which may lead to interference such as echo and howling in the conference system, which seriously affects the user experience.
  • the core of clock synchronization is to calculate the clock deviation between two devices.
  • the present application provides a method for clock synchronization in a wireless environment, which can obtain accurate clock synchronization results even in a complex environment with great interference.
  • the slave device obtains two measurements in which the time difference between the first moment and the third moment is less than the preset time difference, and only when the time interval between the two measurements is greater than the preset time interval, determines its relative value to the master device. Clock deviation, meet the preset clock deviation measurement accuracy by setting the preset time interval.
  • this solution has low requirements on data packet transmission delay, timestamp measurement, etc., and has strong adaptability; moreover, this solution does not rely on specific wireless technologies, such as WiFi, Bluetooth, Zigbee, Z-Wave, Home Internet of Things communication protocol technology (Thread), U-segment and other wireless technologies can be applied.
  • specific wireless technologies such as WiFi, Bluetooth, Zigbee, Z-Wave, Home Internet of Things communication protocol technology (Thread), U-segment and other wireless technologies can be applied.
  • FIG. 1 is an example diagram of an application scenario provided by an embodiment of the present application. As shown in Figure 1:
  • the electronic device A and the electronic device B communicate through wireless technology, and the two need to be time synchronized.
  • the electronic device A is the master device
  • the electronic device B is the slave device
  • the electronic device B should use the clock of the electronic device A as the standard clock.
  • the clock synchronization method provided by this application can accurately calculate the time between the electronic device B and the electronic device A. Clock skew, so that the data can be compensated and processed by software.
  • the electronic device A uses an interactive white board as an example
  • the electronic device B uses a wireless microphone as an example, but this application is not limited thereto.
  • the interactive tablet integrates any one or more functions of a projector, an electronic whiteboard, a curtain, a sound, a TV, and a video conference terminal;
  • a wireless microphone, or wireless microphone is an audio device that transmits sound signals.
  • the wireless microphone in this application is a two-way wireless communication system.
  • conference software is installed in the interactive tablet, and both the local conference participant and the opposite conference participant can log in to the conference software through the interactive tablet to participate in the same conference.
  • the wireless microphone transmits the audio signals of the local conference participants obtained by it to the interactive tablet through wireless technology, and the interactive tablet sends the local conference content to the opposite end, and the local conference content includes the local conference participants.
  • the interactive tablet receives the content of the conference at the opposite end, and plays the audio and video signals involved in the content of the meeting at the opposite end to the participants in the meeting at the local end.
  • the wireless microphone will also receive the audio signal.
  • the wireless microphone needs to perform acoustic echo cancellation.
  • the wireless microphone should use the clock of the interactive tablet as the standard clock for clock synchronization.
  • Figure 1 takes a conference scene as an example for illustration, but this application is not limited by this; in addition, the master device and the slave device are relative concepts.
  • the two electronic devices that perform wireless transmission through wireless technology one is the master device and the other One is a slave device, and the two can be interchanged, depending on the actual situation.
  • the electronic device corresponding to "one" is the master device, and the multiple electronic devices corresponding to "many" are slave devices.
  • FIG. 2 is a flowchart of a clock synchronization method provided by an embodiment of the present application.
  • the clock synchronization method may be performed by a clock synchronization apparatus, and the clock synchronization apparatus may be implemented by means of software and/or hardware.
  • the clock synchronization apparatus may be a slave device or a chip or circuit of the slave device.
  • the clock synchronization method provided by this embodiment includes:
  • the first moment is the moment when the slave device sends the clock synchronization request
  • the second moment is the moment when the master device receives the clock synchronization request
  • the third moment is the moment when the slave device receives the clock synchronization response
  • the second time instant is carried in the clock synchronization response.
  • the slave device sends a clock synchronization request, and at the same time records the time when the clock synchronization request is issued: the first time t B1 ;
  • the master device When the master device receives the clock synchronization request, it records the received time: the second time t A1 , and immediately carries the second time t A1 in the clock synchronization response and replies to the slave device;
  • a set of clock information is obtained from the device, which are respectively recorded as: the first time t B1 , the second time t A1 and the third time t B2 .
  • the slave device measures again to obtain another set of clock information: the first time t B3 , the second time t A2 and the third time t B4 .
  • the slave device measures again to obtain another set of clock information: the first time t B5 , the second time t A3 and the third time t B6 .
  • the clock deviation of the slave device relative to the master device can be determined according to the above clock information.
  • many clock information has large errors. Therefore, it is necessary to select relatively reliable two sets of clock information.
  • the slave device can obtain clock information periodically after being powered on, for example, every 3 seconds.
  • the second moment Since the second moment must be recorded between the first moment and the third moment, it can be understood that when the time difference between the third moment and the first moment is smaller, it can be considered that the second moment is more credible (the error is smaller). Therefore, the error size of the second moment can be measured by comparing the time difference between the third moment and the first moment. Synchronization request and clock synchronization response) transmission is faster, then the three clock information is relatively accurate, and then the clock deviation determined according to the three clock information will be more accurate. Therefore, the present application requires that the two measurements participating in the clock offset calculation must satisfy: the time difference between the first moment and the third moment is less than the preset time difference. For example, referring to FIG.
  • ⁇ TB1 needs to be smaller than the preset time difference, and if ⁇ TB1 is greater than or equal to the preset time difference, the group of time information is discarded, that is to say, this measurement does not participate in the calculation of the clock offset.
  • ⁇ TB2 needs to be smaller than the preset time difference, otherwise the group of time information is discarded, and so on.
  • the time interval is determined according to the first moment of the two measurements
  • the time interval is determined according to the third moment in the two measurements.
  • the time interval is determined according to the first moment and the third moment in the two measurements.
  • the above-mentioned time interval is the time interval corresponding to the slave device in the two measurements, and reference may be made to subsequent embodiments for the determination method.
  • the preset time interval corresponding to different wireless technologies is determined according to the preset clock deviation measurement accuracy, and the clock deviation measurement accuracy is exchanged for time.
  • the wireless technology is the technology used for wireless transmission between the master device and the slave device.
  • the step may be: through the third moment in the two measurements, the time interval corresponding to the master device in the two measurements can be determined, so that the time intervals corresponding to the master device and the slave device in the two measurements are both the same.
  • the clock deviation of the slave device relative to the master device can be determined.
  • the sum of the system clock of the slave device and the clock deviation is approximately the synchronous clock of the master device, so that the clocks of the master device and the slave device can be synchronized.
  • the embodiment of the present application is applied to a slave device that uses the clock of the master device as the standard clock.
  • the time interval between two measurements is obtained from the device, and the two measurements are two times when the time difference between the first moment and the third moment is less than the preset time difference.
  • Measurement the time interval is determined according to the first moment and/or the third moment in the two measurements; then, when the time interval is greater than the preset time interval, the slave device determines according to the time interval and the third moment in the two measurements.
  • the clock deviation of the slave device relative to the master device, and the preset time interval is determined according to the preset clock deviation measurement accuracy; then, the synchronization clock of the master device is determined according to the system clock and clock deviation of the slave device.
  • the time difference between the time and the third time is less than the preset time difference; in addition, when the time interval between the two measurements is greater than the preset time interval, the clock deviation of the slave device relative to the master device is determined, and the preset clock deviation is satisfied by setting the preset time interval. Measurement accuracy for precise clock synchronization in wireless transmissions.
  • the preset time difference is determined according to the characteristics of the wireless technology (actual delay conditions of different platforms). For example, when the wireless technology is WiFi, the preset time difference is 1 millisecond (ms), that is, when the time difference between the third moment and the first moment is 1 ms, the third moment is considered reliable; for another example, when the wireless technology For Bluetooth, the preset time difference is 500 microseconds ( ⁇ s).
  • the size of the preset time interval is a value obtained by dividing the preset time difference by the preset clock offset measurement accuracy.
  • the preset clock deviation measurement accuracy is 10ppm. If the preset time difference is considered reliable within 1ms (depending on the actual delay conditions of different platforms), it is necessary to find two measurement results with a time interval greater than 100 seconds to meet the accuracy requirements. , that is, the preset time interval is 100 seconds (s).
  • the above-mentioned determining the clock deviation of the slave device relative to the master device according to the time interval and the third time in the two measurements may include: determining the clock deviation of the slave device relative to the master device according to the following formula:
  • ⁇ t A is the difference between the third time in the two measurements; ⁇ t B is the time interval.
  • the time elapsed from the device, the time interval is calculated in at least three ways:
  • the time interval is the difference between the third time in the two measurements: t B4 -t B2 ;
  • This application does not limit the acquisition method of the time interval.
  • the present application provides a clock synchronization method, which is simple and reliable, has good adaptability, and consumes less resources, and has good flexibility and does not depend on wireless technology.
  • FIG. 4 is a schematic structural diagram of a clock synchronization apparatus provided by an embodiment of the present application.
  • the clock synchronization device can be implemented in software and/or hardware.
  • the clock synchronization device may be an electronic device such as a computer, a mobile phone, a tablet, a PDA or an interactive tablet; or, the clock synchronization device may be a chip or circuit of the electronic device.
  • the clock synchronization device provided in the embodiment of the present application is applied to a slave device, and the slave device uses the clock of the master device as a standard clock.
  • the first moment is the moment when the slave device sends a clock synchronization request
  • the second moment is the time when the master device receives the request.
  • the third time is the time when the slave device receives the clock synchronization response
  • the clock synchronization response carries the second time.
  • the clock synchronization apparatus 40 includes: an acquisition module 41 and a processing module 42 . in:
  • the acquiring module 41 is configured to acquire the time interval between two measurements.
  • the two measurements are two measurements in which the time difference between the first moment and the third moment is less than the preset time difference, and the time interval is determined according to the first moment and/or the third moment in the two measurements.
  • the processing module 42 is configured to determine the clock deviation of the slave device relative to the master device according to the time interval and the third moment in the two measurements when the time interval is greater than the preset time interval; the preset time interval is measured according to the preset clock deviation Accuracy is determined; and, based on the system clock and clock offset of the slave device, the synchronization clock of the master device is determined.
  • the processing module 42 when determining the clock deviation of the slave device relative to the master device according to the time interval and the third time in the two measurements, can be used to: determine the clock deviation of the slave device relative to the master device according to the following formula:
  • ⁇ t A is the difference between the third time in the two measurements; ⁇ t B is the time interval.
  • the preset time difference is determined according to the characteristics of the wireless technology.
  • the wireless technology may include at least one of the following:
  • the size of the preset time interval is a value obtained by dividing the preset time difference by the preset clock offset measurement accuracy.
  • the time interval is the difference between the first moments in the two measurements; or, the time interval is the difference between the third moments in the two measurements.
  • the clock synchronization apparatus of the embodiment of the present application is applied to a slave device using the clock of the master device as the standard clock.
  • the time interval between two measurements is obtained, and the two measurements are that the time difference between the first moment and the third moment is less than the preset time difference.
  • Two measurements the time interval is determined according to the first moment and/or the third moment in the two measurements; then, when the time interval is greater than the preset time interval, according to the time interval and the third moment in the two measurements, determine The clock deviation of the slave device relative to the master device, and the preset time interval is determined according to the preset clock deviation measurement accuracy; then, the synchronization clock of the master device is determined according to the system clock and clock deviation of the slave device.
  • the time difference between the time and the third time is less than the preset time difference; in addition, when the time interval between the two measurements is greater than the preset time interval, the clock deviation of the slave device relative to the master device is determined, and the preset clock deviation is satisfied by setting the preset time interval. Measurement accuracy for precise clock synchronization in wireless transmissions.
  • FIG. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
  • the electronic device 50 includes a processor 51 , a memory 52 , a communication module 53 and a sound pickup module 54 connected to the processor 51 .
  • the processor 51 may include one or more processing units.
  • the processor 51 may be a central processing unit (Central Processing Unit, referred to as: CPU), or a digital signal processor (Digital Signal Processor, referred to as: DSP), dedicated Integrated circuit (Application Specific Integrated Circuit, referred to as: ASIC) and so on.
  • a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method provided in combination with the application can be directly embodied as executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.
  • Memory 52 may be used to store program instructions.
  • the memory 52 may include a stored program area and a stored data area.
  • the storage program area may store an operating system, an application program required for at least one function (such as a sound playback function, etc.), and the like.
  • the storage data area may store data (such as audio data, etc.) created during the use of the electronic device 50 and the like.
  • the memory 52 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (universal flash storage, UFS for short), and the like.
  • the processor 51 executes various functional applications and data processing of the electronic device 50 by executing program instructions stored in the memory 52 .
  • the communication module 53 can provide a wireless communication solution including 2G/3G/4G/5G, etc. applied on the electronic device 50 .
  • the communication module 53 can receive electromagnetic waves from the antenna, filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
  • the communication module 53 can also amplify the signal modulated by the modulation and demodulation processor, and then convert it into electromagnetic waves for radiation through the antenna.
  • at least part of the functional modules of the communication module 53 may be provided in the processor 51 .
  • at least part of the functional modules of the communication module 53 may be provided in the same device as at least part of the modules of the processor 51 .
  • the pickup module 54 can convert the analog audio input to a digital audio signal, and the pickup module 54 can also be used to encode and decode the audio signal.
  • the sound pickup module 54 may be disposed in the processor 51 , or some functional modules of the sound pickup module 54 may be disposed in the processor 51 .
  • the sound pickup module 54 includes a speaker, and is equipped with an intelligent noise reduction and echo cancellation algorithm, so as to effectively reduce the background noise and harsh howling of the conference, improve the sound clarity, and bring a high-quality voice experience.
  • the electronic device 50 further includes: a camera 55 and/or a display screen 56, and the like.
  • the camera 55 can capture images or videos.
  • the camera 55 may capture video under the control of the processor 51 and store the video in the memory 52 .
  • the display screen 56 is used to display images, videos, and the like.
  • the display screen 56 includes a display panel.
  • the display panel can be a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (Active- Matrix Organic Light Emitting Diode, abbreviation: AMOLED), flexible light-emitting diode (Flex Light-Emitting Diode, abbreviation: FLED), Miniled, MicroLed, Micro-oLed, Quantum Dot Light Emitting Diodes (Quantum Dot Light Emitting Diodes, abbreviation: QLED), etc. .
  • LCD Liquid Crystal Display
  • OLED Organic Light-Emitting Diode
  • AMOLED Active-matrix organic light-emitting diode
  • FLED Flexible light-emitting diode
  • Miniled Micro
  • the electronic device 50 may include one or N display screens 56 , where N is a positive integer greater than one.
  • the display panel can receive a touch operation input by a user through a finger or an input device.
  • the input device includes but is not limited to: a touch pen, an infrared pen, and/or a capacitive pen, and the like.
  • the number of the memory 52 and the processor 51 is not limited in the embodiments of the present application, and they may be one or more, and FIG. 5 uses one as an example for illustration; the memory 52 and the processor 51 can be wired or wirelessly connected in various ways, for example, a bus connection.
  • the electronic device 50 may be a computer, a mobile phone, a tablet, a PDA or an interactive tablet.
  • the bus can be an Industry Standard Architecture (referred to as: ISA) bus, a Peripheral Component (referred to as: PCI) bus, or an Extended Industry Standard Architecture (referred to as: EISA) bus or the like.
  • ISA Industry Standard Architecture
  • PCI Peripheral Component
  • EISA Extended Industry Standard Architecture
  • the bus can be divided into address bus, data bus, control bus and so on.
  • the buses in the drawings of the present application are not limited to only one bus or one type of bus.
  • the electronic device in this embodiment can be used to execute the technical solutions in the foregoing method embodiments, and the implementation principles and technical effects thereof are similar, and details are not repeated here.
  • Embodiments of the present application further provide a computer-readable storage medium, where program instructions are stored on the computer-readable storage medium, and when the program instructions are executed, the clock synchronization method described in any of the foregoing embodiments is implemented.
  • the disclosed apparatus and method may be implemented in other manners.
  • the device embodiments described above are only illustrative.
  • the division of the modules is only a logical function division. In actual implementation, there may be other division methods.
  • multiple modules may be combined or integrated. to another system, or some features can be ignored, 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 modules, and may be in electrical, mechanical or other forms.
  • each functional module in each embodiment of the present application may be integrated in one processing unit, or each module may exist physically alone, or two or more modules may be integrated in one unit.
  • the units formed by the above modules can be implemented in the form of hardware, or can be implemented in the form of hardware plus software functional units.
  • the above-mentioned integrated modules implemented in the form of software functional modules may be stored in a computer-readable storage medium.
  • the above-mentioned software function modules are stored in a storage medium, and include several instructions to make 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 application. some steps.
  • the above-mentioned storage medium may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable Except programmable read only memory (EPROM), programmable read only memory (PROM), read only memory (ROM), magnetic memory, flash memory, magnetic or optical disks, etc.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read only memory
  • EPROM erasable Except programmable read only memory
  • PROM programmable read only memory
  • ROM read only memory
  • magnetic memory flash memory
  • flash memory magnetic or optical disks, etc.
  • a storage medium can be any available medium that can be accessed by a general purpose or special purpose computer.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Electric Clocks (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)

Abstract

一种时钟同步方法、装置及存储介质,一次测量中,第一时刻为从设备发送时钟同步请求的时刻,第二时刻为主设备接收时钟同步请求的时刻,第三时刻为从设备接收时钟同步响应的时刻,时钟同步响应携带第二时刻。获取第一时刻与第三时刻的时间差小于预设时间差的两次测量的时间间隔,时间间隔是根据两次测量中第一时刻和/或第三时刻确定的;若时间间隔大于预设时间间隔,根据时间间隔及两次测量中的第二时刻,确定从设备相对主设备的时钟偏差,预设时间间隔是根据预设时钟偏差测量精度确定的;根据从设备的系统时钟和时钟偏差,确定主设备的同步时钟。在无线传输中进行精确的时钟同步。

Description

时钟同步方法、装置及存储介质
本申请要求于2020年9月3日提交中国专利局、申请号为CN202010914929.0、发明名称为“时钟同步方法、装置及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及无线音频传输技术领域,尤其涉及一种时钟同步方法、装置及存储介质。
背景技术
在无线音频传输技术中,关键的技术指标包括:决定语音的清晰度的传输带宽、决定系统延时的传输延时以及抗干扰性能等。在普通的应用场景下,无线音频大多对时钟同步不敏感,这些应用场景下只要音频数据(信号)不丢包的传输至对端即可。但某些应用场景对时钟同步有严格要求。例如,在会议系统中,如果要将麦克风无线化,由于存在声学回声消除的问题,需要考虑两个数字无线设备之间的时钟偏差,若该时钟偏差超过10ppm(ppm:百万分之一),则声学回声消除性能将会明显降低,这在会议系统中可能导致出现回声、啸叫等干扰,严重影响用户体验的问题,必须予以解决。
目前,基于有线方式的时钟同步技术大多基于高精度时间同步协议(Precision Time Protocol,简称:PTP)实现,已经十分成熟。其中,PTP要求数据包的往返时间尽可能小,并且可以精确测量数据包发出或者到达的时刻。但无线传输中数据包的传输时间很难稳定,因此,目前基于有线方式的时钟同步技术并不适用于无线传输的时钟同步。
发明内容
本申请提供一种时钟同步方法、装置及存储介质,以在无线传输中进行精确的时钟同步。
第一方面,本申请实施例提供一种时钟同步方法,应用于从设备,从设备以主设备的时钟为标准时钟,在一次测量中,第一时刻为从设备发送时钟同步请求的时刻,第二时刻为主设备接收时钟同步请求的时刻,第三时刻为从设备接收时钟同步响应的时刻,时钟同步响应中携带第二时刻。 该方法包括:获取两次测量的时间间隔,两次测量为第一时刻与第三时刻的时间差小于预设时间差的两次测量,时间间隔是根据两次测量中第一时刻和/或第三时刻确定的;若时间间隔大于预设时间间隔,则根据时间间隔及两次测量中的第三时刻,确定从设备相对主设备的时钟偏差,预设时间间隔是根据预设时钟偏差测量精度确定的;根据从设备的系统时钟和时钟偏差,确定主设备的同步时钟。
一种可能的实施方式中,上述根据时间间隔及两次测量中的第三时刻,确定从设备相对主设备的时钟偏差,可以包括:根据如下公式确定从设备相对主设备的时钟偏差:
Δt=(Δt B-Δt A)/Δt A
其中,Δt A为两次测量中的第三时刻间的差值;Δt B为时间间隔。
第二方面,本申请实施例提供一种时钟同步装置,应用于从设备,从设备以主设备的时钟为标准时钟,在一次测量中,第一时刻为从设备发送时钟同步请求的时刻,第二时刻为主设备接收时钟同步请求的时刻,第三时刻为从设备接收时钟同步响应的时刻,时钟同步响应中携带第二时刻。时钟同步装置包括:
获取模块,用于获取两次测量的时间间隔,两次测量为第一时刻与第三时刻的时间差小于预设时间差的两次测量,时间间隔是根据两次测量中第一时刻和/或第三时刻确定的;
处理模块,用于在时间间隔大于预设时间间隔时,根据时间间隔及两次测量中的第三时刻,确定从设备相对主设备的时钟偏差,预设时间间隔是根据预设时钟偏差测量精度确定的;以及,根据从设备的系统时钟和时钟偏差,确定主设备的同步时钟。
一种可能的实施方式中,处理模块在根据时间间隔及两次测量中的第三时刻,确定从设备相对主设备的时钟偏差时,可用于:根据如下公式确定从设备相对主设备的时钟偏差:
Δt=(Δt B-Δt A)/Δt A
其中,Δt A为两次测量中的第三时刻间的差值;Δt B为时间间隔。
在上述实施方式的基础上:
可选地,预设时间差是根据无线技术的特点确定的。
可选地,无线技术可以包括以下至少一种:
蓝牙、无线上网(WiFi)、紫蜂协议(Zigbee)、Z-Wave、家庭物联网通讯协定技术(Thread)。
可选地,预设时间间隔的大小为预设时间差除以预设时钟偏差测量精度所得的数值。
可选地,时间间隔为两次测量中的第一时刻间的差值;或者,时间间隔为两次测量中的第三时刻间的差值。
可选地,时间间隔为:Δt B=(t B4+t B3)/2-(t B2+t B1)/2,其中,t B3与t B4分别两次测量中一次测量的第一时刻和第三时刻;t B1与t B2分别两次测量中另一次测量的第一时刻和第三时刻。
第三方面,本申请实施例提供一种电子设备,包括:
存储器,用于存储程序指令;
处理器,用于调用并执行存储器中的程序指令,执行如第一方面中任一项所述的方法。
第四方面,本申请实施例提供一种计算机可读存储介质,计算机可读存储介质上存储有程序指令;程序指令被执行时,实现如第一方面中任一项所述的方法。
本申请实施例提供的时钟同步方法、装置及存储介质,应用于以主设备的时钟为标准时钟的从设备,在一次测量中,第一时刻为从设备发送时钟同步请求的时刻,第二时刻为主设备接收时钟同步请求的时刻,第三时刻为从设备接收时钟同步响应的时刻,时钟同步响应中携带第二时刻。该方法包括:获取两次测量的时间间隔,两次测量为第一时刻与第三时刻的时间差小于预设时间差的两次测量,时间间隔是根据两次测量中第一时刻和/或第三时刻确定的;在时间间隔大于预设时间间隔时,根据时间间隔及两次测量中的第三时刻,确定从设备相对主设备的时钟偏差,预设时间间隔是根据预设时钟偏差测量精度确定的;根据从设备的系统时钟和时钟偏差,确定主设备的同步时钟。由于一次测量中第二时刻是在第一时刻和第三时刻之间,第一时刻与第三时刻的时间差越小说明第二时刻越可信,因此,本申请获取的两次测量的第一时刻与第三时刻的时间差小于预设时间差;另外,在两次测量的时间间隔大于预设时间间隔时,才确定从设备相对主设备的时 钟偏差,通过设置预设时间间隔满足预设时钟偏差测量精度,从而在无线传输中进行精确的时钟同步。
附图说明
为了更清楚地说明本申请实施例或相关技术中的技术方案,下面将对实施例或相关技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请一实施例提供的应用场景示例图;
图2为本申请一实施例提供的时钟同步方法的流程图;
图3为本申请一实施例提供的时钟同步方法中信令交互示例图;
图4为本申请一实施例提供的时钟同步装置的结构示意图;
图5为本申请一实施例提供的电子设备的结构示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请实施例的说明书、权利要求书及上述附图中的术语“第一”和“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例例如能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
应当理解,本文中使用的术语“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。“/”表示“或”的关系。
在普通的应用场景下,无线音频大多对时钟同步不敏感,例如,使用手 机观看直播、无线话筒、无线对讲机,等等。这些应用场景下只要音频数据(信号)不丢包的传输至对端即可,即使在实时音频的场景下也只要求延时尽可能地低,例如无线话筒扩声。但某些应用场景对时钟同步有严格要求,例如,会议系统。
在会议系统中,如果要将麦克风无线化,由于存在声学回声消除的问题,需要考虑两个数字无线设备之间的时钟可能存在时钟偏差。该时钟偏差是由于晶振等器件的精度存在误差等原因导致的。这个时钟偏差会导致两个数字无线设备对音频的采样率有细微差异,这个细微的差异在声学回声消除处理时将会产生较大影响。若该时钟偏差超过10ppm,则声学回声消除性能将会明显降低,这在会议系统中可能导致出现回声、啸叫等干扰,严重影响用户体验的问题。
无线传输的时钟同步存在较大难度,主要原因是无线传输中间环节存在干扰、冲撞等不可控因素影响,这些影响会导致数据包的传输时间很难稳定,而目前基于有线方式的时钟同步技术中,PTP要求数据包的往返时间尽可能小并且可以精确测量数据包发出或者到达的时刻。因此,亟需一种适用于无线传输的时钟同步方案。
其中,时钟同步的核心是:计算两设备间的时钟偏差。
基于上述发现,本申请提供一种在无线环境下进行时钟同步的方法,即使在干扰很大的复杂环境中也可以得到精确的时钟同步结果。在一实施例中,从设备通过获取第一时刻与第三时刻的时间差小于预设时间差的两次测量,并在两次测量的时间间隔大于预设时间间隔时,才确定其相对主设备的时钟偏差,通过设置预设时间间隔满足预设时钟偏差测量精度。
另外,本方案对数据包的传输延时、时间戳测量等要求不高,具有很强的适应性;且,本方案不依赖特定的无线技术,例如,WiFi、蓝牙、Zigbee、Z-Wave、家庭物联网通讯协定技术(Thread)、U段等无线技术中均可以应用。
图1为本申请一实施例提供的应用场景示例图。如图1所示:
电子设备A与电子设备B之间通过无线技术进行通信,二者需进行时间同步。其中,电子设备A为主设备,电子设备B为从设备,电子设备B要以电子设备A的时钟为标准时钟,通过本申请提供的时钟同步方法可以精确计算出电子设备B与电子设备A的时钟偏差,从而通过软件进行数据的补偿和 处理。
图1所示示例中,电子设备A以交互平板(interactive white board)为例,电子设备B以无线麦克风为例,但本申请不以此为限制。其中,交互平板,集成有投影机、电子白板、幕布、音响、电视机以及视频会议终端等功能中的任意一种或多种功能;无线麦克风,或称无线话筒,是传输声音信号的音响器材,由发射机和接收机两大部分组成,通常称为无线麦克风系统。本申请中的无线麦克风为双向式无线通信系统。在一实施例中,交互平板中安装有会议软件,本端会议参与者和对端会议参与者均可通过交互平板登录会议软件以参与同一会议。会议过程中,无线麦克风将其获取的本端会议参与者的音频信号通过无线技术传输给交互平板,由交互平板将本端会议内容发送给对端,该本端会议内容包括本端会议参与者的音频信号和视频信号;同时,交互平板接收对端会议内容,并将对端会议内容中涉及的音频信号和视频信号播放给本端会议参与者。在交互平板播放音频信号时,无线麦克风也会接收到该音频信号,为避免出现回声、啸叫等干扰,无线麦克风需要进行声学回声消除。此时,无线麦克风要以交互平板的时钟为标准时钟,来进行时钟同步。
图1以会议场景为例进行说明,但本申请不以此为限制;另外,主设备和从设备为相对概念,两个通过无线技术进行无线传输的电子设备中,其中一个为主设备,另一个为从设备,二者可以互换,视实际情况而定。若无特殊说明,对于一对多场景,其中“一”对应的电子设备为主设备,“多”对应的多个电子设备为从设备。
以下结合具体的实施例,对本申请提供的时钟同步方法进行解释说明。
图2为本申请一实施例提供的时钟同步方法的流程图。该时钟同步方法可以由时钟同步装置执行,该时钟同步装置可以通过软件和/或硬件的方式实现。实际应用中,该时钟同步装置可以是从设备或从设备的芯片或电路。
参考图2,本实施例提供的时钟同步方法包括:
S201、获取两次测量的时间间隔,两次测量为第一时刻与第三时刻的时间差小于预设时间差的两次测量,时间间隔是根据两次测量中第一时刻和/或第三时刻确定的。
在一实施例中,在一次测量中,第一时刻为从设备发送时钟同步请求的 时刻,第二时刻为主设备接收时钟同步请求的时刻,第三时刻为从设备接收时钟同步响应的时刻,时钟同步响应中携带第二时刻。
如图3所示:
1、从设备发送时钟同步请求,同时记录时钟同步请求发出的时刻:第一时刻t B1
2、主设备收到时钟同步请求时记录接收的时刻:第二时刻t A1,并且立即将第二时刻t A1携带在时钟同步响应中回复给从设备;
3、从设备收到时钟同步响应时记录接收的时刻:第三时刻t B2,并且解析出第二时刻t A1
以上三步即可完成一次测量,此时,从设备获取到一组时钟信息,分别记为:第一时刻t B1、第二时刻t A1和第三时刻t B2
经过一段时间,从设备再次进行测量,从而得到另一组时钟信息:第一时刻t B3、第二时刻t A2和第三时刻t B4
又经过一段时间,从设备再次进行测量,从而得到又一组时钟信息:第一时刻t B5、第二时刻t A3和第三时刻t B6
此时,如果假定这两组时钟信息均为精确值,那么即可根据上述时钟信息确定从设备相对主设备的时钟偏差。但实际情况中由于无线环境干扰或者软件运行被抢占等因素影响,很多时钟信息都是误差较大的,因此,需要从中挑选出相对可靠的两组时钟信息。
需明确的是,从设备可以在上电开机后,周期性地获取时钟信息,例如每3秒获取一次。
一般的,在没有特殊硬件支持的条件下,上面三个时钟信息均是通过软件获取得到,所以必然存在误差,当然误差越小越好。
由于第二时刻一定是在第一时刻和第三时刻之间被记录,可以理解,当第三时刻和第一时刻的时间差越小,可以认为第二时刻越可信(误差越小)。因此,可以通过比较第三时刻和第一时刻的时间差的大小来衡量第二时刻的误差大小,如果第三时刻和第一时刻的时间差很小,说明从设备与主设备之间信息(例如时钟同步请求和时钟同步响应)传输较快,那么这三个时钟信息相对就准确,进而根据这三个时钟信息确定的时钟偏差会更精确。因此,本申请要求参与时钟偏差计算的两次测量要满足:第一时刻与第三时刻的时 间差小于预设时间差。示例地,参考图3,即ΔTB1需小于预设时间差,若ΔTB1大于或等于预设时间差,则丢弃该组时刻信息,也就是说本次测量不参与时钟偏差的计算。同理,ΔTB2需小于预设时间差,否则丢弃该组时刻信息,依次类推。
对于“时间间隔是根据两次测量中第一时刻和/或第三时刻确定的”,可以对应以下几种理解:
一、时间间隔是根据两次测量中第一时刻确定的;
二、时间间隔是根据两次测量中第三时刻确定的;
三、时间间隔是根据两次测量中第一时刻和第三时刻确定的。
其中,上述时间间隔是两次测量中从设备对应的时间间隔,其确定方式可参考后续实施例。
S202、若时间间隔大于预设时间间隔,则根据时间间隔及两次测量中的第三时刻,确定从设备相对主设备的时钟偏差,预设时间间隔是根据预设时钟偏差测量精度确定的。
可以理解,不同无线技术对时钟偏差的测量精度要求不同,因此,不同无线技术对应的预设时间间隔是根据预设时钟偏差测量精度确定的,由时间换取时钟偏差测量精度。其中,无线技术即主设备和从设备之间进行无线传输所采用的技术。
一种实现中,该步骤可以为:通过两次测量中的第三时刻,可以确定两次测量中主设备对应的时间间隔,这样两次测量中主设备和从设备对应的时间间隔均是已知的;在一实施例中,根据两次测量中主设备和从设备对应的时间间隔,可以确定从设备相对主设备的时钟偏差。
S203、根据从设备的系统时钟和时钟偏差,确定主设备的同步时钟。
可以理解,从设备的系统时钟与时钟偏差之和,即近似为主设备的同步时钟,从而实现主设备与从设备的时钟同步。
本申请实施例,应用于以主设备的时钟为标准时钟的从设备,首先从设备获取两次测量的时间间隔,两次测量为第一时刻与第三时刻的时间差小于预设时间差的两次测量,时间间隔是根据两次测量中第一时刻和/或第三时刻确定的;然后,在时间间隔大于预设时间间隔时,从设备根据时间间隔及两次测量中的第三时刻,确定从设备相对主设备的时钟偏差,预设时 间间隔是根据预设时钟偏差测量精度确定的;之后,根据从设备的系统时钟和时钟偏差,确定主设备的同步时钟。由于一次测量中第二时刻是在第一时刻和第三时刻之间,第一时刻与第三时刻的时间差越小说明第二时刻越可信,因此,本申请获取的两次测量的第一时刻与第三时刻的时间差小于预设时间差;另外,在两次测量的时间间隔大于预设时间间隔时,才确定从设备相对主设备的时钟偏差,通过设置预设时间间隔满足预设时钟偏差测量精度,从而在无线传输中进行精确的时钟同步。
在上述实施例中,预设时间差是根据无线技术的特点(不同平台的实际延时状况)确定的。例如,当无线技术为WiFi时,预设时间差为1毫秒(ms),也就是说,第三时刻和第一时刻的时间差为1ms时,认为第三时刻是可靠的;又例如,当无线技术为蓝牙时,预设时间差为500微秒(μs)。
一些实施例中,预设时间间隔的大小为预设时间差除以预设时钟偏差测量精度所得的数值。例如,预设时钟偏差测量精度为10ppm,如果预设时间差在1ms以内认为可靠(取决于不同平台的实际延时状况),则需要找到时间间隔大于100秒的两次测量结果才可以满足精度要求,也即预设时间间隔为100秒(s)。
在一实施例中,上述根据时间间隔及两次测量中的第三时刻,确定从设备相对主设备的时钟偏差,可以包括:根据如下公式确定从设备相对主设备的时钟偏差:
Δt=(Δt B-Δt A)/Δt A
其中,Δt A为两次测量中的第三时刻间的差值;Δt B为时间间隔。
仍以图3所示为例,得到:
主设备经过的时间:Δt A=t A2-t A1
从设备经过的时间,也即时间间隔,至少具有以下三种计算方式:
时间间隔为两次测量中的第一时刻间的差值:Δt B=t B3-t B1
时间间隔为两次测量中的第三时刻间的差值:t B4-t B2
时间间隔为:Δt B=(t B4+t B3)/2-(t B2+t B1)/2),其中,t B3与t B4分别两次测量中一次测量的第一时刻和第三时刻;t B1与t B2分别两次测量中另一次测量的第一时刻和第三时刻;
等等。
本申请不限制时间间隔的获取方式。
本申请提供一种时钟同步方法,简单可靠,适应性好,对资源消耗少;且灵活性较好,不依赖无线技术。
以下为本申请装置实施例,可以用于执行本申请上述方法实施例。对于本申请装置实施例中未披露的细节,可参考本申请上述方法实施例。
图4为本申请一实施例提供的时钟同步装置的结构示意图。该时钟同步装置可以通过软件和/或硬件的方式实现。实际应用中,该时钟同步装置可以是电脑,手机,平板,PDA或交互平板等电子设备;或者,该时钟同步装置可以是电子设备的芯片或电路。
本申请实施例提供的时钟同步装置应用于从设备,从设备以主设备的时钟为标准时钟,在一次测量中,第一时刻为从设备发送时钟同步请求的时刻,第二时刻为主设备接收时钟同步请求的时刻,第三时刻为从设备接收时钟同步响应的时刻,时钟同步响应中携带第二时刻。
如图4所示,时钟同步装置40包括:获取模块41和处理模块42。其中:
获取模块41,用于获取两次测量的时间间隔。两次测量为第一时刻与第三时刻的时间差小于预设时间差的两次测量,时间间隔是根据两次测量中第一时刻和/或第三时刻确定的。
处理模块42,用于在时间间隔大于预设时间间隔时,根据时间间隔及两次测量中的第三时刻,确定从设备相对主设备的时钟偏差;预设时间间隔是根据预设时钟偏差测量精度确定的;以及,根据从设备的系统时钟和时钟偏差,确定主设备的同步时钟。
一些实施例中,处理模块42在根据时间间隔及两次测量中的第三时刻,确定从设备相对主设备的时钟偏差时,可用于:根据如下公式确定从设备相对主设备的时钟偏差:
Δt=(Δt B-Δt A)/Δt A
其中,Δt A为两次测量中的第三时刻间的差值;Δt B为时间间隔。
在上述实施例的基础上:
可选地,预设时间差是根据无线技术的特点确定的。
可选地,无线技术可以包括以下至少一种:
蓝牙、WiFi、Zigbee)、Z-Wave、Thread,等等。
可选地,预设时间间隔的大小为预设时间差除以预设时钟偏差测量精度所得的数值。
在一实施例中,时间间隔为两次测量中的第一时刻间的差值;或者,时间间隔为两次测量中的第三时刻间的差值。
可选地,时间间隔为:Δt B=(t B4+t B3)/2-(t B2+t B1)/2,其中,t B3与t B4分别两次测量中一次测量的第一时刻和第三时刻;t B1与t B2分别两次测量中另一次测量的第一时刻和第三时刻。
本申请实施例的时钟同步装置,应用于以主设备的时钟为标准时钟的从设备,首先获取两次测量的时间间隔,两次测量为第一时刻与第三时刻的时间差小于预设时间差的两次测量,时间间隔是根据两次测量中第一时刻和/或第三时刻确定的;然后,在时间间隔大于预设时间间隔时,根据时间间隔及两次测量中的第三时刻,确定从设备相对主设备的时钟偏差,预设时间间隔是根据预设时钟偏差测量精度确定的;之后,根据从设备的系统时钟和时钟偏差,确定主设备的同步时钟。由于一次测量中第二时刻是在第一时刻和第三时刻之间,第一时刻与第三时刻的时间差越小说明第二时刻越可信,因此,本申请获取的两次测量的第一时刻与第三时刻的时间差小于预设时间差;另外,在两次测量的时间间隔大于预设时间间隔时,才确定从设备相对主设备的时钟偏差,通过设置预设时间间隔满足预设时钟偏差测量精度,从而在无线传输中进行精确的时钟同步。
图5为本申请一实施例提供的电子设备的结构示意图。如图5所示,电子设备50包括:处理器51,以及与处理器51连接的存储器52、通信模块53和拾音模块54。
处理器51可以包括一个或多个处理单元,例如:处理器51可以是中央处理单元(Central Processing Unit,简称:CPU),也可以是数字信号处理器(Digital Signal Processor,简称:DSP)、专用集成电路(Application Specific Integrated Circuit,简称:ASIC)等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合申请所提供的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。
存储器52可以用于存储程序指令。存储器52可以包括存储程序区和存 储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能等)等。存储数据区可存储电子设备50使用过程中所创建的数据(比如音频数据等)等。此外,存储器52可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,简称:UFS)等。处理器51通过运行存储在存储器52的程序指令,执行电子设备50的各种功能应用以及数据处理。
通信模块53可以提供应用在电子设备50上的包括2G/3G/4G/5G等无线通信的解决方案。通信模块53可以由天线接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。通信模块53还可以对经调制解调处理器调制后的信号放大,经天线转为电磁波辐射出去。在一些实施例中,通信模块53的至少部分功能模块可以被设置于处理器51中。在一些实施例中,通信模块53的至少部分功能模块可以与处理器51的至少部分模块被设置在同一个器件中。
拾音模块54可以将模拟音频输入转换为数字音频信号,拾音模块54还可以用于对音频信号编码和解码。在一些实施例中,拾音模块54可以设置于处理器51中,或将拾音模块54的部分功能模块设置于处理器51中。示例地,拾音模块54包含扬声器,搭配智能降噪和回声消除算法,以有效减少会议背景噪声和刺耳啸叫,提高声音清晰度,带来优质的语音体验。
可选地,电子设备50还包括:摄像头55和/或显示屏56,等等。
摄像头55可以进行图像或者视频的拍摄。例如,摄像头55可以在处理器51的控制下拍摄视频,并将视频存储至存储器52。
显示屏56用于显示图像,视频等。显示屏56包括显示面板。显示面板可以采用液晶显示器(Liquid Crystal Display,简称:LCD),有机发光二极管(Organic Light-Emitting Diode,简称:OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(Active-Matrix Organic Light Emitting Diode,简称:AMOLED),柔性发光二极管(Flex Light-Emitting Diode,简称:FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(Quantum Dot Light Emitting Diodes,简称:QLED)等。在一些实施例中,电子设备50可以包括1个或N个显示屏56,N为大于1的正整数。显示面板可以接收用户通过 手指或者输入设备输入的触摸操作。其中,输入设备包括但不限定于:触控笔、红外笔和/或电容笔等。
需说明的是,对于存储器52及处理器51的个数,本申请实施例不对其进行限制,其均可以为一个或多个,图5以一个为例进行图示;存储器52、及处理器51之间,可以通过多种方式进行有线或者无线连接,例如通过总线连接。实际应用中,该电子设备50可以是电脑,手机,平板,PDA或交互平板等。
总线可以是工业标准体系结构(Industry Standard Architecture,简称:ISA)总线、外部设备互连(Peripheral Component,简称:PCI)总线或扩展工业标准体系结构(Extended Industry Standard Architecture,简称:EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,本申请附图中的总线并不限定仅有一根总线或一种类型的总线。
本实施例的电子设备,可以用于执行上述方法实施例中的技术方案,其实现原理和技术效果类似,此处不再赘述。
本申请实施例还提供一种计算机可读存储介质,计算机可读存储介质上存储有程序指令,该程序指令被执行时,实现如上述任一实施例所述的时钟同步方法。
在上述的实施例中,应该理解到,所揭露的设备和方法,可以通过其它的方式实现。例如,以上所描述的设备实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个模块可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或模块的间接耦合或通信连接,可以是电性,机械或其它的形式。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个单元中。上述模块成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。
上述以软件功能模块的形式实现的集成的模块,可以存储在一个计算机可读取存储介质中。上述软件功能模块存储在一个存储介质中,包括若干指 令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本申请各个实施例所述方法的部分步骤。
上述存储介质可以是由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM)、电可擦除可编程只读存储器(EEPROM)、可擦除可编程只读存储器(EPROM)、可编程只读存储器(PROM)、只读存储器(ROM)、磁存储器、快闪存储器、磁盘或光盘等。存储介质可以是通用或专用计算机能够存取的任何可用介质。
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
最后应说明的是:以上各实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述各实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。

Claims (10)

  1. 一种时钟同步方法,其中,应用于从设备,所述从设备以主设备的时钟为标准时钟,在一次测量中,第一时刻为所述从设备发送时钟同步请求的时刻,第二时刻为所述主设备接收所述时钟同步请求的时刻,第三时刻为所述从设备接收时钟同步响应的时刻,所述时钟同步响应中携带所述第二时刻;
    所述方法包括:
    获取两次测量的时间间隔,所述两次测量为第一时刻与第三时刻的时间差小于预设时间差的两次测量,所述时间间隔是根据所述两次测量中的第一时刻和/或第三时刻确定的;
    若所述时间间隔大于预设时间间隔,则根据所述时间间隔及所述两次测量中的第三时刻,确定所述从设备相对所述主设备的时钟偏差,所述预设时间间隔是根据预设时钟偏差测量精度确定的;
    根据所述从设备的系统时钟和所述时钟偏差,确定所述主设备的同步时钟。
  2. 根据权利要求1所述的方法,其中,所述预设时间差是根据无线技术的特点确定的。
  3. 根据权利要求2所述的方法,其中,所述无线技术包括以下至少一种:
    蓝牙、无线上网WiFi、紫蜂协议、Z-Wave、家庭物联网通讯协定技术。
  4. 根据权利要求1所述的方法,其中,所述预设时间间隔的大小为所述预设时间差除以所述预设时钟偏差测量精度所得的数值。
  5. 根据权利要求1至4中任一项所述的方法,其中,所述根据所述时间间隔及所述两次测量中的第三时刻,确定所述从设备相对所述主设备的时钟偏差,包括:
    根据如下公式确定所述从设备相对所述主设备的时钟偏差:
    Δt=(Δt B-Δt A)/Δt A
    其中,Δt A为所述两次测量中的第三时刻间的差值;Δt B为所述时间间隔。
  6. 根据权利要求1至4中任一项所述的方法,其中,所述时间间隔为所述两次测量中的第一时刻间的差值;或者,所述时间间隔为所述两次测量中的第三时刻间的差值。
  7. 根据权利要求1至4中任一项所述的方法,其中,所述时间间隔为: Δt B=(t B4+t B3)/2-(t B2+t B1)/2,其中,t B3与t B4分别所述两次测量中一次测量的第一时刻和第三时刻;t B1与t B2分别所述两次测量中另一次测量的第一时刻和第三时刻。
  8. 一种时钟同步装置,其中,应用于从设备,所述从设备以主设备的时钟为标准时钟,在一次测量中,第一时刻为所述从设备发送时钟同步请求的时刻,第二时刻为所述主设备接收所述时钟同步请求的时刻,第三时刻为所述从设备接收时钟同步响应的时刻,所述时钟同步响应中携带所述第二时刻;
    所述装置包括:
    获取模块,用于获取两次测量的时间间隔,所述两次测量为第一时刻与第三时刻的时间差小于预设时间差的两次测量,所述时间间隔是根据所述两次测量中的第一时刻和/或第三时刻确定的;
    处理模块,用于在所述时间间隔大于预设时间间隔时,根据所述时间间隔及所述两次测量中的第三时刻,确定所述从设备相对所述主设备的时钟偏差,所述预设时间间隔是根据预设时钟偏差测量精度确定的;以及,根据所述从设备的系统时钟和所述时钟偏差,确定所述主设备的同步时钟。
  9. 一种电子设备,其中,包括:
    存储器,用于存储程序指令;
    处理器,用于调用并执行所述存储器中的程序指令,执行如权利要求1至7中任一项所述的方法。
  10. 一种计算机可读存储介质,其中,所述计算机可读存储介质上存储有程序指令;所述程序指令被执行时,实现如权利要求1至7中任一项所述的方法。
PCT/CN2020/139742 2020-09-03 2020-12-26 时钟同步方法、装置及存储介质 WO2022048075A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010914929.0 2020-09-03
CN202010914929.0A CN112040539B (zh) 2020-09-03 2020-09-03 时钟同步方法、装置及存储介质

Publications (1)

Publication Number Publication Date
WO2022048075A1 true WO2022048075A1 (zh) 2022-03-10

Family

ID=73591853

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/139742 WO2022048075A1 (zh) 2020-09-03 2020-12-26 时钟同步方法、装置及存储介质

Country Status (2)

Country Link
CN (1) CN112040539B (zh)
WO (1) WO2022048075A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115225244A (zh) * 2022-07-14 2022-10-21 广东电网有限责任公司 低压集抄电能表时钟对时方法、装置、主设备及介质
CN116436555A (zh) * 2023-06-09 2023-07-14 新华三技术有限公司 一种时间同步方法、装置及分布式网络设备

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112040539B (zh) * 2020-09-03 2021-09-14 广州视源电子科技股份有限公司 时钟同步方法、装置及存储介质
CN112731049B (zh) * 2020-12-08 2023-07-07 深圳供电局有限公司 时钟同步异常监测方法、装置及计算机可读存储介质
CN113687686B (zh) * 2021-08-10 2024-05-14 北京小米移动软件有限公司 时钟同步方法、装置、电子设备和存储介质
CN115347972B (zh) * 2022-10-18 2024-01-16 杭州聆巡科技有限公司 声呐时钟同步方法、装置、设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101860952A (zh) * 2009-04-09 2010-10-13 中兴通讯股份有限公司 一种基于ip网络的无线基站时钟校正方法及系统
CN104581923A (zh) * 2013-10-25 2015-04-29 上海无线通信研究中心 通过无线链路传输精确时间信息的方法
US9912465B2 (en) * 2011-07-20 2018-03-06 Aviat U.S., Inc. Systems and methods of clock synchronization between devices on a network
CN110266420A (zh) * 2019-04-29 2019-09-20 北京达佳互联信息技术有限公司 时钟同步方法、时钟同步装置和计算机可读存储介质
CN112040539A (zh) * 2020-09-03 2020-12-04 广州视源电子科技股份有限公司 时钟同步方法、装置及存储介质

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102577194B (zh) * 2009-08-25 2014-11-12 Sem技术公司 使分布式网络内时钟同步的系统和方法
CN102098155B (zh) * 2011-03-18 2013-11-13 北京国智恒电力管理科技有限公司 基于ptp协议实现亚微秒级同步精度的方法
CN102769505B (zh) * 2012-07-19 2015-09-16 中兴通讯股份有限公司 一种实现时钟同步的方法及装置
CN104135359B (zh) * 2014-07-22 2017-12-12 南京磐能电力科技股份有限公司 一种硬实时级联式多节点同步采样和数据传输方法
CN104158647A (zh) * 2014-08-26 2014-11-19 太原理工大学 一种无线传感网络时钟同步方法
EP3089386A1 (en) * 2015-04-29 2016-11-02 ABB Technology AG Method, system and device for clock synchronization over time-varying and lossy networks
CN105049309B (zh) * 2015-07-29 2018-03-09 上海新时达电气股份有限公司 基于powerlink实时以太网的伺服驱动器同步方法
CN105024777B (zh) * 2015-07-29 2017-10-24 上海新时达电气股份有限公司 基于EtherCAT实时以太网的伺服驱动器同步方法
EP3507925B1 (en) * 2016-08-30 2024-03-13 Finisar Corporation Bi-directional transceiver with time synchronization

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101860952A (zh) * 2009-04-09 2010-10-13 中兴通讯股份有限公司 一种基于ip网络的无线基站时钟校正方法及系统
US9912465B2 (en) * 2011-07-20 2018-03-06 Aviat U.S., Inc. Systems and methods of clock synchronization between devices on a network
CN104581923A (zh) * 2013-10-25 2015-04-29 上海无线通信研究中心 通过无线链路传输精确时间信息的方法
CN110266420A (zh) * 2019-04-29 2019-09-20 北京达佳互联信息技术有限公司 时钟同步方法、时钟同步装置和计算机可读存储介质
CN112040539A (zh) * 2020-09-03 2020-12-04 广州视源电子科技股份有限公司 时钟同步方法、装置及存储介质

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115225244A (zh) * 2022-07-14 2022-10-21 广东电网有限责任公司 低压集抄电能表时钟对时方法、装置、主设备及介质
CN115225244B (zh) * 2022-07-14 2023-08-18 广东电网有限责任公司 低压集抄电能表时钟对时方法、装置、主设备及介质
CN116436555A (zh) * 2023-06-09 2023-07-14 新华三技术有限公司 一种时间同步方法、装置及分布式网络设备
CN116436555B (zh) * 2023-06-09 2023-08-18 新华三技术有限公司 一种时间同步方法、装置及分布式网络设备

Also Published As

Publication number Publication date
CN112040539A (zh) 2020-12-04
CN112040539B (zh) 2021-09-14

Similar Documents

Publication Publication Date Title
WO2022048075A1 (zh) 时钟同步方法、装置及存储介质
CN102027699B (zh) 用于数字声音再现系统中的扬声器的数据传送方法和系统
US9548869B2 (en) Systems and methods for implementing multicasting using personal area network “pan” wireless technology
US10129839B2 (en) Techniques for synchronizing timing of wireless streaming transmissions to multiple sink devices
US8520870B2 (en) Transmission device and transmission method
WO2016201888A1 (zh) 多媒体文件播放方法及装置
US20160006526A1 (en) Systems and methods of network clock comparison
WO2022094835A1 (zh) 音频同步播放方法、装置、设备及存储介质
WO2020211535A1 (zh) 网络延迟控制方法、装置、电子设备及存储介质
WO2016127699A1 (zh) 一种实现参考信号调整的方法及装置
CN112130616B (zh) 时钟同步方法、装置及存储介质
US20230360663A1 (en) Voice Recognition With Timing Information For Noise Cancellation
CN105163391A (zh) 数据传输方法、终端及无线访问接入点
US20190342659A1 (en) Correcting for latency of an audio chain
WO2022057472A1 (zh) 时钟同步方法及相关装置
US20230251373A1 (en) Ranging method, apparatus and system, intelligent device and computer-readable storage medium
CN105099644A (zh) 半双工通信方法及相关装置
TW202027448A (zh) 利用對準標記實現時間戳記的奈秒精度及其形成方法
CN113687686B (zh) 时钟同步方法、装置、电子设备和存储介质
WO2019160750A1 (en) Audio streams over peripheral component interconnect (pci) express (pcie) links
US20080298399A1 (en) Methods for Synchronizing the Transmission and the Reception of a Media Stream Over a Network
WO2022155879A1 (zh) 时间同步方法及相关设备
US11445457B2 (en) Content distribution system
US20220094726A1 (en) Content distribution system
WO2024007974A1 (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: 20952316

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20952316

Country of ref document: EP

Kind code of ref document: A1