CN104682952B - A kind of clock compensation method suitable for SOC schemes - Google Patents
A kind of clock compensation method suitable for SOC schemes Download PDFInfo
- Publication number
- CN104682952B CN104682952B CN201510072309.6A CN201510072309A CN104682952B CN 104682952 B CN104682952 B CN 104682952B CN 201510072309 A CN201510072309 A CN 201510072309A CN 104682952 B CN104682952 B CN 104682952B
- Authority
- CN
- China
- Prior art keywords
- temperature
- offset1
- clock
- compensation
- thermo
- 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
Links
Landscapes
- Oscillators With Electromechanical Resonators (AREA)
Abstract
The present invention relates to the clock compensation method suitable for SOC schemes.Purpose is to provide a kind of clock compensation method suitable for SOC schemes, ensures compensation precision, reduces cost.Scheme:Temperature sampling is carried out using thermo-sensitive resistor, the voltage at its both ends is obtained and is AD converted, obtain the corresponding ADC values of thermo-sensitive resistor both end voltage at each temperature;Temperature compensation value is write to the calibration register of microcontroller, makes the error of time of day of crystal oscillator within ± 0.04s/d, obtains ADC values at each temperature and the correspondence of temperature compensation value;By Offset=Intercept+B1*x1+B2*x2+B3*x3+B4*x4+B5*x5+B6*x6Result of calculation add crystal oscillator transition temperature under temperature compensation value, final offset is calculated as median;By in the calibration register of final offset write-in microcontroller, clock skew compensation is carried out.The present invention is used for clock compensation.
Description
Technical field
The electrical characteristic research of Investigation on frequency characteristics, thermo-sensitive resistor the present invention relates to quartz resonator, the wide temperature of crystal
The frequency of scope corrects field, and particularly one kind is based on microcontroller (Micro-Controller-Unit) on piece RTC (Real-
Time-Clock) the clock compensation method of module.
Background technology
With the development of science and technology, the progress of chip design and manufacturing technology, the application of high-performance LSI
As mainstream, traditional discrete special chip scheme is gradually substituted by system-on-chip (SOC, System-On-Chip) scheme,
And advanced SOC schemes can not only make the speed of service and electromagnetic compatibility that electronic product reduces power consumption, reduces volume, meets higher
Performance, and the Material Cost of product can be greatly reduced, improve product competitiveness in the market.
The content of the invention
The technical problem to be solved in the present invention is:A kind of clock compensation method suitable for SOC schemes is provided, ensures clock
Cost is reduced while compensation precision.
The technical solution adopted in the present invention is:A kind of clock compensation method suitable for SOC schemes, it is characterised in that bag
Include:
Temperature sampling is carried out using thermo-sensitive resistor, the voltage at thermo-sensitive resistor both ends is obtained and is AD converted in real time, obtain
The corresponding ADC values of thermo-sensitive resistor both end voltage at each temperature;
Write temperature compensation value to the clocking error calibration register of microcontroller, make the error of time of day of crystal oscillator ±
Within 0.04s/d, so as to obtain ADC values at each temperature and the correspondence of temperature compensation value;
By formula Offset=Intercept+B1*x1+B2*x2+B3*x3+B4*x4+B5*x5+B6*x6Result of calculation add
Temperature compensation value under upper crystal oscillator transition temperature, as median Offset1;When the median is positive number, Offset1 is utilized
=Offset1 | 0x800 calculates final offset;When the median is negative, Offset1=((256+ are utilized
Offset1) ∣ 0x100) ∣ 0x8000 calculate final offset;Then the final offset write-in microcontroller of gained will be calculated
In clocking error calibration register, clock skew compensation is carried out,
In formula, Intercept=-355.97, B1=3.3901, B2=-0.0143, B3=3.3920E-5, B4=-
4.6460E-8, B5=3.3898E-11, B6=-1.0266E-14, x are ADC values.
Beneficial effect of the present invention is:1st, using thermo-sensitive resistor carry out temperature sampling, than the prior art used by temperature
Sensor is spent, cost is lower.2nd, after being compensated using the method for the present invention, temperature model of the crystal oscillator error of time of day at -40 DEG C to 60 DEG C
Enclose it is interior control within ± 0.3s/d (3.47ppm), be entirely capable of meeting relevant criterion required precision and batch production will
Ask.
Brief description of the drawings
Fig. 1 is the circuit diagram of clock system of the present invention.
Fig. 2 is the curve map that 32.768kHz crystal precision of the present invention varies with temperature.
Fig. 3 is thermo-sensitive resistor of the present invention and the graph of relation of temperature.
Fig. 4 is matched curve figure of the thermo-sensitive resistor resistance value of the present invention on temperature.
Fig. 5 is ADC values of the present invention and temperature compensation value data profile.
Fig. 6 is 6 order polynomial matched curve figure of temperature compensation curve of the present invention.
Embodiment
As shown in Figure 1, the present embodiment clock system includes, Renesas's R7F0C004M2DFB intelligent electric energy meters are special micro-
Controller, Seiko wrist-watch crystal oscillator (32.768kHz), the JYTF05-103F3I types NTC of Shenzhen Jinyang Electronic Co., Ltd. are temperature sensitive
Resistance.
Microcontroller clock accuracy compensation function, to correct the frequency shift (FS) of crystal oscillator, its adjustable model
It is -274.6ppm to+212.6ppm to enclose, and max quantization error is ± 0.48ppm, minimum resolution 0.96ppm, completely can be with
Meet frequency shifted calibration of the crystal in the range of total temperature.
Digital circuit is required to clock source to drive at work, and Real Time Clock System is also in this way, accurate clock source
It is the basic guarantee of clock system accurate timing.But typical 32.768kHz tuning fork crystals can not carry in wide temperature range
For degree of precision, parabolically (as shown in Figure 2), (+25 DEG C) precision is typical at room temperature for frequency deviation size in whole temperature range
It is worth for ± 20ppm, in high temperature and low-temperature region deterioration in accuracy, precision can be less than 150ppm (representative value).Crystal is inclined as shown in Figure 2
The relation of poor size and temperature can be represented with following quadratic function:Δ Err=K (T-T0)2+ΔE0, wherein Δ Err is crystal
Deviation size (ppm), K are buckling constant, and T is temperature, T0For transition temperature, Δ E0For the crystal deviation under transition temperature.
Shown in the graph of a relation 3 of thermo-sensitive resistor resistance value size and temperature, which is located at Y for inverse proportion function R=K/ (T+a)
Positive one of axis, there is a good monotonicity, and R is resistance value size in formula, and T is corresponding temperature, and K is proportionality coefficient, and a is curve
Offset in X-axis.
In order to better meet the calculated performance of microcontroller, the present embodiment uses the polynomial algorithm of product, will be temperature sensitive
The representative value of resistance at each temperature does curve matching, as shown in figure 4, its polynomial equation R=Intercept+B1*x1+B2*x2+
B3*x3+B4*x4, wherein, Intercept=-26726.5268, B1=-1081.9808, B2=43.5242, B3=-
1.2093 B4=0.0114;In summary, thermo-sensitive resistor has specific resistance value at specific temperature, by bleeder circuit with
A/D is changed, and has specific ADC values;And at a certain temperature, the frequency deviation of crystal oscillator is also certain, it is possible thereby to use temperature sensitive electricity
The corresponding ADC values of pressure drop carry out representative of ambient temperature in resistance, and microcontroller provides accurate offset further according to embedded algorithm, this is just
It is the basic compensation principle of the present invention.
The present embodiment clock compensation method, including:
1) temperature sampling is carried out using thermo-sensitive resistor, obtains the voltage at thermo-sensitive resistor both ends and be AD converted in real time, obtain
To the corresponding ADC values of thermo-sensitive resistor both end voltage at each temperature.In this example, internal A/D modular converters voltage reference is system electricity
Source voltage VCC, it is identical with thermo-sensitive resistor sample circuit supply voltage, therefore thermo-sensitive resistor both end voltage size passes through at identical temperature
Value after AD conversion does not change with the change of supply voltage VCC, this is also the circuit (5V power supplys electricity under the state of working on power
Pressure) and power-down state under (3.6V supply voltages) the reason for working normally, and circuit energy adaptive power supply fluctuation with
The basic principle of power supply switching.
2) write temperature compensation value to the clocking error calibration register of microcontroller, make the error of time of day of crystal oscillator ±
Within 0.04s/d, so as to obtain ADC values at each temperature and the correspondence of temperature compensation value.Specifically, from 50 model machines with
Machine extracts 5 and is used as sample, and -40 DEG C to 65 DEG C of raw compensation data are obtained for step value with 5 DEG C, and it is micro- to manually adjust write-in
Controller clock calibrates for error the offset data of register, make the error of time of day of each temperature spot ± 0.04s/d with
It is interior, 1 data of table can be obtained.
The ADC values of table 1 at each temperature and compensation Value Data
3rd, by formula Offset=Intercept+B1*x1+B2*x2+B3*x3+B4*x4+B5*x5+B6*x6(in formula,
Intercept=-355.97, B1=3.3901, B2=-0.0143, B3=3.3920E-5, B4=-4.6460E-8, B5=
3.3898E-11, B6=-1.0266E-14, x are ADC values) result of calculation add crystal oscillator transition temperature under temperature compensation value,
As median Offset1;When the median is positive number, Offset1=Offset1 is utilized | 0x800 calculates final compensation
Value;When the median is negative, using Offset1=, ((256+Offset1) ∣ 0x100) ∣ 0x8000 calculate final compensation
Value;Then the final offset of gained will be calculated to write in the clocking error calibration register of microcontroller, using microcontroller certainly
The clock compensation function of band carries out clock skew compensation.
In this example, formula Offset=Intercept+B1*x1+B2*x2+B3*x3+B4*x4+B5*x5+B6*x6Derivation
Process is:
Based on 1 data of table, 20 DEG C are used as transition temperature, and the offset of other temperature spots is subtracted under transition temperature
Offset, eliminates each crystal Δ E0The inconsistent influence brought, and 16 binary datas are converted into the decimal system, obtain table 2
As a result, wherein various kinds table is followed successively by the offset of 20 degrees Celsius of transition temperature:32、30、31、31、32.
The data processed at each temperature of table 2
Data in table 2 are placed in using temperature as abscissa, using ADC values in the same coordinate system of ordinate, to obtain Fig. 5
Shown ADC values and temperature compensation value data profile.It can be seen from the figure that each sample data has good uniformity, completely
The correspondence of its ADC value and offset can be described with formula.Fig. 5 is done 6 order polynomials with OriginLab softwares to intend
Close, obtain the order polynomial matched curve of temperature compensation curve 6 shown in Fig. 6, expression formula Offset=Intercept+B1*x1+B2*
x2+B3*x3+B4*x4+B5*x5+B6*x6;Intercept=-355.97 in formula, B1=3.3901, B2=-0.0143, B3=
3.3920E-5, B4=-4.6460E-8, B5=3.3898E-11, B6=-1.0266E-14, x are ADC values.
The length of the clocking error calibration register of microcontroller is 2 bytes, and highest order is enable bit, and the 9th is symbol
Number position, when median Offset1 is negative, character position 1, takes the complement code of its low byte.So when median Offset1 is
During positive number, Offset1=Offset1 is utilized | 0x800 calculates final offset;And when the median is negative, utilize
((256+Offset) ∣ 0x100) ∣ 0x8000 calculate final offset to Offset=;The write-in of final offset is accordingly posted again
Storage SUBCUD, you can completion accurately compensates clock jitter.
The random sample for separately taking 5 model machines as verification, the effect after being compensated using the method for the present invention are as follows:
3 algorithm compensation compliance test result data of table
It can be seen that from 3 data of table, because the otherness of the device such as crystal oscillator, thermo-sensitive resistor, 5 after the method for the present invention compensates
The error of time of day of sample table is controlled within the temperature range of -40 DEG C to 60 DEG C within ± 0.3s/d (3.47ppm), is entirely capable of
Meet the requirement of required precision and the batch production of relevant criterion.
Claims (1)
- A kind of 1. clock compensation method suitable for SOC schemes, it is characterised in that including:Temperature sampling is carried out using thermo-sensitive resistor, the voltage at thermo-sensitive resistor both ends is obtained and is AD converted in real time, obtain each temperature The corresponding ADC values of the lower thermo-sensitive resistor both end voltage of degree;Temperature compensation value is write to the clocking error calibration register of microcontroller, makes the error of time of day of crystal oscillator in ± 0.04s/ Within d, so as to obtain ADC values at each temperature and the correspondence of temperature compensation value;By formula Offset=Intercept+B1*x1+B2*x2+B3*x3+B4*x4+B5*x5+B6*x6Result of calculation plus crystalline substance The temperature compensation value to shake under transition temperature, as median Offset1;When the median is positive number, Offset1=is utilized Offset1 | 0x800 calculates final offset;When the median is negative, Offset1=((256+Offset1) ∣ are utilized 0x100) ∣ 0x8000 calculate final offset;Then the clocking error of the final offset write-in microcontroller of gained will be calculated In calibration register, clock skew compensation is carried out,In formula, Intercept=-355.97, B1=3.3901, B2=-0.0143, B3=3.3920E-5, B4=- 4.6460E-8, B5=3.3898E-11, B6=-1.0266E-14, x are ADC values.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510072309.6A CN104682952B (en) | 2015-02-11 | 2015-02-11 | A kind of clock compensation method suitable for SOC schemes |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510072309.6A CN104682952B (en) | 2015-02-11 | 2015-02-11 | A kind of clock compensation method suitable for SOC schemes |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104682952A CN104682952A (en) | 2015-06-03 |
CN104682952B true CN104682952B (en) | 2018-05-15 |
Family
ID=53317608
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510072309.6A Active CN104682952B (en) | 2015-02-11 | 2015-02-11 | A kind of clock compensation method suitable for SOC schemes |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104682952B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103248358A (en) * | 2013-05-30 | 2013-08-14 | 上海贝岭股份有限公司 | Real-time clock compensating device and method |
CN103499803A (en) * | 2013-09-09 | 2014-01-08 | 扬州市万泰电器厂有限公司 | Method for improving precision of built-in real-time clock of electric energy meter MCU |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6850125B2 (en) * | 2001-08-15 | 2005-02-01 | Gallitzin Allegheny Llc | Systems and methods for self-calibration |
US20140004887A1 (en) * | 2012-06-29 | 2014-01-02 | Qualcomm Incorporated | Crystal oscillator calibration |
-
2015
- 2015-02-11 CN CN201510072309.6A patent/CN104682952B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103248358A (en) * | 2013-05-30 | 2013-08-14 | 上海贝岭股份有限公司 | Real-time clock compensating device and method |
CN103499803A (en) * | 2013-09-09 | 2014-01-08 | 扬州市万泰电器厂有限公司 | Method for improving precision of built-in real-time clock of electric energy meter MCU |
Also Published As
Publication number | Publication date |
---|---|
CN104682952A (en) | 2015-06-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106505996B (en) | A kind of RTC chip high-precision frequency bias compensation method of combination variable capacitance | |
CN102435975B (en) | Clock calibration method of intelligent cost control electric energy meter | |
CN103176400B (en) | Intelligent ammeter clock calibration method | |
JP5965223B2 (en) | Clock correction circuit and clock correction method | |
CN107465393B (en) | System and method for frequency compensation of real time clock system | |
CN101452307B (en) | System and method of calibrating real time clock | |
CN103219994A (en) | Method and apparatus of calibrating mismatch of TDC | |
Schmid et al. | Exploiting manufacturing variations for compensating environment-induced clock drift in time synchronization | |
JP2014092841A (en) | Semiconductor device, clock correction method | |
CN202818228U (en) | High-precision digital temperature compensation type crystal oscillator | |
CN116106605A (en) | Electric energy meter parameter compensation method, medium and system considering temperature change | |
CN104122936A (en) | MCU chip frequency division clock correcting device and method | |
CN104145227A (en) | System and method for oscillator frequency control | |
CN203299557U (en) | Real-time clock compensation device | |
CN106933300A (en) | Real-time clock temperature drift correction circuit | |
CN116192125B (en) | Method and device for correcting DTC delay stepping based on stepping LDO | |
CN104682952B (en) | A kind of clock compensation method suitable for SOC schemes | |
CN107525968A (en) | A kind of frequency measuring system based on VCXO | |
CN102916654A (en) | Crystal oscillator ageing compensation method | |
CN103336754B (en) | A kind of USB is from the system clock automated calibration system of equipment and method | |
CN103439876B (en) | Method for calibrating clocks of electric energy meter | |
CN104135232B (en) | A kind of crystal oscillator and frequency search method | |
CN203492007U (en) | High-precision ring oscillator and frequency calibration circuit thereof | |
CN106612104B (en) | Real-time clock error compensation device and method | |
CN102571035B (en) | For generation of circuit and the method for clock signal |
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 |