Clock Synchronization Method, Receiver, Transmitter, and Clock Synchronization System
20180248721 ยท 2018-08-30
Inventors
Cpc classification
H04J3/0632
ELECTRICITY
International classification
Abstract
A clock synchronization method, a receiver, a transmitter, and a clock synchronization system, where the method includes obtaining a common reference clock signal, determining B.sub.t according to the common reference clock signal and Mr.sub.d(t1), where
determining that Mr.sub.d(t1) is a target Mr.sub.d when C.sub.t obtained by means of calculation according to Mr.sub.d(t1) is less than or equal to a threshold, where C.sub.t=B.sub.tA.sub.t, A.sub.t is included in a residual time stamp (RTS) packet received by a receiver last time from the transmitter, and
performing frequency division on the common reference clock signal using the target Mr.sub.d as a frequency dividing coefficient to obtain a first clock signal, and performing frequency multiplication processing on the first clock signal to obtain a service clock signal. Hence, random phase offset may be avoided.
Claims
1. A clock synchronization method, comprising: obtaining, by a receiver, a common reference clock signal, a frequency of the common reference clock signal comprising f.sub.n; determining, by the receiver, B.sub.t according to the common reference clock signal and Mr.sub.d(t1), the
2. The method of claim 1, wherein determining the B.sub.t comprises: performing, by the receiver, the frequency division on the common reference clock signal using the Mr.sub.d(t1) as the frequency dividing coefficient to obtain a second clock signal, a frequency of the second clock signal comprising
3. The method of claim 1, wherein the Mr.sub.d(t1) comprises Mr.sub.d(t2) when the t is greater than one.
4. The method of claim 2, further comprising: generating, by the receiver, a new Mr.sub.d according to a value of the Mr.sub.d(t1) when the C.sub.t obtained by calculation according to the Mr.sub.d(t1) is greater than the threshold; recalculating, by the receiver, the B.sub.t according to the new Mr.sub.d and the common reference clock signal; recalculating, by the receiver, the C.sub.t according to the B.sub.t obtained after the recalculation; and determining, by the receiver, that the new Mr.sub.d comprises the target Mr.sub.d when the C.sub.t obtained after the recalculation is less than or equal to the threshold.
5. The method of claim 4, wherein generating the new Mr.sub.d comprises: performing, by the receiver, transition detection filtering on the C.sub.t to obtain a smooth C.sub.t; performing, by the receiver, loop filtering on the smooth C.sub.t to obtain an adjustment factor (M.sub.rd) used for adjusting the value of the Mr.sub.d(t1); and adjusting, by the receiver, the value of the Mr.sub.d(t1) according to the M.sub.rd to obtain the new Mr.sub.d.
6. The method of claim 1, wherein the RTS packet further comprises the P and the M.sub.nom.
7. The method of claim 1, wherein the RTS packet further comprises the P.
8. The method of claim 1, wherein the RTS packet further comprises the M.sub.nom.
9. A clock synchronization method, comprising: obtaining, by a transmitter, a service clock signal, a frequency of the service clock signal comprising f.sub.s; dividing, by the transmitter, the f.sub.s by a factor N; determining, by the transmitter, a residual time stamp (RTS) period (T) of sending an RTS packet by the transmitter, the
10. The method of claim 9, wherein calculating the A.sub.t comprises: performing, by the transmitter, summation on the M.sub.d(n) using a formula A.sub.t=A.sub.t1+M.sub.d(t); storing, by the transmitter, the A.sub.t obtained after the summation into the counter in the transmitter; and obtaining, by the transmitter, a new
11. A receiver, comprising: a memory comprising instructions; and a processor coupled to the memory, the instructions causing the processor to be configured to: obtain a common reference clock signal, a frequency of the common reference clock signal comprising f.sub.n; determine B.sub.t according to Mr.sub.d(t1) and the common reference clock signal, the
12. The receiver of claim 11, wherein the instructions further cause the processor to be configured to: perform the frequency division on the common reference clock signal using the Mr.sub.d(t1) as the frequency dividing coefficient to obtain a second clock signal, a frequency of the second clock signal comprising
13. The receiver of claim 11, wherein the Mr.sub.d(t1) comprises Mr.sub.d(t2) when the t is greater than one.
14. The receiver according to claim 12, wherein the instructions further cause the processor to be configured to: generate a new Mr.sub.d according to a value of the Mr.sub.d(t1) when the C.sub.t obtained by calculation according to the Mr.sub.d(t1) is greater than the threshold; recalculate the B.sub.t according to the new Mr.sub.d and the common reference clock signal; recalculate the C.sub.t according to the B.sub.t obtained after the recalculation, until the C.sub.t obtained after the recalculation is less than or equal to the threshold; and determine that the new Mr.sub.d comprises the target Mr.sub.d when the C.sub.t obtained after the recalculation is less than or equal to the threshold.
15. The receiver of claim 14, wherein the instructions further cause the processor to be configured to: perform transition detection filtering on the C.sub.t to obtain a smooth C.sub.t; perform loop filtering on the smooth C.sub.t to obtain an adjustment factor (M.sub.rd) used for adjusting the value of the Mr.sub.d(t1); and adjust the value of the Mr.sub.d(t1) according to the M.sub.rd to obtain the new Mr.sub.d.
16. The receiver of claim 11, wherein the RTS packet further comprises the P and the M.sub.nom.
17. The receiver of claim 11, wherein the RTS packet further comprises the P.
18. The receiver of claim 11, wherein the RTS packet further comprises the M.sub.nom.
19. A transmitter, comprising: a memory comprising instructions; and a processor coupled to the memory, the instructions causing the processor to be configured to: obtain a service clock signal, a frequency of the service clock signal comprising f.sub.s; divide the f.sub.s by a factor N; determine a residual time stamp (RTS) period (T) of sending an RTS packet by the transmitter,
20. The transmitter of claim 19, wherein the instructions further cause the processor to be configured to: perform summation on the M.sub.d(n) using a formula A.sub.t=A.sub.t1+M.sub.d(t); store the A.sub.t obtained after the summation into the counter in the transmitter; and obtain a new
Description
BRIEF DESCRIPTION OF DRAWINGS
[0024] To describe the technical solutions in the embodiments of the present disclosure more clearly, the following briefly introduces the accompanying drawings required for describing the embodiments. The accompanying drawings in the following description merely show some embodiments of the present disclosure, and a person of ordinary skill in the art can derive other drawings from these accompanying drawings without creative efforts.
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
DESCRIPTION OF EMBODIMENTS
[0036] The following clearly describes the technical solutions in the embodiments of the present disclosure with reference to the accompanying drawings in the embodiments of the present disclosure. The described embodiments are merely some but not all of the embodiments of the present disclosure.
[0037] Before specific descriptions of the embodiments, related parameter information involved in the application file is first described briefly.
[0038] A transmitter involved in this application refers to a transmitter defined in ITU-T 1.363.1. A receiver involved in this application refers to a receiver defined in ITU-T 1.363.1.
[0039] A phase offset in this application refers to an offset of a phase, relative to a phase of a service clock signal of a transmitter, of a service clock signal generated by a receiver.
[0040] Dividing a frequency of a service clock signal by a factor N that is mentioned in this application refers to performing frequency division on the frequency of the service clock signal, where a frequency dividing coefficient is N.
[0041] A packet loss mentioned in this application indicates that a receiver does not receive an RTS packet sent by a transmitter.
[0042] For an RTS period mentioned in this application, reference may be made to ITU-T 1.363.1.
[0043] An n.sup.th RTS period mentioned in this application refers to the n.sup.th RTS period with specified chronological order, where n is a positive integer. For example, the second RTS period refers to an RTS period that is adjacent to the first RTS period and that is after the first RTS period. The third RTS period refers to an RTS period that is adjacent to the second RTS period and that is after the first RTS period and the second RTS period.
[0044] For example, a quantity, determined by a transmitter within the n.sup.th RTS period, of rising edges of a common reference clock signal refers to a quantity, within the n.sup.th RTS period, of detected rising edges of the common reference clock signal.
[0045] f.sub.s is a frequency of a service clock signal, f.sub.n is a frequency of a common reference clock signal, for example, 155.52 megahertz (MHz), N is a quantity of periods, included in an RTS period T, of the service clock signal, T is an RTS period, or may be referred to as a sending period of an RTS, where
in M(M.sub.min, M.sub.nom, M.sub.max), M.sub.min, M.sub.nom, and M.sub.max are respectively a minimum quantity, a reference quantity, and a maximum quantity of clock periods of the common reference clock signal within the RTS period T, and meet the following condition
M.sub.q(n) is a maximum integer less than or equal to M, M.sub.d(n) is a difference between M.sub.q(n) and M.sub.nom, that is, M.sub.d(n)=M.sub.q(n)M.sub.nom, A.sub.t is a result obtained after a transmitter performs, using the RTS period T as a period, summation on M.sub.d(n) resulting from each calculation, and a bit width of a counter in the transmitter is a P-bit width, Mr.sub.d(n) is frequency offset information of a receiver and meets
where Mr.sub.d(0) is an initial value, B.sub.t is a result obtained after the receiver performs, using a clock signal period
[0046] An embodiment provides a clock synchronization method. Referring to
[0047] Step 101: A transmitter obtains a service clock signal, where a frequency of the service clock signal is f.sub.s, and divides the frequency f.sub.s by a factor N to obtain
[0048] N is a quantity of clock periods of the service clock signal within an RTS period T (the RTS period T may be alternatively referred to as a sending period T of an RTS), where N is greater than 1, and the RTS period is
[0049] Step 102: The transmitter determines a quantity M.sub.q(n) of clock periods of a common reference clock signal within an RTS period T.
[0050] Further, M.sub.q(n) is a quantity, determined by the transmitter within an n.sup.th RTS period T, of rising edges of the common reference clock signal.
[0051] Step 103: The transmitter obtains information M.sub.d(n) about a frequency offset between the frequency f.sub.s of the service clock signal and a frequency f.sub.n of the common reference clock signal by means of calculation using a formula M.sub.d(n)=M.sub.q(n)M.sub.nom, and sends the frequency offset information M.sub.d(n) to a receiver.
[0052] M.sub.nom is a reference quantity of clock periods of the common reference clock signal within the RTS period T, and the value has a specified association relationship with N and can be set according to actual needs.
[0053] Step 104: The receiver receives M.sub.d(n), and obtains M.sub.q(n) by means of calculation using a formula M.sub.q(n)=M.sub.d(n)+M.sub.nom,
[0054] Step 105: The receiver performs frequency division on the frequency f.sub.n of the common reference clock signal using M.sub.q(n) obtained by means of calculation as a frequency dividing coefficient, to obtain a new clock signal frequency
[0055] Further,
In this case,
[0056] Step 106: The receiver performs processing on the new clock signal frequency
[0057] In the foregoing clock synchronization method, when a packet loss occurs due to network congestion, an RTS packet sent by a transmitter may be lost. A receiver cannot obtain a frequency offset M.sub.d(n) in the lost RTS packet to obtain M.sub.q(n) by means of calculation. In this case, the receiver generates a service clock signal this time using a frequency offset M.sub.q(n1) calculated last time. However, the frequency offset M.sub.q(n1) calculated last time may be inconsistent with M.sub.q(n) actually required this time. M.sub.q(n) actually required this time refers to M.sub.q(n) obtained by means of calculation according to the frequency offset information M.sub.d(n) in the lost RTS packet. When the frequency offset M.sub.q(n1) calculated last time is inconsistent with M.sub.q(n) actually required this time, if the frequency offset M.sub.q(n1) calculated last time is used to generate the service clock signal this time, an offset occurs on a phase of the newly generated service clock signal relative to a phase of a service clock signal of the transmitter. As shown in
[0058] Based on the foregoing, an embodiment of the present disclosure provides a clock synchronization method such that when a receiver does not receive an RTS packet sent by a transmitter in the foregoing technology, an offset of a phase, relative to a phase of a service clock signal of a transmitter side, of a service clock signal generated by the receiver decreases. Further, an embodiment of the present disclosure provides a clock synchronization system, including a receiver and a transmitter.
[0059] For ease of description, a method executed by the transmitter is described first. As shown in
[0060] Step 301: The transmitter obtains a service clock signal, where a frequency of the service clock signal is f.sub.s.
[0061] Step 302: The transmitter divides the frequency f.sub.s of the service clock signal by a factor N, and determines an RTS period T of sending an RTS packet by the transmitter.
[0062] The transmitter divides the frequency f.sub.s of the service clock signal by a factor N, to obtain f.sub.sN, where
The RTS period is
and therefore,
where N is greater than 1.
[0063] Preferably, a value of N is a corresponding value when a value of f.sub.sN is equal to 810.sup.3 hertz (Hz) during calculation of the value
[0064] Step 303: The transmitter determines a quantity M.sub.q(n) of clock periods of a common reference clock signal within an n.sup.th RTS period T, where a frequency of the common reference clock signal is f.sub.n.
[0065] Further, within the n.sup.th RTS period T, each time the transmitter detects a rising edge of the common reference clock signal, counting is performed such that counting is performed on the frequency f.sub.n of the received common reference clock signal. Further, the transmitter stores a result that is obtained by means of counting within the n.sup.th RTS period T, and obtains the quantity M.sub.q(n) of clock periods of the common reference clock signal within the n.sup.th RTS period T.
[0066] When a rising edge of the frequency f.sub.n of the common reference clock signal is detected once, counting may be performed on the frequency f.sub.n of the common reference clock signal once using a P-bit counter, that is, 1 is added to a numeric value of the P-bit counter.
[0067] Step 304: The transmitter calculates information M.sub.d(n) about a frequency offset between the frequency f.sub.s of the service clock signal and the frequency f.sub.n of the common reference clock signal using a formula M.sub.d(n)=M.sub.q(n)M.sub.nom and M.sub.q(n).
[0068] M.sub.nom is a reference quantity, obtained by the transmitter, of clock periods of the common reference clock signal within the n.sup.th RTS period T, where n is a positive integer.
[0069] Step 305: The transmitter calculates A.sub.t using a formula
and according to the frequency offset information M.sub.d(n).
[0070] P is a bit width of the counter in the transmitter and may be in a binary, decimal, or hexadecimal system, the counter in the transmitter is configured to record a quantity, in the transmitter within the n.sup.th RTS period T, of rising edges of the common reference clock signal.
[0071] Further, the transmitter performs summation on the frequency offset information M.sub.d(n) using a formula A.sub.t=A.sub.t1+M.sub.d(t), and stores A.sub.t obtained after the summation to the P-bit counter. For example, when the transmitter obtains frequency offset information M.sub.d1 for the first time, A.sub.t=M.sub.d1. When the transmitter obtains frequency offset information M.sub.d2 for the second time, A.sub.2=A.sub.1+M.sub.d2, that is, A.sub.2=M.sub.d1+M.sub.d2. When the transmitter obtains frequency offset information M.sub.d3 for the third time, A.sub.3=A.sub.2+M.sub.d3, that is, A.sub.3=M.sub.d1+M.sub.d2+M.sub.d3. By analogy, when the transmitter obtains frequency offset information M.sub.dn for the n.sup.th time, A.sub.t=M.sub.d1+M.sub.d2+ . . . +M.sub.dn.
[0072] When A.sub.t>2.sup.p, numeric-value turnover is performed on A.sub.t using a formula
[0073] Step 306: The transmitter sends the RTS packet to a receiver, where the RTS packet includes A.sub.t.
[0074] In the foregoing technical solutions, instead of sending frequency offset information M.sub.d(n) that is separately obtained by means of calculation within each RTS period T to a receiver, a transmitter performs summation and turnover processing on multiple pieces of frequency offset information M.sub.d(n) that are respectively corresponding to multiple consecutive RTS periods T to obtain A.sub.t, and then sends A.sub.t to the receiver. A.sub.t is related to the sum of the multiple pieces of frequency offset information M.sub.d(n) generated by the transmitter.
[0075] As described above, an embodiment of the present disclosure provides a clock synchronization system, including a receiver and a transmitter.
[0076] Step 401: The receiver obtains a common reference clock signal, where a frequency of the common reference clock signal is f.sub.n.
[0077] Step 402: The receiver determines B.sub.t according to the common reference clock signal and Mr.sub.d(t1).
is a positive integer, and Mr.sub.d(0) is an initial value preset by the receiver side.
[0078] During specific implementation of the foregoing technical solutions, the receiver presets the initial Mr.sub.d(0), the numeric value of Mr.sub.d(0) is a numeric value first assigned by a user according to experience. When calculating B.sub.1 for the first time, the receiver first uses Mr.sub.d(0) to perform calculation. Subsequently, when calculating B.sub.2 for the second time, the receiver performs calculation according to Mr.sub.d(1) that is determined by means of calculation for the first time. When calculating B.sub.3 for the third time, the receiver performs calculation according to Mr.sub.d(2) that is determined by means of calculation for the second time. By analogy, when calculating B.sub.t for the t.sup.th time, the receiver performs calculation according to Mr.sub.d(t1) that is determined by means of calculation for the (t1).sup.th time.
[0079] The following further details the method, in step 402, of obtaining B.sub.t by means of calculation, where the method includes the following steps.
[0080] Step 4021: The receiver performs frequency division on the common reference clock signal using Mr.sub.d(t1) as a frequency dividing coefficient to obtain a second clock signal, where a frequency of the second clock signal is
[0081] In this embodiment, when calculating B.sub.1 for the first time, the receiver first uses Mr.sub.d(0) as a frequency dividing coefficient to perform frequency division on the frequency f.sub.n of the common reference clock signal. In this case, a frequency
[0082] When calculating B.sub.2 for the second time, the receiver uses Mr.sub.d(1), which is determined after B.sub.1 is calculated for the first time, as a frequency dividing coefficient to perform frequency division on the frequency f.sub.n of the common reference clock signal. In this case, a frequency
[0083] By analogy, when calculating B.sub.t for the t.sup.th time, the receiver uses Mr.sub.d(t1), which is determined after B.sub.t1 is calculated for the (t1).sup.th time, as a frequency dividing coefficient to perform frequency division on the frequency f.sub.n of the common reference clock signal. In this case, a frequency
[0084] Step 4022: When the period
[0085] Further, when the first period
[0086] When the second period
[0087] When the third period
[0088] By analogy, when the t.sup.th period
[0089] Step 4023: When B.sub.t>2.sup.p, perform numeric-value turnover on B.sub.t using a formula
[0090] Therefore, after B.sub.t is obtained by means of calculation, B.sub.t is subsequently used for calculating C.sub.t in step 403.
[0091] It should be noted herein that the transmitter and the receiver use a same numeric-value turnover processing manner, and therefore, the transmitter and the receiver need to construct a same turnover counter (a P-bit counter). Therefore, the transmitter and the receiver may preset a same P-bit counter, or the transmitter may send a bit width of a P-bit counter in the transmitter to the receiver. The bit width of the P-bit counter in the transmitter may be carried in an RTS packet. More further, bit width information of the P-bit counter in the transmitter may be stored in a fixed location in an RTS frame header, as shown in
[0092] Step 403: The receiver calculates C.sub.t using a formula C.sub.t=B.sub.tA.sub.t.
[0093] A.sub.t is included in an RTS packet that is sent by the transmitter and that is received by the receiver last time, and
M.sub.d(n) is frequency offset information, and M.sub.d(n)=M.sub.q(n)M.sub.nom, M.sub.q(n) is a quantity, determined by the transmitter within an n.sup.th RTS period, of rising edges of the common reference clock signal, M.sub.nom is a reference quantity, obtained by the transmitter, of clock periods of the common reference clock signal within the n.sup.th RTS period, P is a bit width of a counter in the transmitter, the counter in the transmitter is configured to record the quantity, in the transmitter within the n.sup.th RTS period, of rising edges of the common reference clock signal, and n is a positive integer.
[0094] In this embodiment, after obtaining B.sub.t by means of calculation, the receiver obtains A.sub.t from the RTS packet that is sent by the transmitter and that is receiver by the receiver last time, and then calculates C.sub.t using a formula C.sub.t=B.sub.tA.sub.t.
[0095] Step 404: When C.sub.t obtained by means of calculation according to Mr.sub.d(t1) is less than or equal to a threshold, the receiver determines that Mr.sub.d(t1) is a target Mr.sub.d.
[0096] A.sub.t is the foregoing A.sub.t that is generated and sent by the transmitter, and
M.sub.d(n) is the frequency offset information, and M.sub.d(n)=M.sub.q(n)M.sub.nom, M.sub.q(n) is the quantity, determined by the transmitter within the n.sup.th RTS period, of rising edges of the common reference clock signal, M.sub.nom is the reference quantity, obtained by the transmitter, of clock periods of the common reference clock signal within the n.sup.th RTS period, P is the bit width of the counter in the transmitter, the counter in the transmitter is configured to record the quantity, in the transmitter within the n.sup.th RTS period, of rising edges of the common reference clock signal, and n is a positive integer.
[0097] Preferably, the threshold may be 0 or an extremely small numeric value.
[0098] Further, when C.sub.1 that is obtained for the first time by means of calculation using Mr.sub.d(0) as a frequency diving coefficient is less than or equal to the threshold, the receiver determines that Mr.sub.d(0) is the target Mr.sub.d. In this case, Mr.sub.d(1) is marked as the target Mr.sub.d, that is, Mr.sub.d(1)=Mr.sub.d(0).
[0099] When C.sub.2 that is obtained for the second time by means of calculation using Mr.sub.d(1) as a frequency diving coefficient is less than or equal to the threshold, the receiver determines that Mr.sub.d(1) is the target Mr.sub.d. In this case, Mr.sub.d(2) is marked as the target Mr.sub.d, that is, Mr.sub.d(2)=Mr.sub.d(1).
[0100] By analogy, when C.sub.t that is obtained for the t.sup.th time by means of calculation using Mr.sub.d(t1) as a frequency diving coefficient is less than or equal to the threshold, the receiver determines that Mr.sub.d(t1) is the target Mr.sub.d. In this case, Mr.sub.d(t) is marked as the target Mr.sub.d, that is, Mr.sub.d(t)=Mr.sub.d(t1).
[0101] In this embodiment, when C.sub.t that is obtained by the receiver by means of calculation according to Mr.sub.d(t1) is less than or equal to the threshold, it indicates that Mr.sub.d(t1) currently obtained is the target Mr.sub.d needed by the receiver. In this case, step 405 continues to be performed.
[0102] Step 405: The receiver performs frequency division on the common reference clock signal using the target Mr.sub.d as a frequency dividing coefficient, to obtain a first clock signal, where a frequency of the first clock signal is
[0103] In this embodiment, after performing frequency division on the frequency f.sub.n of the common reference clock signal using the target Mr.sub.d as the frequency dividing coefficient, the receiver obtains the frequency
[0104] It should be specially noted that values of M.sub.nom that are set respectively by the transmitter and the receiver need to be consistent. Therefore, values of M.sub.nom may be respectively preset in the transmitter and the receiver. Alternatively, the transmitter may add M.sub.nom to the RTS packet, and then send the RTS packet to the receiver.
[0105] Step 406: The receiver performs frequency multiplication processing on the first clock signal to obtain a service clock signal, where a frequency of the service clock signal is
[0106] Further, the receiver may perform processing on the first clock signal using a clock frequency multiplier, where N is a multiplication factor of the clock frequency multiplier.
[0107] In this embodiment of the present disclosure, the receiver performs controlled frequency division on the frequency f.sub.n of the common reference clock signal using the target Mr.sub.d, to obtain the frequency
[0108] Therefore, in the foregoing embodiment, a transmitter calculates A.sub.t using a formula
and according to information M.sub.d(n), obtained by means of calculation, about a frequency offset between a frequency f.sub.s of a service clock signal and a frequency f.sub.n of a common reference clock signal, and sends an RTS packet that includes A.sub.t to a receiver. Therefore, the transmitter implements summation processing on multiple pieces of generated frequency offset information M.sub.d(n), that is, the transmitter implements integral processing on M.sub.d(n).
[0109] In terms of the receiver, after obtaining the common reference clock signal, the receiver determines B.sub.t according to the common reference clock signal and Mr.sub.d(t1), where
When determining that C.sub.t obtained by means of calculation according to Mr.sub.d(t1) is less than or equal to a threshold, the receiver determines that Mr.sub.d(t1) is a target Mr.sub.d, where C.sub.t=B.sub.tA.sub.t. Further, the receiver performs frequency division on the common reference clock signal using the target Mr.sub.d as a frequency dividing coefficient to obtain a first clock signal, where a frequency of the first clock signal is
[0110] Therefore, in the foregoing technical solutions, it is assumed that the transmitter sends three RTS packets to the receiver in three consecutive RTS periods T. Further, the transmitter sends a packet 1 within an RTS period T.sub.1, sends a packet 2 within an RTS period T.sub.2, and sends a packet 3 within an RTS period T.sub.3. The RTS period T.sub.1 is the last RTS period of the RTS period T.sub.2, and the RTS period T.sub.2 is the last RTS period of the RTS period T.sub.3. The receiver receives the packets 1 and 3, but does not receive the packet 2. When the receiver does not receive the RTS packet 2 sent by the transmitter, the receiver calculates the frequency
[0111] In addition, based on the foregoing embodiment, preferably, the method may further include the following step (not shown).
[0112] Step 407: The receiver generates a new Mr.sub.d according to a value of Mr.sub.d(t1) when C.sub.t obtained by means of calculation according to Mr.sub.d(t1) is greater than the threshold, recalculates B.sub.t according to the new Mr.sub.d and the common reference clock signal, recalculates C.sub.t according to B.sub.t that is obtained after the recalculation, and when C.sub.t that is obtained after the recalculation is less than or equal to the threshold, determines that the new Mr.sub.d is the target Mr.sub.d.
[0113] In this embodiment, when C.sub.t is greater than the threshold, it indicates that an offset exists in Mr.sub.d(t1) selected currently. Adjustment needs to be performed on Mr.sub.d(t1), to obtain the new Mr.sub.d. A specific adjustment method includes the following steps.
[0114] Step 4071: Perform transition detection filtering on C.sub.t to obtain a smooth C.sub.t.
[0115] Step 4072: Perform loop filtering on the smooth C.sub.t to obtain an adjustment factor M.sub.rd used for adjusting the value of Mr.sub.d(t1).
[0116] Step 4073: Adjust the value of Mr.sub.d(t1) according to the adjustment factor M.sub.rd to obtain the new Mr.sub.d.
[0117] After the new Mr.sub.d is obtained, step 4021 is performed. The receiver performs frequency division on the frequency f.sub.n of the common reference clock signal using the new Mr.sub.d as a frequency dividing coefficient, to obtain a new second clock signal. Further, step 4021 to step 406 continue to be performed using a frequency and a period that are of the new second clock signal, and the new Mr.sub.d.
[0118] In this embodiment, when a new B.sub.t that is obtained by means of calculation according to the new Mr.sub.d meets a condition that C.sub.t is less than or equal to the threshold, it is determined that the new Mr.sub.d is the target Mr.sub.d.
[0119] An embodiment further provides a receiver. The receiver may be configured to execute the method shown in
t is a positive integer, and Mr.sub.d(0) is an initial value, a first determining unit 30 configured to when C.sub.t obtained by means of calculation according to Mr.sub.d(t1) is less than or equal to a threshold, determine that Mr.sub.d(t1) is a target Mr.sub.d, where C.sub.t=B.sub.tA.sub.t, At is included in an RTS packet that is sent by a transmitter and that is received by the receiver last time, and
M.sub.d(n) is frequency offset information, and M.sub.d(n)=M.sub.q(n)M.sub.nom m, M.sub.q(n) is a quantity, determined by the transmitter within an nth RTS period, of rising edges of the common reference clock signal, M.sub.nom is a reference quantity, obtained by the transmitter, of clock periods of the common reference clock signal within the n.sup.th RTS period, P is a bit width of a counter in the transmitter, the counter in the transmitter is configured to record the quantity, in the transmitter within the n.sup.th RTS period, of rising edges of the common reference clock signal, and n is a positive integer, a first frequency-division processing unit 40 configured to perform frequency division on the common reference clock signal using the target Mr.sub.d as a frequency dividing coefficient, to obtain a first clock signal, where a frequency of the first clock signal is
[0120] The first calculation unit 20 includes a frequency-division processing subunit (not shown) configured to perform frequency division on the common reference clock signal using Mr.sub.d(t1) as a frequency dividing coefficient, to obtain a second clock signal, where a frequency of the second clock signal is
[0121] When t is greater than 1, Mr.sub.d(t1) is Mr.sub.d(t2).
[0122] Preferably, the receiver further includes an adjustment unit (not shown) configured to generate a new Mr.sub.d according to a value of Mr.sub.d(t1) when C.sub.t obtained by means of calculation according to Mr.sub.d(t1) is greater than the threshold, in this case, the first calculation unit 20 is further configured to recalculate B.sub.t according to the new Mr.sub.d and the common reference clock signal, and recalculate C.sub.t according to B.sub.t that is obtained after the recalculation, until C.sub.t that is obtained after the recalculation is less than or equal to the threshold, and the first determining unit 30 is further configured to when C.sub.t that is obtained after the recalculation by the first calculation unit 20 is less than or equal to the threshold, determine that the new Mr.sub.d is the target Mr.sub.d.
[0123] Further, the adjustment unit includes a transition detection subunit (not shown) configured to perform transition detection filtering on C.sub.t, to obtain a smooth C.sub.t, a loop filtering subunit (not shown) configured to perform loop filtering on the smooth C.sub.t obtained by the transition detection subunit to obtain an adjustment factor M.sub.rd used for adjusting the value of Mr.sub.d(t1), and an adjustment subunit (not shown) configured to adjust the value of Mr.sub.d(t1) according to the adjustment factor M.sub.rd obtained by the loop filtering subunit to obtain the new Mr.sub.d.
[0124] In the foregoing solutions, optionally, the RTS packet further includes the bit width P of the counter in the transmitter, and/or the reference quantity M.sub.nom, in the transmitter, of the common reference clock signal within the n.sup.th RTS period.
[0125] A transmitter is further provided, which may be configured to execute the method shown in
and N is greater than 1, a second determining unit 300 configured to determine a quantity M.sub.q(n) of clock periods of a common reference clock signal within an nth RTS period T determined by the second frequency-division processing unit 200, where a frequency of the common reference clock signal is f.sub.n, a second calculation unit 400 configured to calculate information M.sub.d(n) about a frequency offset between the frequency f.sub.s of the service clock signal and the frequency f.sub.n of the common reference clock signal using a formula M.sub.d(n)=M.sub.q(n)M.sub.nom and M.sub.q(n) that is determined by the second determining unit 300, where M.sub.nom is a reference quantity, obtained by the transmitter, of clock periods of the common reference clock signal within the nth RTS period T, and n is a positive integer, a third calculation unit 500 configured to calculate A.sub.t using a formula
and according to the frequency offset information M.sub.d(n) calculated by the second calculation unit 400, where P is a bit width of a counter in the transmitter, and the counter in the transmitter is configured to record a quantity, in the transmitter within the nth RTS period, of rising edges of the common reference clock signal, and a sending unit 600 configured to send the RTS packet to a receiver, where the RTS packet includes A.sub.t calculated by the third calculation unit 500.
[0126] The third calculation unit 500 further includes a second integral-calculation subunit (not shown) configured to perform summation on the frequency offset information M.sub.d(n) using a formula A.sub.t=A.sub.t1+M.sub.d(t), and store A.sub.t obtained after the summation into the counter in the transmitter, and a second numeric-value turnover subunit (not shown) configured to when A.sub.t obtained by the second integral-calculation subunit is greater than 2.sup.p, obtain a new
[0127] In addition, a clock synchronization system is further provided, including the foregoing transmitter and receiver.
[0128] Moreover, an embodiment of the present disclosure further provides a receiver. The receiver may be a host server, personal computer PC, portable computer or terminal that has a computing capability, or the like. Specific implementation of the receiver is not limited in a specific embodiment.
[0129]
[0130] The processor 1010, the communications interface 1020, and the memory 1030 implement communication with each other using the bus 1040.
[0131] The processor 1010 is configured to execute a program 1032.
[0132] Further, the program 1032 may include program code, where the program code includes a computer operation instruction.
[0133] The processor 1010 may be a central processing unit (CPU), may be an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement this embodiment of the present disclosure.
[0134] The memory 1030 is configured to store the program 1032. The memory 1030 may include a high-speed random access memory (RAM), and may further include a non-volatile memory, such as at least one disk memory. The program 1032 may further include obtaining a common reference clock signal, where a frequency of the common reference clock signal is f.sub.n, determining B.sub.t according to the common reference clock signal and Mr.sub.d(t1), where
t is a positive integer, and Mr.sub.d(0) is an initial value, when C.sub.t obtained by means of calculation according to Mr.sub.d(t1) is less than or equal to a threshold, determining that Mr.sub.d(t1) is a target Mr.sub.d, where C=B.sub.tA.sub.t, At is included in an RTS packet that is sent by a transmitter and that is received by the receiver last time, and
M.sub.d(n) is frequency offset information, and M.sub.d(n)=M.sub.q(n)M.sub.nom, M.sub.q(n) is a quantity, determined by the transmitter within an n.sup.th RTS period, of rising edges of the common reference clock signal, M.sub.nom is a reference quantity, obtained by the transmitter, of clock periods of the common reference clock signal within the n.sup.th RTS period, P is a bit width of a counter in the transmitter, the counter in the transmitter is configured to record the quantity, in the transmitter within the n.sup.th RTS period, of rising edges of the common reference clock signal, and n is a positive integer, performing frequency division on the common reference clock signal using the target Mr.sub.d as a frequency dividing coefficient, to obtain a first clock signal, where a frequency of the first clock signal is
[0135] Optionally, the determining B.sub.t according to the common reference clock signal and Mr.sub.d(t1) further includes performing frequency division on the common reference clock signal using Mr.sub.d(t1) as a frequency dividing coefficient, to obtain a second clock signal, where a frequency of the second clock signal is
[0136] Optionally, when t is greater than 1, Mr.sub.d(t1) is Mr.sub.d(t2).
[0137] Optionally, the program 1032 further includes generating a new Mr.sub.d according to a value of Mr.sub.d(t1) when C.sub.t obtained by means of calculation according to Mr.sub.d(t1) is greater than the threshold, recalculating B.sub.t according to the new Mr.sub.d and the common reference clock signal, recalculating C.sub.t according to B.sub.t that is obtained after the recalculation, and when C.sub.t that is obtained after the recalculation is less than or equal to the threshold, determining that the new Mr.sub.d is the target Mr.sub.d.
[0138] Optionally, the generating a new Mr.sub.d according to a value of Mr.sub.d(t1) when C.sub.t obtained by means of calculation according to Mr.sub.d(t1) is greater than the threshold includes performing transition detection filtering on C.sub.t, to obtain a smooth C.sub.t, performing loop filtering on the smooth C.sub.t, to obtain an adjustment factor M.sub.rd used for adjusting the value of Mr.sub.d(t1), and adjusting the value of Mr.sub.d(t1) according to the adjustment factor M.sub.rd, to obtain the new Mr.sub.d.
[0139] Optionally, the RTS packet further includes the bit width P of the counter in the transmitter, and/or the reference quantity M.sub.nom, in the transmitter, of the common reference clock signal within the n.sup.th RTS period.
[0140] Moreover, a transmitter is further provided. The transmitter may be a host server, personal computer PC, or portable computer or terminal that has a computing capability. Specific implementation of the transmitter is not limited in a specific embodiment.
[0141]
[0142] The processor 1110, the communications interface 1120, and the memory 1130 implement communication with each other using the bus 1140.
[0143] The processor 1110 is configured to execute a program 1132.
[0144] Further, the program 1132 may include program code, where the program code includes a computer operation instruction.
[0145] The processor 1110 may be a CPU, may be an ASIC, or one or more integrated circuits configured to implement this embodiment of the present disclosure.
[0146] The memory 1130 is configured to store the program 1132. The memory 1130 may include a high-speed RAM, and may further include a non-volatile memory, such as at least one disk memory. The program 1132 may further include obtaining a service clock signal, where a frequency of the service clock signal is f.sub.s, dividing the frequency f.sub.s of the service clock signal by a factor N, and determining an RTS period T of sending an RTS packet by the transmitter, where
and N is greater than 1, determining a quantity M.sub.q(n) of clock periods of a common reference clock signal within an n.sup.th RTS period T, where a frequency of the common reference clock signal is f.sub.n, calculating information M.sub.d(n) about a frequency offset between the frequency f.sub.s of the service clock signal and the frequency f.sub.n of the common reference clock signal using a formula M.sub.d(n)=M.sub.q(n)M.sub.nom and M.sub.q(n), where M.sub.nom is a reference quantity, obtained by the transmitter, of clock periods of the common reference clock signal within the n.sup.th RTS period T, and n is a positive integer, calculating A.sub.t using a formula
and according to the frequency offset information M.sub.d(n), where P is a bit width of a counter in the transmitter, and the counter in the transmitter is configured to record a quantity, in the transmitter within the n.sup.th RTS period, of rising edges of the common reference clock signal, and sending the RTS packet to a receiver, where the RTS packet includes A.sub.t.
[0147] Optionally, calculating A.sub.t using a formula
and according to the frequency offset information M.sub.d(t) includes performing summation on the frequency offset information M.sub.d(n) using a formula A.sub.t=A.sub.t1+M.sub.d(t), and storing A.sub.t obtained after the summation into the counter in the transmitter, and when A.sub.t>2.sup.p, obtaining a new
[0148] It should be noted that the embodiments in this application are all described in a progressive manner. Each embodiment focuses on a difference from other embodiments. For same or similar parts in the embodiments, reference may be made to these embodiments. The apparatus disclosed in the embodiments corresponds to the method disclosed in the embodiments, and therefore is described briefly. For related parts, reference may be made to descriptions in the method embodiments.
[0149] A person skilled in the art may further be aware that, in combination with the examples described in the embodiments disclosed in this specification, units and algorithm steps may be implemented by electronic hardware or a combination of computer software and electronic hardware. To clearly describe the interchangeability between the hardware and the software, the foregoing has generally described compositions and steps of each example according to functions. Whether the functions are performed by hardware or a combination of software and hardware depends on particular applications and design constraint conditions of the technical solutions. A person skilled in the art may use different methods to implement the described functions for each particular application, but it should not be considered that the implementation goes beyond the scope of the present disclosure.
[0150] Steps of methods or algorithms described in the embodiments disclosed in this specification may be implemented using a processor directly, or a combination of a software module and a processor. The software module may be disposed in a RAM, a ROM, an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a compact disc ROM (CD-ROM), or any other form of memory well-known in the art. The processor is coupled with a memory that includes the software module. The processor may execute the method in the embodiments by accessing the software module in the memory.