CN106292839B - Real-time clock compensation circuit and calibration method, device - Google Patents

Real-time clock compensation circuit and calibration method, device Download PDF

Info

Publication number
CN106292839B
CN106292839B CN201610655911.7A CN201610655911A CN106292839B CN 106292839 B CN106292839 B CN 106292839B CN 201610655911 A CN201610655911 A CN 201610655911A CN 106292839 B CN106292839 B CN 106292839B
Authority
CN
China
Prior art keywords
frequency
adjustment
real
adjusted
oscillation
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
CN201610655911.7A
Other languages
Chinese (zh)
Other versions
CN106292839A (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.)
Shanghai Eastsoft Microelectronics Co Ltd
Original Assignee
Shanghai Eastsoft Microelectronics 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 Shanghai Eastsoft Microelectronics Co Ltd filed Critical Shanghai Eastsoft Microelectronics Co Ltd
Priority to CN201610655911.7A priority Critical patent/CN106292839B/en
Publication of CN106292839A publication Critical patent/CN106292839A/en
Application granted granted Critical
Publication of CN106292839B publication Critical patent/CN106292839B/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/14Time supervision arrangements, e.g. real time clock

Abstract

A kind of real-time clock compensation circuit and calibration method, device, the real-time clock compensation circuit includes oscillator, and the calibration method includes: the current temperature value for obtaining the real-time clock compensation circuit local environment;Corresponding exemplary frequency deviation values are obtained according to the current temperature value;The exemplary frequency deviation values are adjusted, and calculates first frequency according to exemplary frequency deviation values adjusted and adjusts number of steps, the first frequency adjustment number of steps is integer;Number of steps is adjusted according to the first frequency to be adjusted the frequency of oscillation of the oscillator.Using the above scheme, the output accuracy of real-time clock compensation circuit can be improved.

Description

Real-time clock compensation circuit and calibration method, device
Technical field
The present invention relates to field of electronic devices more particularly to a kind of real-time clock compensation circuit and calibration methods, device.
Background technique
Real-time clock (Real Time Clock, RTC) circuit be one kind do not need communication sync identification the time can be realized The module of calculating is usually made of quartz crystal, oscillating circuit and frequency counting and frequency dividing circuit etc..By to 32768Hz The frequency of crystal is counted, and realizes the Continuous plus to the time and output.Real-time clock is in electronic watch, the neck such as intelligent electric meter Domain is widely used.
When RTC factory, although can be clock accuracy adjustment to very high precision, for example, in 1PPM (Percent Per Million, part per million) within, but in actual use, the environment temperature of RTC circuit, which changes, will lead to Clock frequency is drifted about.If do not calibrated to RTC circuit, clock can generate about ± 2.6 seconds deviations daily.
In the prior art, usually RTC circuit is calibrated by the method for temperature-compensating.Under normal circumstances, pass through temperature Inductive circuit detects temperature value, and the exemplary frequency deviation values under the temperature value are determined by the way of tabling look-up, corresponding to carry out to RTC Compensation.
The compensation precision of existing RTC temperature-compensation method is lower, causes the output accuracy of RTC lower.
Summary of the invention
Present invention solves the technical problem that being how to improve the output accuracy of real-time clock.
In order to solve the above technical problems, the embodiment of the present invention provides a kind of calibration method of real-time clock compensation circuit, institute Stating real-time clock compensation circuit includes oscillator, and the calibration method includes: to obtain ring locating for the real-time clock compensation circuit The current temperature value in border;Corresponding exemplary frequency deviation values are obtained according to the current temperature value;The exemplary frequency deviation values are adjusted It is whole, and calculate first frequency according to exemplary frequency deviation values adjusted and adjust number of steps, the first frequency adjustment number of steps is whole Number;Number of steps is adjusted according to the first frequency to be adjusted the frequency of oscillation of the oscillator.
Optionally, described to calculate first frequency adjustment number of steps according to exemplary frequency deviation values adjusted, comprising: according to described The frequency of oscillation of oscillator calculates the corresponding single step adjustment frequency values of the frequency of oscillation;By the frequency departure adjusted Value is divided by with single step adjustment frequency values, and obtained quotient adjusts number of steps as the first frequency.
It is optionally, described that the frequency of oscillation of the oscillator is adjusted according to first frequency adjustment number of steps, Include: to be added the first frequency adjustment number of steps number of oscillation corresponding with oscillator output 1s pulse, obtains With value as the corresponding number of oscillation of real-time clock compensation circuit output 1s pulse adjusted.
Optionally, described that the exemplary frequency deviation values are adjusted, comprising: by the exemplary frequency deviation values and the single step tune Whole frequency values are divided by, and obtain second frequency adjustment number of steps;When second frequency adjustment number of steps is non-integer, to described Exemplary frequency deviation values are adjusted.
It optionally, include capacitor array in the real-time clock compensation circuit, it is described that the exemplary frequency deviation values are adjusted It is whole, comprising: to calculate the corresponding frequency adjustment of the exemplary frequency deviation values;Obtain capacitor array corresponding to the frequency adjustment The target number n of the middle capacitor that need to be closed;The capacitor number that closed state is in the capacitor array is adjusted to n, with right The exemplary frequency deviation values are adjusted, so that the exemplary frequency deviation values are the integral multiple that the single step adjusts frequency values.
Optionally, the frequency adjustment meets following relationship: f (n)=| X1-X0|, wherein X0Described in front of adjustment Exemplary frequency deviation values;X1For the exemplary frequency deviation values adjusted, and X1In the integral multiple numerical value of all single step adjustment frequency values In, with X0Absolute difference it is minimum;F (n) is the frequency adjustment.
Optionally, the exemplary frequency deviation values adjusted meet following relationship: working as n1When > 1/2 × Δ f, X1=(M+1) × Δf;Work as n1When < -1/2 × Δ f, X1=(M-1) × Δ f;Wherein: n1For X0The remainder that division arithmetic obtains, M are carried out with Δ f The integer part of number of steps is adjusted for the second frequency, Δ f is that the single step adjusts frequency values.
Optionally, the calibration method further include: when second frequency adjustment number of steps is integer, by described second Frequency adjusts the number of steps number of oscillation corresponding with oscillator output 1s pulse and is added, and obtain and value is as adjusted The real-time clock compensation circuit exports the corresponding number of oscillation of 1s pulse.
To solve the above problems, the embodiment of the invention also provides a kind of calibrating installation of real-time clock compensation circuit, institute Stating real-time clock compensation circuit includes oscillator, and the calibrating installation includes: temperature value acquiring unit, described real-time for obtaining The current temperature value of clock compensation circuit local environment;Exemplary frequency deviation values acquiring unit, for being obtained according to the current temperature value Take corresponding exemplary frequency deviation values;Exemplary frequency deviation values adjustment unit, for being adjusted to the exemplary frequency deviation values;Computing unit, Number of steps is adjusted for calculating first frequency according to exemplary frequency deviation values adjusted, the first frequency adjustment number of steps is whole Number;Frequency of oscillation adjustment unit carries out the frequency of oscillation of the oscillator for adjusting number of steps according to the first frequency Adjustment.
Optionally, it is corresponding to calculate the frequency of oscillation for the frequency of oscillation according to the oscillator for the computing unit Single step adjust frequency values;The exemplary frequency deviation values adjusted and single step adjustment frequency values are divided by, obtained quotient Number of steps is adjusted as the first frequency.
Optionally, the frequency of oscillation adjustment unit, for the first frequency to be adjusted number of steps and the oscillator It exports the corresponding number of oscillation of 1s pulse to be added, obtain and value is as the real-time clock compensation circuit output 1s adjusted The corresponding number of oscillation of pulse.
Optionally, the exemplary frequency deviation values adjustment unit, for the exemplary frequency deviation values and the single step to be adjusted frequency Value is divided by, and second frequency adjustment number of steps is obtained;It is inclined to the frequency when second frequency adjustment number of steps is non-integer Difference is adjusted.
It optionally, include capacitor array in the real-time clock compensation circuit, the exemplary frequency deviation values adjustment unit is used for Calculate the corresponding frequency adjustment of the exemplary frequency deviation values;Obtaining in capacitor array corresponding to the frequency adjustment needs to be closed Capacitor target number n;The capacitor number that closed state is in the capacitor array is adjusted to n, to the frequency Deviation is adjusted, so that the exemplary frequency deviation values are the integral multiple that the single step adjusts frequency values.
Optionally, the frequency adjustment meets following relationship: f (n)=| X1-X0|, wherein X0Described in front of adjustment Exemplary frequency deviation values;X1For the exemplary frequency deviation values adjusted, and X1In the integral multiple numerical value of all single step adjustment frequency values In, with X0Absolute difference it is minimum;F (n) is the frequency adjustment.
Optionally, the exemplary frequency deviation values adjusted meet following relationship: working as n1When > 1/2 × Δ f, X1=(M+1) × Δf;Work as n1When < -1/2 × Δ f, X1=(M-1) × Δ f;Wherein: n1For X0The remainder that division arithmetic obtains, M are carried out with Δ f The integer part of number of steps is adjusted for the second frequency, Δ f is that the single step adjusts frequency values.
Optionally, the frequency of oscillation adjustment unit is also used to when it is integer that the second frequency, which adjusts number of steps, will The second frequency adjusts the number of steps number of oscillation corresponding with oscillator output 1s pulse and is added, obtain and value conduct The real-time clock compensation circuit adjusted exports the corresponding number of oscillation of 1s pulse.
The embodiment of the invention also provides a kind of real-time clock compensation circuits, comprising: oscillator and any of the above-described kind of institute The calibrating installation for the real-time clock compensation circuit stated, in which: the oscillator, the oscillation for exporting built-in oscillation frequency are believed Number.
Compared with prior art, the technical solution of the embodiment of the present invention has the advantages that
After getting exemplary frequency deviation values according to current temperature value, exemplary frequency deviation values are adjusted, so that according to tune First frequency that exemplary frequency deviation values after whole are calculated adjustment number of steps is integer, so as to avoid the occurrence of because choosing and the Error caused by the close integer value of one frequency adjustment number of steps is adjusted frequency of oscillation, therefore can be accurately to vibration The frequency of oscillation for swinging device is adjusted, and improves the output accuracy of real-time clock.
Detailed description of the invention
Fig. 1 is the flow chart of the calibration method of one of embodiment of the present invention real-time clock compensation circuit;
Fig. 2 is the function curve of the capacitor number knots modification and second output bias value knots modification in one embodiment of the invention;
Fig. 3 is the flow chart of the calibration method of another real-time clock compensation circuit in the embodiment of the present invention;
Fig. 4 is the structural schematic diagram of the calibrating installation of one of embodiment of the present invention real-time clock compensation circuit;
Fig. 5 is the structural schematic diagram of one of embodiment of the present invention real-time clock compensation circuit.
Specific embodiment
In the prior art, usually RTC is calibrated by the method for temperature-compensating, it can be by the timing error control of RTC System is in ± 5PPM (hundred a ten thousandths) range, it is ensured that RTC mono- day accuracy of timekeeping error is in 0.5s.
In existing temperature-compensation method, temperature value is usually detected by temperature sensor either internally or externally.Root According to current temperature value, tables look-up and obtain the corresponding frequency compensation value of current temperature value, to be compensated to the output of RTC.For example, After getting current temperature value, by searching for frequency-temperature characteristic curve table, the corresponding frequency departure of current temperature value is found Value changes pulse frequency division value according to exemplary frequency deviation values to realize clock alignment.
However, can not usually get the corresponding frequency departure of all temperature values in existing RTC temperature-compensation method Value, therefore, the current temperature value got may be not present in frequency-temperature characteristic curve table, at this point, can only be in frequency temperature It spends and selects a frequency compensation value corresponding with the immediate temperature value of current temperature value in characteristic curve table.Therefore, existing RTC temperature-compensation method has that compensation precision is lower, causes the output accuracy of RTC lower.
In embodiments of the present invention, after getting exemplary frequency deviation values according to current temperature value, to exemplary frequency deviation values into Row adjustment, so that the first frequency adjustment number of steps being calculated according to exemplary frequency deviation values adjusted is integer, so as to It avoids the occurrence of because choosing error caused by the integer value close with first frequency adjustment number of steps is adjusted frequency of oscillation, Therefore accurately the frequency of oscillation of oscillator can be adjusted, improves the output accuracy of real-time clock.
It is understandable to enable above-mentioned purpose of the invention, feature and beneficial effect to become apparent, with reference to the accompanying drawing to this The specific embodiment of invention is described in detail.
The embodiment of the invention provides a kind of calibration methods of real-time clock compensation circuit, referring to Fig.1, below by way of specific Step is described in detail.
Step S101 obtains the current temperature value of the real-time clock compensation circuit local environment.
In specific implementation, ring locating for real-time clock compensation circuit can be obtained by temperature sensing elements such as temperature sensors The current temperature value in border can also obtain the current temperature value of real-time clock compensation circuit local environment by warming circuit.
Temperature sensor can be integrated with real-time clock compensation circuit, can also compensate electricity independently of real-time clock Road setting.Warming circuit also can be set inside real-time clock compensation circuit, or set independently of real-time clock compensation circuit It sets.
Step S102 obtains corresponding exemplary frequency deviation values according to the current temperature value.
Step S103 is adjusted the exemplary frequency deviation values, and calculates the first frequency according to exemplary frequency deviation values adjusted Rate adjusts number of steps.
In specific implementation, after getting exemplary frequency deviation values, first the exemplary frequency deviation values got can be adjusted It is whole, and first frequency adjustment number of steps is calculated according to exemplary frequency deviation values adjusted.At this point, the first frequency tune being calculated Whole number of steps is integer.
In embodiments of the present invention, the corresponding single step tune of frequency of oscillation can be calculated first according to the frequency of oscillation of oscillator Whole frequency values, it is the primary frequency shift amount of the every oscillation of oscillator that single step, which adjusts frequency values,.Set the frequency of oscillation of oscillator as f0, then single step adjustment frequency values are Δ f=1/f0, under normal circumstances, Δ f is adjusted as unit of PPM.
After single step adjustment frequency values are calculated, exemplary frequency deviation values adjusted and single step adjustment frequency values are carried out Division arithmetic, obtained quotient are first frequency adjustment number of steps, at this point, obtained first frequency adjustment number of steps is whole Number.
In embodiments of the present invention, it before being adjusted to exemplary frequency deviation values, can first determine a need for frequency Deviation is adjusted.The exemplary frequency deviation values got in step S102 and single step adjustment frequency values first can be subjected to division fortune It calculates, adjusts number of steps for obtained quotient as second frequency, namely: m2=X0/ Δ f, in which: m2It adjusts and walks for second frequency Into number, X0For exemplary frequency deviation values, the unit of exemplary frequency deviation values can be PPM.
When obtained second frequency adjusts number of steps m2When for integer, it may not need and exemplary frequency deviation values are adjusted;When Obtained second frequency adjustment number of steps m2When for non-integer namely exemplary frequency deviation values X0Can not coverlet successive step frequency values Δ f it is whole Except when, exemplary frequency deviation values can be adjusted, exemplary frequency deviation values adjusted be single step adjust frequency values Δ f integral multiple.
In specific implementation, preset capacitor array can be adjusted, to realize the adjustment to exemplary frequency deviation values.
In embodiments of the present invention, capacitor array can be set in real-time clock compensation circuit, it can in capacitor array To include multiple capacitors parallel with one another.The capacitance of each capacitor is equal, and there are one to go here and there therewith for each capacitor The switch of connection.By the disconnection of control switch, perhaps closure can control corresponding capacitor disconnection or closure.
In an embodiment of the present invention, include 1024 capacitors in capacitor array, include 1024 in capacitor array accordingly A switch is connected with 1024 capacitor one-to-one correspondence respectively.
In capacitor array, when the capacitor number difference being closed in capacitor array, the output capacitance of capacitor array can be sent out Changing.When the output capacitance of capacitor array changes, certain influence can be generated to the frequency of oscillation of oscillator, is caused The frequency of oscillation of oscillator changes.
Therefore, by adjusting the capacitor number being closed in capacitor array, the frequency of oscillation of adjustable oscillator.
It is known that the frequency of oscillation of oscillator, which is affected by temperature, can generate frequency departure from the above embodiment of the present invention Value.In addition, the frequency of oscillation of oscillator will receive influence when the output capacitance of capacitor array changes.Therefore, Ke Yitong It crosses and the output capacitance of capacitor array is adjusted, exemplary frequency deviation values are adjusted to realize.
It in embodiments of the present invention, can be inclined to frequency to realize by adjusting the capacitor number being closed in capacitor array Difference is adjusted.It is to the purpose that exemplary frequency deviation values are adjusted: exemplary frequency deviation values is adjusted to single step adjustment frequency values Integral multiple.When being adjusted to exemplary frequency deviation values, the corresponding frequency adjustment of exemplary frequency deviation values can be first calculated, according to frequency Rate adjustment amount needs the target number n for the capacitor being closed to obtain in capacitor array, the unit of frequency adjustment can be PPM.It Afterwards, the capacitor number that closed state is in capacitor array is adjusted to n, exemplary frequency deviation values is adjusted to realize.
In embodiments of the present invention, frequency adjustment can satisfy following relationship: f (n)=| X1-X0|, wherein X0To adjust Exemplary frequency deviation values before whole, X1For exemplary frequency deviation values adjusted, f (n) is frequency adjustment;X1Frequency is adjusted for all single steps In the integral multiple numerical value of value, with X0Difference the smallest numerical value of absolute value.
In an embodiment of the present invention, work as n1When > 1/2 × Δ f, exemplary frequency deviation values are adjusted to X1=(M+1) × Δ f, Namely the frequency adjustment f (n) of exemplary frequency deviation values=(M+1) × Δ f-X0;Work as n1When < -1/2 × Δ f, by exemplary frequency deviation values tune Whole is X1Frequency adjustment f (n)=X of=(M-1) × Δ f namely exemplary frequency deviation values0-(M-1)×Δf;Wherein, n1For X0With Δ f carries out the remainder that division arithmetic obtains, and M is the integer part that second frequency adjusts number of steps.
After getting the frequency adjustment f (n) of exemplary frequency deviation values, exemplary frequency deviation values can be adjusted, then adopt Division arithmetic is carried out with exemplary frequency deviation values adjusted and single step adjustment frequency values Δ f, obtained quotient is first frequency tune Whole number of steps.
Below to the electricity for being in closed state in the frequency adjustment f (n) and capacitor array provided in the embodiment of the present invention The relationship for holding number n is illustrated.
It in practical applications, can be in advance to each piece of real-time clock for each piece of real-time clock compensation circuit chip Capacitor array in compensation circuit chip is largely tested, to know the capacitor number of closure and the frequency of oscillation of oscillator The variation of the mapping relations of variation, the frequency of oscillation of oscillator can indicate by second output bias value, second output bias value Unit can be PPM.
It is for example, include 1024 capacitors in capacitor array, then right when testing the capacitor number of closure and being followed successively by 0~1024 The second output bias value for the 1025 groups of oscillators answered.
In practical applications, when the capacitor number for including in capacitor array is more, if the second of 1025 groups of oscillators of test Output bias value may spend the more testing time.To reduce the testing time, several numerical value can be chosen, only to test The second output bias value of oscillator frequency of oscillation when the capacitor number of closure is the numerical value chosen.
For example, choose 0,1,2,4,8,16,32,64,128,256,512,513,514,516,520,528,544,576, 640,768, the 1023 capacitor number as the closure in capacitor array is above-mentioned 21 to test the capacitor number of closure respectively Corresponding second output bias value when numerical value.
Table 1
Referring to table 1, the capacitor number of the closure in one embodiment of the invention and the mapping table of second output bias value are given, The capacitor number for giving closure is respectively 0,1,2,4,8,16,32,64,128,256,512,513,514,516,520,528, 544,576,640,768,1023 when corresponding second output bias value.
For convenient for calculating, using the capacitor number of closure for 512 as datum mark, the capacitor number for obtaining closure respectively is opposite In the second output bias value knots modification of the capacitor number knots modification of datum mark and second output knots modification relative to datum mark.Such as, When the capacitor number of closure is 0, relative to datum mark, capacitor number knots modification is 0-512=-512, and second output bias value changes Amount is 71.22-11.93=59.29PPM.For another example, when the capacitor number of closure is 256, relative to datum mark, capacitor number changes Variable is 256-512=-256, and second output bias value knots modification is 33.97-11.93=22.04PPM.
To in table 1, the mapping of capacitor number knots modification and second output bias value knots modification is closed using Function Fitting software System is fitted, obtained fitting function are as follows:
Y=-0.00098x3+0.16092x2-14.71337x-2.03670; (1)
Wherein, x is second output bias value knots modification, and y is capacitor number knots modification.
Referring to Fig. 2, for formula (1), the corresponding curve of available formula (1).In Fig. 2, abscissa x is that second output is inclined Difference knots modification, ordinate y are capacitor number knots modification.
When the capacitor number of the closure in capacitor array is other values, the capacitor number of closure can be updated to formula (1) in, you can learn that the corresponding second output bias value knots modification of capacitor number of closure.
In an embodiment of the present invention, after getting frequency adjustment f (n), f (n) is brought into above-mentioned fitting as x In function (1), obtained y value is added with 512, obtain and value is in capacitor array corresponding to frequency adjustment f (n) The capacitor number of closure.
For example, f (n) is brought into formula (1) as x, y=1 is obtained, then is closed in the corresponding capacitor array of f (n) Capacitor number is 512+1=513.
When second frequency adjustment number of steps is integer, second frequency adjustment number of steps can be directly used to oscillation The frequency of oscillation of device is adjusted.In a particular embodiment, second frequency can be adjusted to number of steps and oscillator exports 1s arteries and veins It rushes the corresponding number of oscillation to be added, obtain and value is the corresponding number of oscillation of real-time clock compensation circuit output 1s pulse.
In embodiments of the present invention, oscillator can be piece internal oscillator, can be the outer oscillator of piece.
Step S104 adjusts number of steps according to the first frequency and is adjusted to the frequency of oscillation of the oscillator.
In embodiments of the present invention, after first frequency adjustment number of steps is calculated, that is, first frequency adjustment can be used Number of steps is adjusted the frequency of oscillation of oscillator.In embodiments of the present invention, can by first frequency adjust number of steps with Oscillator exports the corresponding number of oscillation of 1s pulse and is added, and obtain and value is real-time clock compensation circuit output 1s pulse pair The number of oscillation answered.
For example, the reference oscillating frequency of oscillator is 32768Hz namely oscillator exports the corresponding number of oscillation of 1s pulse It is 32768 times, the first frequency adjustment number of steps m being calculated1=3, then after being adjusted, the output of real-time clock compensation circuit The corresponding number of oscillation of 1s pulse is 32768+m1=32771 times.
Below by citing, the calibration method of the real-time clock compensation circuit provided in the above embodiment of the present invention is carried out Explanation.
Referring to Fig. 3, the process of the calibration method of another real-time clock compensation circuit in the embodiment of the present invention is given Figure.
Step S301, the exemplary frequency deviation values that will acquire and single step adjustment frequency values do division arithmetic.
In an embodiment of the present invention, real-time clock compensation circuit uses reference oscillating frequency for the oscillator of 32768Hz, Namely: at the every oscillation of oscillator 32768 times, real-time clock compensation circuit exports the pulse of 1 1s.
The corresponding single step adjustment frequency values of reference oscillating frequency are Δ f=(1/32768) × 106≈30.5PPM。
To enable Δ f=30.5PPM, getting exemplary frequency deviation values X convenient for calculating0Later, by X0Frequency is adjusted with single step Value Δ f is divided by, and obtained quotient is that second frequency adjusts number of steps m2, m2=X0/Δf.Work as m2When for integer, by m2With 32768 phases Add, obtain and value is that the pulse pair of real-time clock compensation circuit output 1s answers the number of oscillation of oscillator, it may be assumed that oscillator The number of oscillation is (m2+ 32768) pulse of 1s is exported when secondary.
As obtained quotient m2When for decimal, remainder n is obtained1And m2Integer part M, n1=X0% Δ f, i.e. n1For X0It is right The value that Δ f modulus obtains.
Step S302, judges n1Whether 1/2 × Δ f is greater than.
Work as n1When > 1/2 × Δ f namely n1> 15.25PPM executes step S303;Conversely, executing step S304.
Step S303 calculates first frequency and adjusts number of steps m1, m1=M+1, and by n1It is updated to n1=n1-Δf.Later, Execute step S306.
Step S304, judges n1Whether -1/2 × Δ f is less than.
Work as n1When < -1/2 × Δ f namely n1When < -15.25PPM, step S305 is executed;Conversely, working as n1≥-1/2×Δ When f, step S306 is executed.
Step S305 calculates first frequency and adjusts number of steps m1, m1=M-1, and by n1It is updated to n1=n1+Δf.Later, Execute step S306.
The corresponding number of oscillation of the every output 1s pulse of oscillator is adjusted to 32768+m by step S3061
Step S307 calculates the capacitor number being closed in capacitor array.
In an embodiment of the present invention, by updated n1It is brought into formula (1) as x, capacitor can be calculated Number knots modification y.Capacitor number knots modification y is added with 512, the capacitor number being closed in capacitor array can be obtained.
Step S308, controlling the capacitor number being closed in capacitor array is y+512.
For example, y=10, then controlling the capacitor number being closed in capacitor array is in 10+512=522 namely capacitor array Capacitor number in closed state is 522.
It is described real-time the embodiment of the invention also provides a kind of calibrating installation 40 of real-time clock compensation circuit referring to Fig. 4 Clock compensation circuit includes oscillator, and the calibrating installation 40 includes: temperature value acquiring unit 401, exemplary frequency deviation values acquisition list Member 402, exemplary frequency deviation values adjustment unit 403, computing unit 404 and frequency of oscillation adjustment unit 405, in which:
Temperature value acquiring unit 401, for obtaining the current temperature value of the real-time clock compensation circuit local environment;
Exemplary frequency deviation values acquiring unit 402, for obtaining corresponding exemplary frequency deviation values according to the current temperature value;
Exemplary frequency deviation values adjustment unit 403, for being adjusted to the exemplary frequency deviation values;
Computing unit 404, for according to exemplary frequency deviation values adjusted calculate first frequency adjust number of steps, described first It is integer that frequency, which adjusts number of steps,;
Frequency of oscillation adjustment unit 405, for adjusting oscillation of the number of steps to the oscillator according to the first frequency Frequency is adjusted.
In specific implementation, the computing unit 404 can be used for the frequency of oscillation according to the oscillator, calculate institute State the corresponding single step adjustment frequency values of frequency of oscillation;The exemplary frequency deviation values adjusted and the single step are adjusted into frequency values phase It removes, obtained quotient adjusts number of steps as the first frequency.
In specific implementation, the frequency of oscillation adjustment unit 405 can be used for the first frequency adjusting number of steps The number of oscillation corresponding with oscillator output 1s pulse is added, and obtain and value is mended as the real-time clock adjusted Repay the corresponding number of oscillation of circuit output 1s pulse.
In specific implementation, the exemplary frequency deviation values adjustment unit 403, can be used for by the exemplary frequency deviation values with it is described Single step adjustment frequency values are divided by, and obtain second frequency adjustment number of steps;When second frequency adjustment number of steps is non-integer, The exemplary frequency deviation values are adjusted.
It in specific implementation, may include capacitor array in the real-time clock compensation circuit, the exemplary frequency deviation values tune Whole unit 403 can be used for calculating the corresponding frequency adjustment of the exemplary frequency deviation values;It obtains corresponding to the frequency adjustment Capacitor array in need closure capacitor target number n;The capacitor number tune of closed state will be in the capacitor array Whole is n, to be adjusted to the exemplary frequency deviation values, so that the exemplary frequency deviation values are the integer that the single step adjusts frequency values Times.
In specific implementation, the frequency adjustment meets following relationship: f (n)=| X1-X0|, wherein X0Before adjustment The exemplary frequency deviation values;X1For the exemplary frequency deviation values adjusted, and X1With all single step adjustment frequency values In integral multiple numerical value, with X0Absolute difference it is minimum;F (n) is the frequency adjustment.
In specific implementation, the exemplary frequency deviation values adjusted meet following relationship: working as n1When > 1/2 × Δ f, X1= (M+1)×Δf;Work as n1When < -1/2 × Δ f, X1=(M-1) × Δ f;Wherein: n1For X0Carry out what division arithmetic obtained with Δ f Remainder, M are the integer part that the second frequency adjusts number of steps, and Δ f is that the single step adjusts frequency values.
In specific implementation, the frequency of oscillation adjustment unit 405 can be also used for adjusting stepping when the second frequency When number is integer, the second frequency adjustment number of steps number of oscillation corresponding with oscillator output 1s pulse is added, Obtain with value as the corresponding number of oscillation of real-time clock compensation circuit output 1s pulse adjusted.
In specific implementation, referring to Fig. 5, the embodiment of the invention also provides a kind of real-time clock compensation circuits, comprising: vibration The calibrating installation 502 of the real-time clock compensation circuit provided in device 501 and the above embodiment of the present invention is provided, in which:
The oscillator 501 is the oscillator for exporting built-in oscillation frequency signal.
In specific implementation, the real-time clock compensation circuit can also include: capacitor array 503;The real-time clock The calibrating installation 502 of compensation circuit can be used for calculating the corresponding frequency adjustment of the exemplary frequency deviation values;Obtain the frequency The target number n of the capacitor of closure is needed in capacitor array corresponding to adjustment amount;Closed state will be in the capacitor array Capacitor number be adjusted to n, to be adjusted to the exemplary frequency deviation values so that the exemplary frequency deviation values be the single step adjustment The integral multiple of frequency values.
It in embodiments of the present invention, may include multiple capacitors parallel with one another in capacitor array 503.Each capacitor Capacitance is equal, and there are a switches connected in series for each capacitor.It, can by the disconnection or closure of control switch It disconnects or is closed to control corresponding capacitor.It in an embodiment of the present invention, include 1024 capacitors in capacitor array 503, Accordingly, include 1024 switches in capacitor array 503, connect respectively with 1024 capacitor one-to-one correspondence.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of above-described embodiment is can It is completed with instructing relevant hardware by program, which can be stored in a computer readable storage medium, storage Medium may include: ROM, RAM, disk or CD etc..
Although present disclosure is as above, present invention is not limited to this.Anyone skilled in the art are not departing from this It in the spirit and scope of invention, can make various changes or modifications, therefore protection scope of the present invention should be with claim institute Subject to the range of restriction.

Claims (11)

1. a kind of calibration method of real-time clock compensation circuit, which is characterized in that the real-time clock compensation circuit includes oscillation Device and capacitor array, the calibration method include:
Obtain the current temperature value of the real-time clock compensation circuit local environment;
Corresponding exemplary frequency deviation values are obtained according to the current temperature value;
The exemplary frequency deviation values are adjusted, and calculates first frequency according to exemplary frequency deviation values adjusted and adjusts number of steps, It include: that the corresponding single step adjustment frequency values of the frequency of oscillation are calculated according to the frequency of oscillation of the oscillator;By the adjustment Exemplary frequency deviation values afterwards are divided by with single step adjustment frequency values, and obtained quotient adjusts number of steps as the first frequency; The first frequency adjustment number of steps is integer;
It adjusts number of steps according to the first frequency to be adjusted the frequency of oscillation of the oscillator, comprising: by the frequency Deviation is divided by with single step adjustment frequency values, obtains second frequency adjustment number of steps;When the second frequency adjusts stepping When number is non-integer, the corresponding frequency adjustment of the exemplary frequency deviation values is calculated;According to preset capacitor number knots modification and second The mapping relations of output bias value knots modification obtain the capacitor that closure is needed in capacitor array corresponding to the frequency adjustment Target number n;By in the capacitor array be in closed state capacitor number be adjusted to n, with to the exemplary frequency deviation values into Row adjustment, so that the exemplary frequency deviation values are the integral multiple that the single step adjusts frequency values.
2. the calibration method of real-time clock compensation circuit as described in claim 1, which is characterized in that described according to described first Frequency adjustment number of steps the frequency of oscillation of the oscillator is adjusted, comprising: by the first frequency adjustment number of steps with The oscillator exports the corresponding number of oscillation of 1s pulse and is added, and obtain and value is as the real-time clock compensation adjusted The corresponding number of oscillation of circuit output 1s pulse.
3. the calibration method of real-time clock compensation circuit as described in claim 1, which is characterized in that the frequency adjustment is full The following relationship of foot: f (n)=| X1-X0|, wherein X0For the exemplary frequency deviation values before adjustment;X1For the frequency adjusted Deviation, and X1In the integral multiple numerical value of all single step adjustment frequency values, with X0Absolute difference it is minimum;F (n) is The frequency adjustment.
4. the calibration method of real-time clock compensation circuit as claimed in claim 3, which is characterized in that the frequency adjusted Deviation meets following relationship:
Work as n1When > 1/2 × Δ f, X1=(M+1) × Δ f;
Work as n1When < -1/2 × Δ f, X1=(M-1) × Δ f;
Wherein: n1For X0The remainder that division arithmetic obtains is carried out with Δ f, M is the integer portion that the second frequency adjusts number of steps Point, Δ f is that the single step adjusts frequency values.
5. the calibration method of real-time clock compensation circuit as described in claim 1, which is characterized in that further include: when described the It is when two frequencies adjustment number of steps is integer, second frequency adjustment number of steps is corresponding with oscillator output 1s pulse The number of oscillation is added, obtain and value as real-time clock compensation circuit output 1s pulse adjusted it is corresponding vibrate it is secondary Number.
6. a kind of calibrating installation of real-time clock compensation circuit, which is characterized in that the real-time clock compensation circuit includes oscillation Device and capacitor array, the calibrating installation include:
Temperature value acquiring unit, for obtaining the current temperature value of the real-time clock compensation circuit local environment;Frequency departure It is worth acquiring unit, for obtaining corresponding exemplary frequency deviation values according to the current temperature value;
Exemplary frequency deviation values adjustment unit, for being adjusted to the exemplary frequency deviation values;
Computing unit adjusts number of steps for calculating first frequency according to exemplary frequency deviation values adjusted, comprising: according to the vibration The frequency of oscillation for swinging device calculates the corresponding single step adjustment frequency values of the frequency of oscillation;By the exemplary frequency deviation values adjusted It is divided by with single step adjustment frequency values, obtained quotient adjusts number of steps as the first frequency;The first frequency tune Whole number of steps is integer;
Frequency of oscillation adjustment unit carries out the frequency of oscillation of the oscillator for adjusting number of steps according to the first frequency Adjustment, comprising: the exemplary frequency deviation values and single step adjustment frequency values are divided by, second frequency adjustment number of steps is obtained;When When the second frequency adjustment number of steps is non-integer, the corresponding frequency adjustment of the exemplary frequency deviation values is calculated;According to default Capacitor number knots modification and second output bias value knots modification mapping relations, obtain capacitor corresponding to the frequency adjustment The target number n of the capacitor of closure is needed in array;The capacitor number that closed state is in the capacitor array is adjusted to n, To be adjusted to the exemplary frequency deviation values, so that the exemplary frequency deviation values are the integral multiple that the single step adjusts frequency values.
7. the calibrating installation of real-time clock compensation circuit as claimed in claim 6, which is characterized in that the frequency of oscillation adjustment Unit is obtained for the first frequency adjustment number of steps number of oscillation corresponding with oscillator output 1s pulse to be added Arrive with value as the corresponding number of oscillation of real-time clock compensation circuit output 1s pulse adjusted.
8. the calibrating installation of real-time clock compensation circuit as claimed in claim 6, which is characterized in that the frequency adjustment is full The following relationship of foot: f (n)=| X1-X0|, wherein X0For the exemplary frequency deviation values before adjustment;X1For the frequency adjusted Deviation, and X1In the integral multiple numerical value of all single step adjustment frequency values, with X0Absolute difference it is minimum;F (n) is The frequency adjustment.
9. the calibrating installation of real-time clock compensation circuit as claimed in claim 8, which is characterized in that the frequency adjusted Deviation meets following relationship:
Work as n1When > 1/2 × Δ f, X1=(M+1) × Δ f;
Work as n1When < -1/2 × Δ f, X1=(M-1) × Δ f;
Wherein: n1For X0The remainder that division arithmetic obtains is carried out with Δ f, M is the integer portion that the second frequency adjusts number of steps Point, Δ f is that the single step adjusts frequency values.
10. the calibrating installation of real-time clock compensation circuit as claimed in claim 6, which is characterized in that the frequency of oscillation tune Whole unit, be also used to when the second frequency adjust number of steps be integer when, by the second frequency adjustment number of steps with it is described Oscillator exports the corresponding number of oscillation of 1s pulse and is added, and obtain and value is used as the real-time clock compensation circuit adjusted Export the corresponding number of oscillation of 1s pulse.
11. a kind of real-time clock compensation circuit characterized by comprising oscillator, and such as any one of claim 6-10 institute The calibrating installation for the real-time clock compensation circuit stated, in which:
The oscillator, for exporting the oscillator signal of built-in oscillation frequency.
CN201610655911.7A 2016-08-11 2016-08-11 Real-time clock compensation circuit and calibration method, device Active CN106292839B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610655911.7A CN106292839B (en) 2016-08-11 2016-08-11 Real-time clock compensation circuit and calibration method, device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610655911.7A CN106292839B (en) 2016-08-11 2016-08-11 Real-time clock compensation circuit and calibration method, device

Publications (2)

Publication Number Publication Date
CN106292839A CN106292839A (en) 2017-01-04
CN106292839B true CN106292839B (en) 2019-05-31

Family

ID=57669402

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610655911.7A Active CN106292839B (en) 2016-08-11 2016-08-11 Real-time clock compensation circuit and calibration method, device

Country Status (1)

Country Link
CN (1) CN106292839B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111045317A (en) * 2019-12-26 2020-04-21 展讯通信(上海)有限公司 Calibration method, device and system of equipment clock, self-calibration method and equipment

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107272821B (en) * 2017-06-07 2020-02-21 上海东软载波微电子有限公司 Real-time clock calibration method and device, storage medium and electronic equipment
CN107612635B (en) * 2017-08-15 2018-10-19 维沃移动通信有限公司 A kind of calibration method, mobile terminal and computer readable storage medium
CN108259036B (en) * 2018-01-09 2021-09-28 上海顺久电子科技有限公司 VCO, frequency calibration method thereof, electronic device, and computer storage medium
CN109597297B (en) * 2018-12-11 2020-09-08 烟台持久钟表有限公司 Crystal oscillator compensation method and device
CN110311673B (en) * 2019-06-24 2024-02-02 Oppo广东移动通信有限公司 Frequency calibration method, terminal and storage medium
CN110289812A (en) * 2019-06-28 2019-09-27 Oppo广东移动通信有限公司 Method, apparatus, electronic equipment and the storage medium of crystal oscillator frequency compensation
CN111665431B (en) * 2020-04-26 2023-07-25 江西联智集成电路有限公司 Method, device, equipment and medium for calibrating clock source in chip

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102141771A (en) * 2011-03-08 2011-08-03 无锡辐导微电子有限公司 Frequency correction method and device
CN102624331A (en) * 2012-04-01 2012-08-01 钜泉光电科技(上海)股份有限公司 Temperature-compensation circuit and temperature-compensation method of real-time clock
CN103116385A (en) * 2013-03-01 2013-05-22 华为技术有限公司 Correcting circuit and real-time clock circuit
CN103297116A (en) * 2012-03-01 2013-09-11 联发科技股份有限公司 Method for performing real time clock calibration, and associated apparatus
US8901983B1 (en) * 2013-09-30 2014-12-02 Micro Crystal Ag Temperature compensated timing signal generator
CN104518758A (en) * 2013-09-30 2015-04-15 微晶公司 Temperature compensated timing signal generator

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102141771A (en) * 2011-03-08 2011-08-03 无锡辐导微电子有限公司 Frequency correction method and device
CN103297116A (en) * 2012-03-01 2013-09-11 联发科技股份有限公司 Method for performing real time clock calibration, and associated apparatus
CN102624331A (en) * 2012-04-01 2012-08-01 钜泉光电科技(上海)股份有限公司 Temperature-compensation circuit and temperature-compensation method of real-time clock
CN103116385A (en) * 2013-03-01 2013-05-22 华为技术有限公司 Correcting circuit and real-time clock circuit
US8901983B1 (en) * 2013-09-30 2014-12-02 Micro Crystal Ag Temperature compensated timing signal generator
CN104518758A (en) * 2013-09-30 2015-04-15 微晶公司 Temperature compensated timing signal generator

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111045317A (en) * 2019-12-26 2020-04-21 展讯通信(上海)有限公司 Calibration method, device and system of equipment clock, self-calibration method and equipment
CN111045317B (en) * 2019-12-26 2022-02-25 展讯通信(上海)有限公司 Calibration method, device and system of equipment clock, self-calibration method and equipment

