CN116909351B - Clock chip internal clock precision correction method - Google Patents

Clock chip internal clock precision correction method Download PDF

Info

Publication number
CN116909351B
CN116909351B CN202311182667.3A CN202311182667A CN116909351B CN 116909351 B CN116909351 B CN 116909351B CN 202311182667 A CN202311182667 A CN 202311182667A CN 116909351 B CN116909351 B CN 116909351B
Authority
CN
China
Prior art keywords
time period
correction coefficient
clock
period
fluctuation range
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311182667.3A
Other languages
Chinese (zh)
Other versions
CN116909351A (en
Inventor
蔡钦洪
蔡荣洪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Yangxing Technology Co ltd
Original Assignee
Shenzhen Yangxing Technology Co ltd
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 Shenzhen Yangxing Technology Co ltd filed Critical Shenzhen Yangxing Technology Co ltd
Priority to CN202311182667.3A priority Critical patent/CN116909351B/en
Publication of CN116909351A publication Critical patent/CN116909351A/en
Application granted granted Critical
Publication of CN116909351B publication Critical patent/CN116909351B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/04Generating or distributing clock signals or signals derived directly therefrom
    • G06F1/08Clock generators with changeable or programmable clock frequency
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/04Generating or distributing clock signals or signals derived directly therefrom
    • G06F1/14Time supervision arrangements, e.g. real time clock
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention relates to the technical field of data processing, in particular to a clock chip internal clock precision correction method, which comprises the following steps: acquiring a clock error index of each time period of a clock in a clock chip; determining a correction coefficient of each time period according to the clock error index and the standard clock frequency; determining an ideal fluctuation range of the correction coefficient; according to the difference between the correction coefficient of each time period to be adjusted and the ideal fluctuation range after the historical time period, adjusting the ideal fluctuation range, and updating the correction coefficient of the time period to be adjusted; updating the time period according to the difference between the updated correction coefficient of the time period and the correction coefficient of the time period in the historical time period; and correcting the internal clock of the clock chip according to the updated time period and the updated correction coefficient of the time period to be adjusted. The invention ensures that the global clock correction accuracy of the clock chip is higher.

Description

Clock chip internal clock precision correction method
Technical Field
The invention relates to the technical field of data processing, in particular to a clock chip internal clock precision correction method.
Background
The clock chip is a very important electronic component, and has wide application in various electronic devices such as computers, mobile phones, televisions and the like. A clock chip is an electronic component capable of generating a stable, accurate clock signal. It is typically composed of a crystal oscillator, a frequency divider and a counter. The output signal of the clock chip can be used to synchronize the operation of various digital circuits, ensuring that they can operate at the correct speed and sequence, and therefore, the accuracy requirements of the clock chip are high and the clock chip needs to be corrected in time when errors exist in the clock chip.
In the prior art, clock frequency is corrected through a correction register, firstly, the numerical value of the correction register is read, a correction amount is calculated according to the numerical value of the correction register and a preset correction rule, the clock frequency is adjusted according to the correction amount, and then the correction value cached in the correction register is updated. The conventional correction register is based on a one-time correction operation, i.e., the correction amount is acquired from only the clock error in one correction period, and the accuracy for global clock correction is low.
Disclosure of Invention
In order to solve the technical problem that the accuracy of the existing correction method for global clock correction is low, the invention aims to provide a clock chip internal clock accuracy correction method, and the adopted technical scheme is as follows:
acquiring the difference between the time length of a clock in a clock chip in each preset time period and the time length of a standard clock in the time period, and calculating a clock error index in the clock chip in each time period; determining a correction coefficient of each time period according to the clock error index and the standard clock frequency;
according to the correction coefficient of each time period in the historical time period, determining an ideal fluctuation range of the correction coefficient; according to the difference between the correction coefficient of each time period to be adjusted and the ideal fluctuation range after the historical time period, adjusting the ideal fluctuation range, and updating the correction coefficient of the time period to be adjusted;
updating the time period according to the difference between the updated correction coefficient of the time period and the correction coefficient of the time period in the historical time period; and correcting the internal clock of the clock chip according to the updated time period and the updated correction coefficient of the time period to be adjusted.
Preferably, the determining the correction coefficient of each time period according to the clock error index and the standard clock frequency specifically includes:
and for any time period, taking the sum value of the clock error index in the clock chip and the standard clock frequency in the time period as a correction coefficient of the time period.
Preferably, the determining the ideal fluctuation range of the correction coefficient according to the correction coefficient of each time period in the historical time period specifically includes:
among the correction coefficients for all the time periods of the history period, the smallest correction coefficient larger than the characteristic correction coefficient is set as the upper limit value of the ideal fluctuation range, and the largest correction coefficient smaller than the characteristic correction coefficient is set as the lower limit value of the ideal fluctuation range.
Preferably, the method for obtaining the characteristic correction coefficient specifically includes: and taking the average value of the correction coefficients of all time periods in the historical time period as a characteristic correction coefficient.
Preferably, the adjusting the ideal fluctuation range according to the difference between the correction coefficient of each time period to be adjusted and the ideal fluctuation range after the historical time period, and updating the correction coefficient of the time period to be adjusted specifically includes:
recording a first time period to be adjusted after the historical time period as a first adjustment period;
when the value of the correction coefficient of the first adjustment period is in the ideal fluctuation range, the updated correction coefficient of the first adjustment period is equal to the value of the correction coefficient before updating, whether the correction coefficient of the first adjustment period is larger than the characteristic adjustment coefficient is judged, the ideal fluctuation range is adjusted, and if yes, the correction coefficient of the first adjustment period is used as the upper limit value of the ideal fluctuation range after the first adjustment; if not, taking the correction coefficient of the first adjustment period as the lower limit value of the ideal fluctuation range after the first adjustment;
when the value of the correction coefficient of the first adjustment period is not in the ideal fluctuation range, the ideal fluctuation range is not adjusted, and the updated correction coefficient of the first adjustment period is determined according to the correction coefficient of the first adjustment period, the ideal fluctuation range and the characteristic correction coefficient.
Preferably, when the correction coefficient of each time period to be adjusted after the historical time period is updated according to the same method, if the ideal fluctuation range is subjected to the adjustment operation, the correction coefficient of each time period to be adjusted is updated by using the adjusted ideal fluctuation range.
Preferably, the determining the updated correction coefficient of the first adjustment period according to the correction coefficient of the first adjustment period, the ideal fluctuation range and the characteristic correction coefficient specifically includes:
wherein,indicating the updated correction coefficient of the first adjustment period, n 1 A correction coefficient representing a first adjustment period, N r1 Represents the upper limit value of the ideal fluctuation range, N l1 Represents the lower limit value of the ideal fluctuation range, +.>Representing the characteristic correction coefficients.
Preferably, the updating the time period according to the difference between the updated correction coefficient of the time period and the correction coefficient of the time period in the historical time period specifically includes:
when correction coefficients of a plurality of time periods to be adjusted are continuously preset after the historical time period and are in a corresponding ideal fluctuation range, marking a first time period to be adjusted after the continuous preset time periods to be a target time period, calculating a difference value between the correction coefficients after updating of the target time period and the characteristic correction coefficients to be a first difference value; calculating the difference between the correction coefficient of the last time period adjacent to the target time period and the characteristic correction coefficient to be recorded as a second difference;
when the first difference value is smaller than or equal to the second difference value, taking the absolute value of the ratio of the second difference value to the first difference value as an update coefficient, and taking the product of the update coefficient and the time period as an updated time period corresponding to the target time period; when the first difference is greater than the second difference, the target time period is not updated.
Preferably, the obtaining the difference between the time length of the clock in the clock chip in each preset time period and the time length of the standard clock in the time period, and calculating the clock error index in the clock chip in each time period specifically includes:
calculating the difference value between the time length of the clock in the clock chip in each preset time period and the time length of the standard clock in the time period, and taking the ratio of the difference value to the time period length as the clock error index in the clock chip in each time period.
Preferably, the correcting the clock chip internal clock according to the updated time period and the updated correction coefficient of the time period to be adjusted specifically includes:
taking the product of the updated correction coefficient of the time period to be adjusted and the clock frequency in the clock chip as the corrected clock frequency; and (3) starting from the adjusted first time period, re-acquiring the time period in the historical time period, and monitoring and correcting the clock accuracy in the clock chip.
The embodiment of the invention has at least the following beneficial effects:
the invention firstly obtains the clock error index of each time period by comparing the time length of the clock in the clock chip in each preset time period with the time length of the standard clock in the time period, and reflects the error occurrence condition of the clock in the clock chip by using the clock error index, so that the correction coefficient of each time period can be determined according to the clock error index and the standard clock frequency, namely, the correction coefficient for correcting the clock chip in each time period can be primarily determined by using the error occurrence condition and the standard clock frequency. Then, by analyzing the correction coefficient of each time period in the history time period, an ideal fluctuation range of the correction coefficient is determined, that is, a value range in which the correction coefficient is more normal is reflected by using the ideal fluctuation range. Further, the difference condition between the correction coefficient of the time period to be adjusted after the historical time period and the ideal fluctuation range is analyzed, the ideal fluctuation range is adjusted, the correction coefficient is updated at the same time, and the correction coefficient possibly having errors is corrected through error analysis, so that the accuracy of correcting the clock chip by using the correction coefficient is higher. And finally, by adjusting the correction period, the accuracy of the clock chip is improved, meanwhile, the calculation time loss possibly caused by multiple corrections is reduced, and the internal clock of the clock chip is corrected by using the updated time period and the updated correction coefficient of the time period to be adjusted, so that the accuracy of the global clock correction of the clock chip is higher.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions and advantages of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are only some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for correcting clock accuracy in a clock chip according to the present invention.
Detailed Description
In order to further describe the technical means and effects adopted by the invention to achieve the preset aim, the following detailed description is given below of a clock chip internal clock accuracy correction method according to the invention, which is specific to the implementation, structure, characteristics and effects thereof, with reference to the accompanying drawings and the preferred embodiment. In the following description, different "one embodiment" or "another embodiment" means that the embodiments are not necessarily the same. Furthermore, the particular features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
The following specifically describes a specific scheme of the clock accuracy correction method in the clock chip provided by the invention with reference to the accompanying drawings.
Examples:
the main purpose of the invention is as follows: according to the invention, the clock frequency historical error in the clock chip within a larger time range within the historical time is calculated to generate the speed representation value, so that the clock correction coefficient is calculated, the error analysis of the clock operation process is more accurate based on the historical data, the clock frequency of each correction period is sequentially adjusted based on the clock historical operation data, the correction period in the dynamic adjustment of the video frequency is as large as possible after a certain condition is met, the consumption caused by frequently calculating the correction coefficient is reduced, and the clock accuracy is ensured.
The specific scene aimed by the invention is as follows: the method comprises the steps of obtaining a current standard time value through external connection of a standard time source, comparing an internal time value of a current clock chip with the standard time value, calculating an error between the internal time value of the clock chip and the standard time value, obtaining a corresponding correction coefficient, and storing the correction coefficient in a correction register in the clock chip; in the subsequent use process, the clock frequency in the clock chip is dynamically adjusted according to the correction coefficient stored in the correction register so as to realize high-precision time measurement.
Referring to fig. 1, a flowchart of a method for correcting clock accuracy in a clock chip according to an embodiment of the invention is shown, the method includes the following steps:
step one, obtaining the difference between the time length of a clock in a clock chip in each preset time period and the time length of a standard clock in the time period, and calculating a clock error index in the clock chip in each time period; and determining a correction coefficient of each time period according to the clock error index and the standard clock frequency.
First, in this embodiment, the clock chip is composed of a crystal oscillator, a frequency divider and a counter, and in order to obtain an error generated in the internal time of the clock chip, an external standard time source, i.e. a standard clock, needs to be obtained. In the process of correcting the clock, the internal time length of the clock chip in the same time length is acquired by taking the standard clock as a reference, and then correction analysis is carried out according to the difference condition between the internal time of the clock chip and the time of the standard clock in each time length range.
In this embodiment, the acquired time period is updated with one hour as one time unit, the time length of three time units as one time period, and one time unit as a reference, for example, twelve points are taken as a time starting point, twelve points to fifteen points are taken as a first time period, twelve points to thirteen points are taken as a first time unit, thirteen points to sixteen points are taken as a second time period, and so on, and a plurality of time periods can be acquired as time passes. Meanwhile, the implementer can set the time unit and the time period according to the specific implementation scene.
It should be noted that, the finer time unit can be obtained according to the actual running condition of the clock chip, the finer the time unit, the more accurate the time difference can be read. Since the time length of the time unit may be shorter, the chip clock may have phase dislocation caused by the difference of the frequency, the phase difference may become larger gradually in the running process of the chip clock, and if the frequency difference is judged according to only one time unit in the shorter time length, it is difficult to obtain an accurate difference analysis result, so in this embodiment, the difference analysis is performed by selecting a time period formed by a plurality of time units.
The error generated in the use process of the clock chip is mainly due to the fact that the internal frequency of the clock chip has smaller deviation compared with the standard frequency, the smaller deviation generally needs longer use time to be better displayed on clock time, so that the difference condition of the clock chip in a plurality of time periods needs to be analyzed, and the correction coefficient is corrected continuously through follow-up, so that a more accurate correction result is obtained.
Based on the difference, the time length of the clock in the clock chip in each preset time period and the time length of the standard clock in the time period are obtained, and the clock error index in the clock chip in each time period is calculated. Specifically, the difference between the time length of the clock in the clock chip in each preset time period and the time length of the standard clock in the time period is calculated, and the ratio of the difference to the time period length is used as the clock error index in the clock chip in each time period.
For example, with the standard clock as a reference, under a time period, that is, when the standard clock is from twelve points to fifteen points, the time length passing from twelve points in the clock chip is recorded, the difference between the time length in the clock chip and the time period is calculated to represent the difference condition between the time length in the clock chip and the standard time, and then the ratio between the difference and the time length in the time period is used as a clock error index in one period to represent the error generation speed of the time in the clock chip in one time period, wherein the error amount generated per second is the deviation between the clock frequency of the chip and the standard time frequency.
It should be noted that, since the time passed by the standard clock is the standard time, the time length of the standard clock in one time period is the time length of one time period. In this embodiment, the calculation time lengths are all calculated in units of seconds.
And the clock in the clock chip is corrected by calculating the correction coefficient in each time period and correcting the clock frequency by using the correction coefficient, so that the local accuracy of the clock is ensured, and more accurate clock correction can be realized. The clock error index corresponding to each time period of the clock in the clock chip represents the difference between the clock chip frequency and the standard clock frequency, and the correction coefficient for adjusting the difference is calculated based on the difference.
Since the standard clock frequency is 1Hz, namely vibration is carried out every second, and the clock frequency in the clock chip has errors, namely the error quantity generated by the clock every second is represented by the corresponding clock error index in each time period, and the correction coefficient of each time period is determined according to the corresponding clock error index and the standard clock frequency in each time period. Specifically, for any one time period, the sum value between the clock error index in the clock chip and the standard clock frequency in the time period is used as the correction coefficient of the time period.
When the value of the clock error index is larger than 0, the larger the value of the clock error index is, the larger the difference between the time in the clock chip and the standard time is, and in the same time period, the longer the clock in the clock chip is compared with the standard clock, the slower the frequency of the clock chip is, so that the frequency of the clock chip is adjusted by using the correction coefficient, the adjusted frequency can be relatively faster, and the purpose of correction is achieved.
When the value of the clock error index is smaller than 0, the smaller the value of the clock error index is, the larger the difference between the time in the clock chip and the standard time is, and in the same time period, the shorter the time of the clock in the clock chip compared with the standard clock is, the faster the frequency of the clock chip is, so that the frequency of the clock chip is adjusted by using the correction coefficient, the adjusted frequency is relatively slower, and the purpose of correction is achieved.
Step two, determining an ideal fluctuation range of the correction coefficient according to the correction coefficient of each time period in the historical time period; and adjusting the ideal fluctuation range according to the difference between the correction coefficient of each time period to be adjusted and the ideal fluctuation range after the historical time period, and updating the correction coefficient of the time period to be adjusted.
Since the degree of clock error is generally finer, and the error cannot be accurately obtained in a shorter time period, in this embodiment, the error gradually generated in the following is corrected by observing the occurrence of the error in a period of time. Namely, the correction coefficients corresponding to the time periods of the clock in the clock chip in a certain time period need to be obtained, and further the value distribution condition of the correction coefficients corresponding to each time period in the time period is analyzed.
In this embodiment, the time length of the historical time period is set to 24 hours, for example, the time length of 24 hours from twelve points is the historical time period, so that the error condition of each time period included in the historical time period can be analyzed, each time period is analyzed one by one from twelve points on the next day, the error condition is further recorded as the time period to be adjusted, specifically, each time period from the first time period after the historical time period is recorded as the time period to be adjusted, for example, twelve points from twelve points to fifteen points on the second day are the first time period to be adjusted, thirteen points to sixteen points are the second time period to be adjusted, and so on, and error analysis is performed according to the time sequence.
Based on this, an ideal fluctuation range of the correction coefficient is determined from the correction coefficient for each time period in the history time period. Specifically, the average value of correction coefficients of all time periods in the history period is taken as the characteristic correction coefficient. Among the correction coefficients for all the time periods of the history period, the smallest correction coefficient larger than the characteristic correction coefficient is set as the upper limit value of the ideal fluctuation range, and the largest correction coefficient smaller than the characteristic correction coefficient is set as the lower limit value of the ideal fluctuation range.
In this embodiment, the average value of the correction coefficients of all the time periods in the history period is used as the characterization value of all the correction coefficients in the whole history period, that is, the characteristic correction coefficient characterizes the error correction degree of all the time periods in the history period. When the error analysis is gradually accurate over time, the corresponding correction coefficient gradually becomes accurate and gradually converges within a certain value range, so that a data range formed by the correction coefficient of two time periods with the smallest difference from the characteristic value of the correction coefficient in the history period is used as an ideal fluctuation range of the correction coefficient.
Further, in the process of adjusting and updating the correction coefficient of each time period to be adjusted one by one, the difference condition between the correction coefficient of the time period to be adjusted and the ideal fluctuation range needs to be compared, and the ideal fluctuation range is updated by using the correction coefficient with smaller difference between the correction coefficient and the characteristic correction coefficient in the historical time period, so that the final ideal fluctuation range gradually converges in a certain value range.
According to the difference between the correction coefficient of each time period to be adjusted and the ideal fluctuation range after the historical time period, the ideal fluctuation range is adjusted, the correction coefficient of the time period to be adjusted is updated, specifically, the first time period to be adjusted after the historical time period is recorded as a first adjustment period, the second time period to be adjusted after the historical time period is recorded as a second adjustment period, and the like, and the time periods to be adjusted are marked according to the time sequence.
When the value of the correction coefficient of the first adjustment period is in the ideal fluctuation range, the updated correction coefficient of the first adjustment period is equal to the value of the correction coefficient before updating, whether the correction coefficient of the first adjustment period is larger than the characteristic adjustment coefficient is judged, the ideal fluctuation range is adjusted, and if yes, the correction coefficient of the first adjustment period is used as the upper limit value of the ideal fluctuation range after the first adjustment; if not, the correction coefficient of the first adjustment period is used as the lower limit value of the ideal fluctuation range after the first adjustment.
Specifically, it is first determined whether the value of the correction coefficient of the first adjustment period is within the ideal fluctuation range, if so, the ideal fluctuation range needs to be updated according to the value of the correction coefficient of the first adjustment period, that is, the correction coefficient of the first adjustment period located within the ideal fluctuation range must be closer to the characteristic correction coefficient than the upper limit value or the lower limit value of the existing ideal fluctuation range. Further, by comparing the magnitude between the correction coefficient of the first adjustment period and the characteristic correction coefficient, it is judged whether the upper limit value of the ideal fluctuation range needs to be updated or the lower limit value of the ideal fluctuation range needs to be updated. Since the correction coefficient of the first adjustment period is located in the ideal fluctuation range, the correction coefficient of the first adjustment period is in a relatively normal range, and therefore the correction coefficient of the first adjustment period is not adjusted and updated at this time, and only the ideal fluctuation range is adjusted and updated.
When the value of the correction coefficient of the first adjustment period is not in the ideal fluctuation range, the ideal fluctuation range is not adjusted, and the updated correction coefficient of the first adjustment period is determined according to the correction coefficient of the first adjustment period, the ideal fluctuation range and the characteristic correction coefficient.
Specifically, when the value of the correction coefficient in the first adjustment period is judged not to be in the ideal fluctuation range, the fact that no new correction coefficient and the characteristic correction coefficient are smaller in difference is indicated, and therefore adjustment and update of the ideal fluctuation range are not needed at this time. Further, since the correction coefficient of the first adjustment period is not in the ideal fluctuation range, it is explained that there may be an abnormal situation in the correction coefficient of the first adjustment period, so that the correction coefficient of the first adjustment period needs to be adjusted and updated, and further, the correction coefficient of the first adjustment period needs to be adjusted and updated by analyzing the difference between the correction coefficient of the first adjustment period and the upper limit value or the lower limit value of the ideal fluctuation range.
In this embodiment, taking the first adjustment period as an example for explanation, the calculation formula of the correction coefficient updated in the first adjustment period may be expressed as follows:
wherein,indicating the updated correction coefficient of the first adjustment period, n 1 A correction coefficient representing the first adjustment period, i.e. the correction coefficient before the update of the first adjustment period, N r0 Represents the upper limit value of the ideal fluctuation range, N l0 Represents the lower limit value of the ideal fluctuation range, +.>Representing the characteristic correction coefficients.
In addition, since the ideal fluctuation range is not updated by adjustment in the process of updating the correction coefficient in the first adjustment period, the ideal fluctuation range used in the process of calculating the correction coefficient after the update in the first adjustment period is the ideal fluctuation range which is not updated.
When n is 1 >N r0 In this case, since the correction coefficient indicating the first adjustment period has a large value, the correction coefficient of the first adjustment period needs to be subtracted to have a value closer to the ideal fluctuation range, i.e., n 1 -N r0 Representing the difference between the correction coefficient of the first adjustment period and the upper limit value of the ideal fluctuation range, the greater the difference, the degree of adjustment of the correction coefficient of the first adjustment periodThe larger the size of the container,representing the difference duty cycle, +.>A correction coefficient n representing the first adjustment period 1 The amount of adjustment for puncturing is performed.
When n is 1 <N l0 In this case, since the correction coefficient of the first adjustment period is smaller, the correction coefficient of the first adjustment period needs to be increased to approach the ideal fluctuation range, N l0 -n 1 The difference between the lower limit value representing the ideal fluctuation range and the correction coefficient of the first adjustment period is represented, the greater the difference, the greater the degree of adjustment of the correction coefficient of the first adjustment period,representing the difference duty cycle, +.>A correction coefficient n representing the first adjustment period 1 An increased adjustment is made.
After the historical time period, the updating method of the correction coefficient of each time period to be adjusted is the same as the updating method of the correction coefficient of the first adjustment period, and it is to be noted that when the correction coefficient of each time period to be adjusted after the historical time period is updated according to the same method, if the ideal fluctuation range is subjected to the adjustment operation, the correction coefficient of each time period to be adjusted is updated by using the adjusted ideal fluctuation range.
For example, if the value of the correction coefficient of the first adjustment period is within the ideal fluctuation range, the ideal fluctuation range needs to be adjusted and updated according to the value of the correction coefficient of the first adjustment period, and if the correction coefficient of the first adjustment period is larger than the characteristic adjustment coefficient, the correction coefficient of the first adjustment period is taken as the upper limit value of the ideal fluctuation range after the first adjustment, and is denoted as N r1 The ideal fluctuation range after the first adjustment can be expressed as (N l0 ,N r1 ). Further, it is determined whether the correction coefficient of the second adjustment period needs to be updated, first, it is determined whether the correction coefficient of the second adjustment period is within the ideal fluctuation range (N l0 ,N r1 ) And then judging whether the correction coefficient of the second adjustment period needs to be updated or not, and judging whether the ideal fluctuation range needs to be adjusted or not.
It should be noted that, since the frequency error of the chip clock is very small, the clock error is too small due to the small correction period, and it is difficult to fine adjust according to the correction register with limited width, and if the correction period is too large, a larger error occurs in a short time of the clock, although the calculation difficulty of the correction coefficient is reduced, the clock cycle is also caused to have inaccurate readings, and the distortion of the clock readings is caused. Therefore, when clock correction is carried out, the correction coefficient is calculated so as to obtain the average error condition generated by the chip clock by analyzing the error magnitudes in a plurality of correction periods of the history, thereby calculating the correction coefficient of the clock frequency, and correcting the correction coefficient in the subsequent correction period, so that the correction coefficient gradually converges to obtain a more accurate correction coefficient.
Step three, updating the time period according to the difference condition between the updated correction coefficient of the time period and the correction coefficient of the time period in the historical time period; and correcting the internal clock of the clock chip according to the updated time period and the updated correction coefficient of the time period to be adjusted.
After the correction coefficient of each time period to be adjusted after the historical time period is obtained, the clock chip frequency in the time period corresponding to the correction coefficient can be utilized to adjust, and it is noted that the correction coefficient of each time period to be adjusted may be updated or not updated. When the value of the correction coefficient of the time period to be adjusted is in the corresponding ideal fluctuation range, the correction coefficient is in a normal range in the time period, and further the error fluctuation of the clock chip in the time period is smaller. When correction coefficients of a plurality of time periods to be adjusted continuously appear in a normal range after the historical time period, the error of the time period to be adjusted can be adjusted, and meanwhile, the correction period for observing the occurrence of the error can be properly enlarged, so that the occurrence of the clock chip error can be accurately acquired in a longer time period.
Based on this, the time period is updated according to the difference between the updated correction coefficient of the time period and the correction coefficient of the time period in the history period. Specifically, when correction coefficients of a continuous preset number of time periods to be adjusted after the historical time period are all in a corresponding ideal fluctuation range, the first time period to be adjusted after the continuous preset number of time periods to be adjusted is recorded as a target time period.
In this embodiment, the preset number of values is 3, that is, when the correction coefficients of the 3 continuous time periods to be adjusted after the historical time period are all in the corresponding ideal fluctuation range, if the correction coefficients of the first, second and third time periods to be adjusted after the historical time period are all in the corresponding ideal fluctuation range, the fourth time period to be adjusted after the historical time period is recorded as the target time period, and further analysis can be performed according to the correction coefficients of the target time period to determine whether the length of the time period needs to be adjusted from the target time period.
It should be noted that, when the adjustment analysis of the time period length is performed, the correction coefficient of each time period to be adjusted is an updated correction coefficient, but the updated correction coefficient may be equal to the value of the correction coefficient before the update.
Calculating a difference value between the correction coefficient updated in the target time period and the characteristic correction coefficient to be recorded as a first difference value; calculating the difference between the correction coefficient of the last time period adjacent to the target time period and the characteristic correction coefficient to be recorded as a second difference; when the first difference value is smaller than or equal to the second difference value, the absolute value of the ratio of the second difference value to the first difference value is taken as an update coefficient, and the product of the update coefficient and the time period is taken as an updated time period of the target time period.
Further, when the first difference is greater than the second difference, the time length of the time period is not adjusted, so that whether the correction coefficient is in the corresponding ideal fluctuation range can be continuously judged for the target time period, and if yes, whether the time length of the time period needs to be adjusted is judged for the next time period to be adjusted for the target time period.
In this embodiment, regarding the t-th time period to be adjusted after the historical time period as the target time period, when the first difference value is smaller than or equal to the second difference value, the calculation formula of the updated time period of the target time period may be expressed as:
wherein,an updated time period representing the t-th time period to be adjusted,/>Represents the correction coefficient after the t-th time period to be adjusted is updated, n t-1 Correction factor representing the t-1 th time period to be adjusted, < >>Representing characteristic correction factors, ++>For the first difference, +>For the second difference, +>To update the coefficients.
The first difference value represents the difference between the correction coefficient of the target time period and the characteristic correction coefficient, and the second difference value represents the difference between the correction coefficient of the last time period adjacent to the target time period and the characteristic correction coefficient. Because the correction coefficients of the time periods to be adjusted, which are continuously preset in number, are all in the corresponding ideal fluctuation range before the target time period, whether the time length of the current target time period needs to be adjusted and updated is judged by comparing the difference condition of the correction coefficients corresponding to the target time period with the difference condition of the correction coefficients corresponding to the adjacent previous time period.
When (when)In the method, the difference corresponding to the correction coefficient updated in the target time period is smaller, and the accuracy of the correction coefficient updated in the target time period is higher, so that the error occurrence condition of the clock chip can be analyzed through the longer correction period by increasing the time length of the time period, the clock chip can be corrected in the larger correction period, and the correction accuracy is higher.
When (when)When the first difference is larger than the second difference, the difference corresponding to the correction coefficient after updating the target time period is larger, so that the time length of the time period does not need to be enlarged, namely the original time period is still adopted for error analysis, and whether the time period to be adjusted needs to be updated or not is further judged one by one.
By adjusting the correction period, the correction of the clock chip can be performed in a larger period, so that the accuracy of the clock chip is improved, and the calculation time loss possibly caused by multiple corrections is reduced.
And finally, correcting the internal clock of the clock chip according to the updated time period and the updated correction coefficient of the time period to be adjusted. Specifically, the product of the updated correction coefficient of the time period to be adjusted and the clock frequency in the clock chip is used as the corrected clock frequency. According to the clock frequency correction method and device, when a relatively stable error occurs in the clock chip after a long period of time, the clock frequency correction operation is performed according to the updated correction coefficient, so that the clock correction precision is relatively high, and relatively high clock accuracy can be ensured after a relatively long clock running time.
And (3) starting from the adjusted first time period, re-acquiring the time period in the historical time period, and monitoring and correcting the clock accuracy in the clock chip. For example, after the historical time period, if the t time period to be adjusted is adjusted, the t+1th time period to be adjusted is the adjusted first time period, that is, from the t+1th time period to be adjusted, a historical time period is obtained again, in this embodiment, the length of the historical time period is 24 hours, that is, a time period that passes 24 hours from the initial time point of the t+1th time period to be adjusted is the historical time period, and further, the clock accuracy inside the clock chip can be monitored and corrected according to the methods of the first step, the second step and the third step.
The above embodiments are only for illustrating the technical solution of the present application, and are not limiting; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the scope of the embodiments of the present application, and are intended to be included within the scope of the present application.

Claims (7)

1. The method for correcting the clock accuracy in the clock chip is characterized by comprising the following steps:
acquiring the difference between the time length of a clock in a clock chip in each preset time period and the time length of a standard clock in the time period, and calculating a clock error index in the clock chip in each time period; determining a correction coefficient of each time period according to the clock error index and the standard clock frequency;
according to the correction coefficient of each time period in the historical time period, determining an ideal fluctuation range of the correction coefficient; according to the difference between the correction coefficient of each time period to be adjusted and the ideal fluctuation range after the historical time period, adjusting the ideal fluctuation range, and updating the correction coefficient of the time period to be adjusted;
updating the time period according to the difference between the updated correction coefficient of the time period and the correction coefficient of the time period in the historical time period; correcting the internal clock of the clock chip according to the updated time period and the updated correction coefficient of the time period to be adjusted;
the method for determining the ideal fluctuation range of the correction coefficient according to the correction coefficient of each time period in the historical time period specifically comprises the following steps:
among the correction coefficients of all the time periods in the history time period, the smallest correction coefficient larger than the characteristic correction coefficient is taken as the upper limit value of the ideal fluctuation range, and the largest correction coefficient smaller than the characteristic correction coefficient is taken as the lower limit value of the ideal fluctuation range;
according to the difference between the correction coefficient of each time period to be adjusted and the ideal fluctuation range after the historical time period, the ideal fluctuation range is adjusted, and the correction coefficient of the time period to be adjusted is updated, specifically comprising:
recording a first time period to be adjusted after the historical time period as a first adjustment period;
when the value of the correction coefficient of the first adjustment period is in the ideal fluctuation range, the updated correction coefficient of the first adjustment period is equal to the value of the correction coefficient before updating, whether the correction coefficient of the first adjustment period is larger than the characteristic adjustment coefficient is judged, the ideal fluctuation range is adjusted, and if yes, the correction coefficient of the first adjustment period is used as the upper limit value of the ideal fluctuation range after the first adjustment; if not, taking the correction coefficient of the first adjustment period as the lower limit value of the ideal fluctuation range after the first adjustment;
when the value of the correction coefficient of the first adjustment period is not in the ideal fluctuation range, the ideal fluctuation range is not adjusted, and the updated correction coefficient of the first adjustment period is determined according to the correction coefficient of the first adjustment period, the ideal fluctuation range and the characteristic correction coefficient;
the determining the updated correction coefficient of the first adjustment period according to the correction coefficient of the first adjustment period, the ideal fluctuation range and the characteristic correction coefficient specifically includes:
wherein,indicating the updated correction coefficient of the first adjustment period, n 1 A correction coefficient representing a first adjustment period, N r1 Represents the upper limit value of the ideal fluctuation range, N l1 Represents the lower limit value of the ideal fluctuation range, +.>Representing the characteristic correction coefficients.
2. The method for correcting clock accuracy in a clock chip according to claim 1, wherein the determining the correction coefficient for each time period according to the clock error index and the standard clock frequency specifically comprises:
and for any time period, taking the sum value of the clock error index in the clock chip and the standard clock frequency in the time period as a correction coefficient of the time period.
3. The method for correcting the clock accuracy in a clock chip according to claim 1, wherein the method for obtaining the characteristic correction coefficient is specifically as follows: and taking the average value of the correction coefficients of all time periods in the historical time period as a characteristic correction coefficient.
4. The method for correcting clock accuracy in a clock chip according to claim 1, wherein when the correction coefficient of each time period to be adjusted after the history period is updated according to the same method, if the ideal fluctuation range is subjected to the adjustment operation, the correction coefficient of each time period to be adjusted is updated by using the adjusted ideal fluctuation range.
5. The method for correcting clock accuracy in a clock chip according to claim 1, wherein the updating the time period according to a difference between the updated correction coefficient of the time period and the correction coefficient of the time period in the history time period specifically comprises:
when correction coefficients of a plurality of time periods to be adjusted are continuously preset after the historical time period and are in a corresponding ideal fluctuation range, marking a first time period to be adjusted after the continuous preset time periods to be a target time period, calculating a difference value between the correction coefficients after updating of the target time period and the characteristic correction coefficients to be a first difference value; calculating the difference between the correction coefficient of the last time period adjacent to the target time period and the characteristic correction coefficient to be recorded as a second difference;
when the first difference value is smaller than or equal to the second difference value, taking the absolute value of the ratio of the second difference value to the first difference value as an update coefficient, and taking the product of the update coefficient and the time period as an updated time period corresponding to the target time period; when the first difference is greater than the second difference, the target time period is not updated.
6. The method for correcting clock accuracy in a clock chip according to claim 1, wherein the step of obtaining the difference between the time length of the clock in the clock chip and the time length of the standard clock in the time period in each preset time period, and calculating the clock error index in the clock chip in each time period specifically comprises the steps of:
calculating the difference value between the time length of the clock in the clock chip in each preset time period and the time length of the standard clock in the time period, and taking the ratio of the difference value to the time period length as the clock error index in the clock chip in each time period.
7. The method for correcting the clock accuracy of the clock chip according to claim 1, wherein the correcting the clock chip internal clock according to the updated time period and the updated correction coefficient of the time period to be adjusted specifically comprises:
taking the product of the updated correction coefficient of the time period to be adjusted and the clock frequency in the clock chip as the corrected clock frequency;
and (3) starting from the adjusted first time period, re-acquiring the time period in the historical time period, and monitoring and correcting the clock accuracy in the clock chip.
CN202311182667.3A 2023-09-14 2023-09-14 Clock chip internal clock precision correction method Active CN116909351B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311182667.3A CN116909351B (en) 2023-09-14 2023-09-14 Clock chip internal clock precision correction method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311182667.3A CN116909351B (en) 2023-09-14 2023-09-14 Clock chip internal clock precision correction method

Publications (2)

Publication Number Publication Date
CN116909351A CN116909351A (en) 2023-10-20
CN116909351B true CN116909351B (en) 2023-12-19

Family

ID=88355112

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311182667.3A Active CN116909351B (en) 2023-09-14 2023-09-14 Clock chip internal clock precision correction method

Country Status (1)

Country Link
CN (1) CN116909351B (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001257664A (en) * 2000-03-14 2001-09-21 Nec Corp Clock frequency synchronous control circuit in digital broadcast receiver
CN104613516A (en) * 2014-12-17 2015-05-13 美的集团股份有限公司 A control system for adjusting power of an inverter, a control method, and a microwave oven
CN110308762A (en) * 2019-06-21 2019-10-08 广芯微电子(广州)股份有限公司 A kind of clock frequency calibration method of chip interior clock source
CN111934678A (en) * 2020-09-28 2020-11-13 深圳英集芯科技有限公司 Method for automatically calibrating clock frequency in chip and related product
CN212231411U (en) * 2020-06-15 2020-12-25 深圳扬兴科技有限公司 Crystal oscillator based on reference clock generation circuit
CN212572495U (en) * 2020-06-16 2021-02-19 深圳扬兴科技有限公司 Novel high-precision programmable oscillator
CN112462846A (en) * 2020-12-14 2021-03-09 深圳市晨北科技有限公司 Clock correction method, clock correction device, computer equipment and storage medium
CN114296511A (en) * 2021-11-17 2022-04-08 北京智芯微电子科技有限公司 Real-time clock calibration circuit, method and chip structure
CN115097961A (en) * 2022-07-14 2022-09-23 敦泰科技(深圳)有限公司 Clock calibration method of touch chip, touch chip and touch display device
CN115616541A (en) * 2022-10-12 2023-01-17 中国航空工业集团公司洛阳电光设备研究所 Calibration method for reference clock of sonobuoy
CN115767705A (en) * 2021-09-03 2023-03-07 中兴通讯股份有限公司 Local clock calibration method, user terminal and computer readable storage medium
CN116318514A (en) * 2023-03-31 2023-06-23 紫光展讯通信(惠州)有限公司 Clock correction method and device and electronic equipment

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001257664A (en) * 2000-03-14 2001-09-21 Nec Corp Clock frequency synchronous control circuit in digital broadcast receiver
CN104613516A (en) * 2014-12-17 2015-05-13 美的集团股份有限公司 A control system for adjusting power of an inverter, a control method, and a microwave oven
CN110308762A (en) * 2019-06-21 2019-10-08 广芯微电子(广州)股份有限公司 A kind of clock frequency calibration method of chip interior clock source
CN212231411U (en) * 2020-06-15 2020-12-25 深圳扬兴科技有限公司 Crystal oscillator based on reference clock generation circuit
CN212572495U (en) * 2020-06-16 2021-02-19 深圳扬兴科技有限公司 Novel high-precision programmable oscillator
CN111934678A (en) * 2020-09-28 2020-11-13 深圳英集芯科技有限公司 Method for automatically calibrating clock frequency in chip and related product
CN112462846A (en) * 2020-12-14 2021-03-09 深圳市晨北科技有限公司 Clock correction method, clock correction device, computer equipment and storage medium
CN115767705A (en) * 2021-09-03 2023-03-07 中兴通讯股份有限公司 Local clock calibration method, user terminal and computer readable storage medium
CN114296511A (en) * 2021-11-17 2022-04-08 北京智芯微电子科技有限公司 Real-time clock calibration circuit, method and chip structure
CN115097961A (en) * 2022-07-14 2022-09-23 敦泰科技(深圳)有限公司 Clock calibration method of touch chip, touch chip and touch display device
CN115616541A (en) * 2022-10-12 2023-01-17 中国航空工业集团公司洛阳电光设备研究所 Calibration method for reference clock of sonobuoy
CN116318514A (en) * 2023-03-31 2023-06-23 紫光展讯通信(惠州)有限公司 Clock correction method and device and electronic equipment

Also Published As

Publication number Publication date
CN116909351A (en) 2023-10-20

Similar Documents

Publication Publication Date Title
US6472943B1 (en) Oscillating circuit and method for calibrating same
US8471619B2 (en) Circuit and method for generating a clock signal
US7545228B1 (en) Dynamic temperature compensation for a digitally controlled oscillator using dual MEMS resonators
CN107465393B (en) System and method for frequency compensation of real time clock system
CN101452307B (en) System and method of calibrating real time clock
US7602875B2 (en) Sampling rate conversion method and apparatus
CN1413054A (en) Time error compensation device and method for terminal
JP2007078405A (en) Timing program of software timepiece
CN110769546B (en) Temperature compensation method and system for timing LED lamp in variable temperature environment
CN114201001A (en) Compensation method and device of real-time clock, terminal equipment and medium
CN113359191B (en) Real-time correction method of constant-temperature crystal oscillator and electromagnetic receiver
CN116909351B (en) Clock chip internal clock precision correction method
CN112737509B (en) Method and system for compensating frequency drift of crystal oscillator
CN116776094B (en) Crystal oscillator temperature test data intelligent analysis storage system
US10069584B2 (en) Frequency calibration apparatus and method
CN111934683A (en) Digital frequency correction method and system for temperature control RTC
CN111026232A (en) Clock calibration method, chip and electronic equipment
CN109084899B (en) Infrared focal plane detector non-uniform body output correction method and device
EP3355626B1 (en) Method and apparatus for digital quartz temperature and drift compensation for a sleep timer of a nb-iot device
US20100079214A1 (en) Temperature compensation method and apparatus for an output frequency signal based on successive approximation
CN115616541A (en) Calibration method for reference clock of sonobuoy
WO2020015828A1 (en) Method and apparatus for digital quartz temperature and drift compensation for a sleep timer of a nb-iot device
CN116980065B (en) Clock calibration method, clock calibration device, terminal equipment and storage medium
CN117092444B (en) Method, system, equipment and medium for indirectly measuring DTC stepping without depending on instrument
CN115657448B (en) Frequency offset analysis method for clock discipline

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant