Clock calibration method and clock calibration circuit
Through the clock calibration circuit, the clock cycle ratio of the communication device is calculated and adjusted, the frequent calibration problems caused by environmental changes are solved, the power consumption of the communication device is reduced and the communication quality is improved.
Patent Information
- Application Number
- CN202310539016.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-15
- Publication Date
- 2024-11-15
AI Technical Summary
When existing communication devices change dynamically (such as temperature changes), clock calibration conditions are too strict or loose, resulting in a decrease in communication quality or system power consumption, and power consumption increases due to frequent calibration.
The clock cycle ratio of slow clocks and fast clocks is calculated through the clock calibration circuit, the number of accumulated slow clock cycles and the time offset is adjusted using the compensation value to reduce the number of repeated calibrations due to environmental changes and reduce power consumption.
It effectively reduces the number of repeated calibrations due to dynamic changes in the environment, reduces the power consumption of the communication device, and improves communication quality and system efficiency.
Smart Images

Figure CN118972015A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to a clock calibration of a communication device, and in particular to a clock calibration method and a clock calibration circuit. Background Art
[0002] Power efficiency is one of the most important performance indicators of communication devices in recent years. In order to reduce device power consumption, modern communication devices will enter power saving mode when the system is idle, and switch the clocks of the circuits and timers required for the operation of digital circuits to slow clocks with low frequencies (e.g., 32768 Hz) to save energy. On the other hand, the clock used by communication devices when executing system and communication functions is a fast clock with a high frequency (e.g., 26 MHz).
[0003] The fast clock and the slow clock can be generated by different oscillator circuits. Since the oscillator circuit of the slow clock is easily affected by temperature, in today's communication devices, temperature changes are often used as a judgment condition for whether to perform slow clock calibration. However, if the conditions for triggering calibration are too strict (for example, the temperature difference is greater than 15 degrees Celsius), the communication quality may be degraded due to the error of the slow clock frequency. On the contrary, if the conditions for triggering calibration are too loose (for example, the temperature difference is greater than 3 degrees Celsius), the system power consumption may increase due to too frequent calibration. Summary of the invention
[0004] The present application provides a clock calibration method, which is applicable to a communication device including a clock calibration circuit, wherein the clock calibration circuit is used to receive a fast clock and a slow clock, and the clock calibration method includes: in response to the communication device being enabled and entering an active mode, calculating the clock cycle ratio of the slow clock and the fast clock by the clock calibration circuit; in response to the communication device operating in a power saving mode during a power saving period, calculating the number of at least one rising edge of the slow clock received by the clock calibration circuit during the power saving period as the accumulated number of slow clock cycles; in response to the communication device entering an active mode from the power saving mode, calculating the difference between the internal time of the communication device and the reference time of another communication device as a time offset; and in the active mode, adjusting the clock cycle ratio by the clock calibration circuit using a compensation value, wherein the compensation value is associated with the clock cycle ratio, the accumulated number of slow clock cycles and the time offset.
[0005] The present application also provides a clock calibration method, which is applicable to a communication device including a clock calibration circuit, wherein the clock calibration circuit is used to receive a fast clock and a slow clock, and the clock calibration method includes: in response to the communication device being enabled and entering an active mode, calculating the clock cycle ratio of the slow clock and the fast clock by the clock calibration circuit; in response to the communication device operating in a power saving mode during a power saving period, calculating the number of at least one rising edge of the slow clock received by the clock calibration circuit during the power saving period as the accumulated number of slow clock cycles; in response to the communication device entering an active mode from the power saving mode, calculating the difference between the internal time of the communication device and the reference time of another communication device as a time offset; and in the active mode, adjusting the clock cycle ratio by the clock calibration circuit using a compensation value, wherein the compensation value is associated with the product of the following multiple parameters: the square of the clock cycle ratio, the time offset, and the inverse of the accumulated number of slow clock cycles.
[0006] The present application provides a clock calibration circuit, which is used to be set in a communication device and used to receive a fast clock and a slow clock, and includes a fast clock counter, a slow clock counter, a control circuit and a storage circuit. The fast clock counter is used to receive the fast clock and calculate the number of at least one rising edge of the fast clock. The slow clock counter is used to receive the slow clock and calculate the number of at least one rising edge of the slow clock. The control circuit is coupled to the fast clock counter and the slow clock counter, and is used to: in response to the communication device being enabled and entering an active mode, calculate the clock cycle ratio of the slow clock and the fast clock; in response to the communication device operating in a power saving mode during a power saving period, calculate the number of at least one rising edge of the slow clock received by the communication device in the power saving period as the accumulated number of slow clock cycles; in response to the communication device entering an active mode from the power saving mode, calculate the difference between the internal time of the communication device and the reference time of another communication device as a time offset; and in the active mode, use a compensation value to adjust the clock cycle ratio, wherein the compensation value is associated with the clock cycle ratio, the accumulated number of slow clock cycles and the time offset. The storage circuit is coupled to the fast clock counter, the slow clock counter and the control circuit, and is used to store the number of at least one rising edge of the fast clock, the number of at least one rising edge of the slow clock, the clock cycle ratio and the length of the power saving period.
[0007] The clock calibration method and clock calibration circuit disclosed in the present document can reduce the number of times a communication device repeats calibration due to dynamic environmental changes (such as temperature) in the same mode, thereby reducing the power consumption of the communication device. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] In order to make the above and other purposes, features, advantages and embodiments of the present application more obvious and understandable, the attached drawings are described as follows: Figure 1 is a simplified functional block diagram of a clock calibration circuit according to some embodiments; Figure 2 A timing diagram for clock calibration for a clock calibration circuit according to some embodiments; and Figure 3 is a flow chart of a clock calibration method according to some embodiments. DETAILED DESCRIPTION
[0009] The embodiments of the present application will be described below with reference to the accompanying drawings. In the accompanying drawings, the same reference numerals represent the same or similar components or method flows.
[0010] In this application, when a component is referred to as "linked" or "coupled", it may refer to "electrically connected" or "electrically coupled". "Linked" or "coupled" may also be used to indicate the coordinated operation or interaction between two or more components. Unless the text specifically limits the articles, "a", "an" and "the" may refer to a single or multiple components. It will be further understood that the words "comprise", "include", "have" and similar words used herein indicate the features, regions, integers, steps, operations, components and / or assemblies described therein, but do not exclude the described or additional one or more other features, regions, integers, steps, operations, components, assemblies and / or combinations thereof.
[0011] Figure 1 1 is a simplified functional block diagram of a clock calibration circuit 100 according to some embodiments. The clock calibration circuit 100 is used to receive a fast clock FCLK and a slow clock SCLK, and the clock calibration circuit 100 includes a fast clock counter 110, a slow clock counter 120, a control circuit 130, and a storage circuit 140. In some embodiments, the clock calibration circuit 100 is disposed in a communication device (not shown).
[0012] The fast clock counter 110 is coupled to the control circuit 130 and the storage circuit 140, and is used to receive the fast clock FCLK from an external circuit (not shown, such as a phase-locked loop of the communication device) according to the control of the control circuit 130, and count the number of rising edges of the fast clock FCLK within a given period. The slow clock counter 120 is coupled to the control circuit 130 and the storage circuit 140, and is used to receive the slow clock SCLK from another external circuit (not shown, such as another phase-locked loop or crystal oscillator of the communication device) according to the control of the control circuit 130, and count the number of rising edges of the slow clock SCLK within a given period.
[0013] The control circuit 130 is coupled to the fast clock counter 110, the slow clock counter 120 and the storage circuit 140, and is used to control the fast clock counter 110, the slow clock counter 120 and the storage circuit 140 according to the operating status of the communication device, so as to calculate or adjust the period ratio of the fast clock FCLK and the slow clock SCLK (hereinafter referred to as "clock period ratio CLKR").
[0014] The storage circuit 140 is coupled to the fast clock counter 110, the slow clock counter 120 and the control circuit 130, and is used to store the number of rising edges of the fast clock FCLK calculated by the fast clock counter 110, the number of rising edges of the slow clock SCLK calculated by the slow clock counter 120, and the clock cycle ratio CLKR calculated by the control circuit 130. In some embodiments, the storage circuit 140 can be implemented by a circuit register.
[0015] Please refer to Figure 1 and Figure 2 , Figure 2 The timing diagram of clock calibration performed by the clock calibration circuit 100 according to some embodiments. The control circuit 130 is used to determine whether the communication device is operating in the active mode ACM or the power saving mode PSM. In some embodiments, the communication device operates according to the fast clock FCLK and the slow clock SCLK in the active mode ACM and the power saving mode PSM respectively. The communication device can maintain time synchronization with another communication device (such as a base station of CDMA, 4G, 5G or NB-IoT) based on the fast clock FCLK in the active mode ACM for communication. The communication device is used to calculate how many fast clock FCLK cycles the time length of the power saving mode PSM is equivalent to using the clock cycle ratio CLKR to ensure that when switching from the power saving mode PSM to the active mode ACM (that is, switching from working according to the slow clock SCLK to working according to the fast clock FCLK), it can still maintain time synchronization with the other communication device. The method of controlling the fast clock counter 110, the slow clock counter 120, the storage circuit 140 and calculating the clock cycle ratio CLKR by the control circuit 130 will be described in detail in the subsequent paragraphs.
[0016] Please refer to Figure 2 and Figure 3 .exist Figure 2 In the embodiment of the present invention, time T0-T5 represents time points when the clock calibration circuit 100 performs different operations. Figure 3 FIG. 3 is a flow chart of a clock calibration method 300 according to some embodiments. In some embodiments, the clock calibration method 300 includes steps 310 - 380 .
[0017] At time T0, the communication device is enabled (i.e. powered on) and enters the active mode ACM. To perform system activities (e.g., setting parameters required for operation) or communication activities (e.g., time synchronization with another communication device), and step 310 will be executed. In step 310, the control circuit 130 calibrates the slow clock SCLK. In operation, the communication device can calibrate the fast clock FCLK by achieving time synchronization with another communication device (e.g., a base station of CDMA, 4G, 5G, or NB-IoT), and then further calibrate the slow clock SCLK based on the fast clock FCLK. For example, the aforementioned time synchronization means that the communication device will operate with a clock of the same clock accuracy as another communication device (e.g., a base station of CDMA, 4G, 5G, or NB-IoT) to which it is connected.
[0018] At time T1, the communication device completes the system activities and communication activities performed when it is turned on, and step 320 is executed. In step 320, the control circuit 130 calculates the clock cycle ratio CLKR based on the number of rising edges of the fast clock FCLK and the number of rising edges of the slow clock SCLK, and then calibrates the slow clock SCLK. In the operation of calculating the clock cycle ratio CLKR, the control circuit 130 first sets a measurement time (for example, the time of n slow clock SCLK cycles, where n is a positive integer), and the fast clock counter 110 and the slow clock counter 120 respectively transmit the number of rising edges of the fast clock FCLK and the number of rising edges of the slow clock SCLK received during the measurement time to the storage circuit 140, and the control circuit 130 then calculates the clock cycle ratio CLKR according to formula (1). Formula (1) is as follows:
[0019]
[0020] Among them, T fast Represents the period of the fast clock FCLK, T slow Represents the period of the slow clock SCLK, N fast Represents the number of rising edges of the fast clock FCLK within the measurement time, and N slow Represents the number of rising edges of the slow clock SCLK within the measurement time.
[0021] Next, in step 330 , the control circuit 130 determines whether the slow clock SCLK has been calibrated successfully to determine whether the next step to be executed is step 340 or step 310 .
[0022] by Figure 2For example, time T2 is the time point when the control circuit 130 completes the calibration of the slow clock SCLK (i.e., the time point when step 330 is executed). Since time T2 is later than time T1, it means that the system of the communication device has been stable (for example, all parameters required for operation have been set, or time synchronization with another communication device has been completed) before the calibration of the slow clock SCLK is completed. Therefore, in step 330, the control circuit 130 will determine that the calibration of the slow clock SCLK is successful, and step 340 will be executed.
[0023] On the contrary, in some embodiments not shown, when the control circuit 130 is calculating the clock cycle ratio CLKR, if a large time or clock synchronization adjustment occurs in the communication device, and time T2 is earlier than time T1, the control circuit 130 will determine that at the time point of time T2, the fast clock FCLK has not yet reached the standard used as a reference for calibration, so the clock cycle ratio CLKR calculated in step 320 may be inaccurate, and the clock calibration is determined to have failed, and step 310 will be executed again.
[0024] After time T2, when the communication device does not receive a command during a standby time of the active mode ACM (e.g., from time T2 to time T3), step 340 is executed. In step 340, the communication device switches from the active mode ACM to the power saving mode PSM, and remains in the power saving mode PSM during a power saving period, and operates according to the slow clock SCLK to reduce the energy consumption of the communication device. In some embodiments, the length of the power saving period can be pre-stored in the storage circuit 140.
[0025] In some embodiments, the fast clock FCLK of the communication device is synchronized with another communication device (e.g., a base station of CDMA, 4G, 5G, or NB-IoT) to which it is connected and has a higher accuracy. Therefore, the control circuit 130 can calculate the length of the power saving period as M according to the communication parameters (e.g., paging cycle) and system settings of the communication device. fast The cycle of the fast clock FCLK, where M fast Is a positive integer.
[0026] However, since the communication device operates according to the slow clock SCLK in the power saving mode PSM and switches to operate according to the fast clock FCLK before the power saving mode PSM ends, the control circuit 130 can convert the length of the power saving period into a combination of the period of the slow clock SCLK and the period of the fast clock FCLK according to formula (2), wherein the period of the fast clock FCLK represents the length of time that the communication device operates according to the fast clock FCLK before the power saving mode PSM ends. Formula (2) is as follows:
[0027]
[0028] Among them, the operator is the floor sign.
[0029] In addition, in some embodiments, the control circuit 130 calculates the total number of rising edges of the slow clock SCLK when the communication device is running in the power saving mode PSM (hereinafter referred to as "accumulated slow clock cycle number ACLK"). In some embodiments, the initial value of the accumulated slow clock cycle number ACLK is 0 when the communication device is powered on.
[0030] It should be noted that step 340 will not be executed earlier than step 330, that is, time T3 will not be earlier than time T2. In other words, after the control circuit 130 completes the calculation of the clock cycle ratio CLKR Previously, the communication device would not switch from the active mode ACM to the power saving mode PSM.
[0031] When the power saving period (ie, time T3 to time T4) ends, step 350 is executed, the communication device switches from the power saving mode PSM to the active mode ACM, and the control circuit 130 evaluates whether to compensate the clock cycle ratio CLKR.
[0032] In operation, when a communication device switches from the power saving mode PSM to the active mode ACM, it will synchronize time with another communication device (such as a base station of CDMA, 4G, 5G or NB-IoT) to obtain a reference time (such as a timestamp) from the other communication device. In addition, since the period of the slow clock SCLK may change with the external environment (such as temperature), after the power saving mode PSM ends, an error may occur between the time inside the communication device and the aforementioned reference time (hereinafter referred to as "time offset Δ n In step 350, the communication device calculates the time offset Δ n , for example, calculating the time error between its own timestamp and the timestamp from another communication device. n The purpose will be explained in the following paragraphs.
[0033] Please refer to step 350 again. After completing the time synchronization, the communication device will also decide to compensate, partially compensate, or not compensate the clock cycle ratio CLKR according to the reliability of the time synchronization (such as the signal-to-noise ratio). For example, when the signal-to-noise ratio of the communication signal is less than a signal-to-noise ratio threshold, it means that the result of the time synchronization is unreliable (that is, the reference time may be wrong, or the time offset Δ n may be wrong), so the communication device may not compensate for the clock cycle ratio CLKR, and step 355 will be executed.
[0034] In step 355, the communication device determines whether it needs to enter the power saving mode PSM. When the communication device determines that it does not need to enter the power saving mode PSM, step 355 will be repeatedly executed, and the communication device will continue to operate in the active mode ACM. On the other hand, when the communication device determines that it needs to enter the power saving mode PSM, step 340 will be executed again.
[0035] In other words, when the process of the clock calibration method 300 proceeds from step 350 to step 355 and returns to step 340, it means that the communication device re-enters the power saving mode PSM from the active mode ACM without compensating the clock cycle ratio CLKR, so the control circuit 130 continues to accumulate the accumulated slow clock cycle number ACLK.
[0036] On the other hand, when the signal-to-noise ratio of the communication signal is greater than or equal to the signal-to-noise ratio threshold, it means that the time synchronization result is partially reliable or completely reliable (that is, the reference time is substantially correct, or the time offset Δ n is substantially correct), so step 360 will be executed and the communication device will compensate for the clock cycle ratio CLKR.
[0037] In step 360, the control circuit 130 determines the time offset Δ obtained in step 350 based on the time offset Δ n , calculate the compensation value according to formula (3). Formula (3) is as follows:
[0038]
[0039] In some embodiments, the compensation weight is a value ranging from 0 to 1. In other embodiments, the control circuit 130 may determine the value of the compensation weight according to the signal-to-noise ratio, for example, setting the compensation weight to be positively correlated with the signal-to-noise ratio.
[0040] In some embodiments, the compensation weight may be omitted from equation (3).
[0041] It should be noted that if the communication device system experiences a connection failure or the system clock time is out-of-sync, the time offset Δ n Therefore, in step 370, the control circuit 130 compares the compensation value with the compensation threshold to determine whether the compensation value is reasonable.
[0042] In some embodiments, the storage circuit 140 stores a plurality of compensation thresholds, which correspond to a plurality of operating temperatures of the clock calibration circuit 100. The control circuit 130 may select a corresponding compensation threshold according to the current operating temperature of the clock calibration circuit 100.
[0043] If the compensation value is greater than the compensation threshold, it means that the compensation value is beyond the reasonable range, and the control circuit 130 will not use the compensation threshold to calibrate the clock cycle ratio CLKR. At this time, step 310 can be performed again, so that the communication device recalibrates the slow clock SCLK based on the time synchronization with another communication device, and performs subsequent steps.
[0044] On the other hand, if the compensation value is less than or equal to the compensation threshold, it means that the compensation value is reasonable, and step 380 will be executed. In step 380, the control circuit 130 obtains an updated clock cycle ratio CLKR by subtracting the compensation value from the clock cycle ratio CLKR, and resets the accumulated slow clock cycle number ACLK to zero. In some embodiments, after step 380 is completed (i.e., time T5), step 355 will be executed.
[0045] It should be noted that the number and order of steps 310 to 380 in the clock calibration method 300 of the present application are only examples and are not intended to limit the present disclosure, and the number and order of other steps are within the scope of the present application. In some embodiments, steps 320 and 330 may be performed simultaneously.
[0046] The clock calibration method 300 and the clock calibration circuit 100 of the present disclosure can calibrate the clock cycle ratio CLKR only when switching from the power saving mode PSM to the active mode ACM, so as to avoid repeated calibration in the same working mode (for example, repeated calibration due to frequent changes in working temperature), so as to reduce the power consumption of the communication device. Through the calibrated clock cycle ratio CLKR, the communication device can accurately calculate the power saving period through formula (2) to improve the communication quality with another communication device (for example, a base station of CDMA, 4G, 5G or NB-IoT).
[0047] The above are only preferred embodiments of the present application. Without departing from the scope or spirit of the present application, the structure of the present application can be modified and equivalently changed in various ways. In summary, all modifications and equivalent changes made to the present application within the scope of the following claims are within the scope of the present application.
Explanation of symbols
Claims
1. A clock calibration method, applicable to a communication device comprising a clock calibration circuit, wherein the clock calibration circuit is used to receive a fast clock and a slow clock, characterized in that: The frequency calibration method includes: In response to the communication device being enabled and entering an active mode, calculating a clock cycle ratio of the slow clock and the fast clock by the clock calibration circuit; In response to the communication device operating in a power saving mode during a power saving period, calculating the number of at least one rising edge of the slow clock received by the clock calibration circuit during the power saving period as a cumulative number of slow clock cycles; In response to the communication device entering the active mode from the power saving mode, calculating a difference between an internal time of the communication device and a reference time of another communication device as a time offset; as well as In the active mode, the clock cycle ratio is adjusted by the clock calibration circuit using a compensation value, wherein the compensation value is related to the clock cycle ratio, the accumulated slow clock cycle number, and the time offset.
2. The clock calibration method according to claim 1, wherein: Adjusting the clock cycle ratio by using the compensation value by the clock calibration circuit includes: determining a compensation weight, wherein the compensation weight is positively correlated to a signal-to-noise ratio of the communication device; and The clock cycle ratio is adjusted using a product of the compensation value and the compensation weight.
3. The clock calibration method according to claim 2, characterized in that: The compensation weight is between 0 and 1.
4. The clock calibration method according to claim 1, wherein: The clock calibration circuit compares the compensation value with a compensation threshold to determine whether to adjust the clock cycle ratio.
5. The clock calibration method according to claim 1, wherein: Before the clock calibration circuit finishes calculating the clock cycle ratio, the communication device will not switch to the power saving mode.
6. The clock calibration method according to claim 1, wherein: Adjusting the clock cycle ratio by using the compensation value by the clock calibration circuit includes: Subtract the compensation value from the clock cycle ratio, The compensation value is negatively correlated to the square of the clock cycle ratio, negatively correlated to the time offset, and positively correlated to the accumulated slow clock cycle number.
7. The clock calibration method according to claim 1, wherein: Also includes: In response to adjusting the clock cycle ratio by the clock calibration circuit using the compensation value, the accumulated number of slow clock cycles is reset to zero by the clock calibration circuit.
8. A clock calibration method, applicable to a communication device comprising a clock calibration circuit, wherein the clock calibration circuit is used to receive a fast clock and a slow clock, characterized in that: The clock calibration method includes: In response to the communication device being enabled and entering an active mode, calculating a clock cycle ratio of the slow clock and the fast clock by the clock calibration circuit; In response to the communication device operating in a power saving mode during a power saving period, calculating the number of at least one rising edge of the slow clock received by the clock calibration circuit during the power saving period as a cumulative number of slow clock cycles; In response to the communication device entering the active mode from the power saving mode, calculating a difference between an internal time of the communication device and a reference time of another communication device as a time offset; as well as In the active mode, the clock cycle ratio is adjusted by the clock calibration circuit using a compensation value, wherein the compensation value is related to the product of the square of the clock cycle ratio, the time offset, and the inverse of the number of accumulated slow clock cycles.
9. The clock calibration method according to claim 8, characterized in that: Adjusting the clock cycle ratio by using the compensation value by the clock calibration circuit includes: determining a compensation weight, wherein the compensation weight is positively correlated to a signal-to-noise ratio of the communication device; and The clock cycle ratio is adjusted using a product of the compensation value and the compensation weight.
10. A clock calibration circuit, arranged in a communication device and used for receiving a fast clock and a slow clock, characterized in that: Include: a fast clock counter, configured to receive the fast clock and count the number of at least one rising edge of the fast clock; a slow clock counter for receiving the slow clock and counting the number of at least one rising edge of the slow clock; A control circuit is coupled to the fast clock counter and the slow clock counter, and is used for: In response to the communication device being enabled and entering an active mode, calculating a clock cycle ratio of the slow clock and the fast clock; In response to the communication device operating in a power saving mode during a power saving period, calculating the number of the at least one rising edge of the slow clock received by the communication device during the power saving period as a cumulative number of slow clock cycles; In response to the communication device entering the active mode from the power saving mode, calculating a difference between an internal time of the communication device and a reference time of another communication device as a time offset; as well as In the active mode, adjusting the clock cycle ratio using a compensation value, wherein the compensation value is related to the clock cycle ratio, the accumulated number of slow clock cycles, and the time offset; as well as A storage circuit is coupled to the fast clock counter, the slow clock counter and the control circuit, and is used to store the number of the at least one rising edge of the fast clock, the number of the at least one rising edge of the slow clock, the clock cycle ratio and the length of the power saving period.