Also Published As

Publication number Publication date
CN106292839A (en) 2017-01-04

Similar Documents

Publication Publication Date Title
CN106292839B (en) Real-time clock compensation circuit and calibration method, device
US8237482B2 (en) Circuit and method for generating a clock signal
CN106569544B (en) Real-time timepiece chip and its clock correcting method, device
CN100456858C (en) Time error compensation device and method for terminal
CN103176400B (en) Intelligent ammeter clock calibration method
CN106505996B (en) A kind of RTC chip high-precision frequency bias compensation method of combination variable capacitance
CN108063617A (en) The clock frequency calibration method and system of a kind of low frequency RC oscillators
CN105573106B (en) To the amendment circuit and its method of RTC accuracy of timekeeping in a kind of intelligent electric meter
CN103970008B (en) Timekeeping method based on crystal oscillator error compensation
KR20110027639A (en) Automatic synchronization of an internal oscillator to an external frequency reference
CN106054580B (en) The second signal calibration method of clock chip
CN107272821A (en) Calibration method of real-time clock and device, storage medium, electronic equipment
CN104937504B (en) The punctual method of quartz watch high accuracy
CN103904998B (en) Method and device for adjusting frequency of mobile terminal
CN105978555A (en) Real-time clock timing precision correction circuit and method with temperature compensation function
CN105763159A (en) Method and device for adjusting frequency offset of mobile terminal
CN107315338A (en) A kind of chronometer time correcting device
CN110262210A (en) Crystal oscillator based on counter is kept time method
KR101795199B1 (en) Signal processing device
CN103501178A (en) High-stability time base oscillator automatic calibration circuit and method
CN103472713A (en) Time correction system of clock
CN107733369A (en) Temperature compensating crystal oscillator
KR20200034613A (en) Method for adjusting the mean frequency of a time base incorporated in an electronic watch
CN114740260A (en) Special synchronous acquisition method for detecting and adjusting crystal oscillator output frequency in real time
CN109617528A (en) It is a kind of for correcting the method and its system of active oscillator frequency

Legal Events

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