CN104682952A - Clock compensation method suitable for SOC (system-on-chip) scheme - Google Patents
Clock compensation method suitable for SOC (system-on-chip) scheme Download PDFInfo
- Publication number
- CN104682952A CN104682952A CN201510072309.6A CN201510072309A CN104682952A CN 104682952 A CN104682952 A CN 104682952A CN 201510072309 A CN201510072309 A CN 201510072309A CN 104682952 A CN104682952 A CN 104682952A
- Authority
- CN
- China
- Prior art keywords
- temperature
- compensation
- clock
- value
- sensitive resistor
- 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.)
- Granted
Links
Landscapes
- Oscillators With Electromechanical Resonators (AREA)
Abstract
The invention relates to a clock compensation method suitable for an SOC (system-on-chip) scheme. The invention aims to provide the clock compensation method which is suitable for the SOC scheme, the compensation precision is guaranteed, and the cost is lowered. The scheme of the clock compensation method comprises the following steps: adopting a temperature-sensitive resistor to perform temperature sampling, acquiring voltage of both ends of the temperature-sensitive resistor, and performing AD conversion so as to obtain ADC values corresponding to the voltage of both ends of the temperature-sensitive resistor under different temperatures; writing a temperature compensation value in a calibration register of a microcontroller, so that the daily timing error of an crystal oscillator is within +/- 0.04s/d, and obtaining the corresponding relation of the obtained ADC values under different temperatures and the temperature compensation value; adding the calculation result of Offset=Intercept+B1*x1+B2*x2+B3*x3+B4*x4+B5*x5+B6*x6 and the temperature compensation value of the crystal oscillator under the transition temperature, and using the result as a middle value to calculate the final compensation value; writing the final compensation value in the calibration register of the microcontroller, and performing clock offset compensation. The clock compensation method disclosed by the invention is used for clock compensation.
Description
Technical field
The present invention relates to the Investigation on frequency characteristics of quartz resonator, the electrical characteristic research of thermo-sensitive resistor, the frequency correction field of crystal wide temperature range, particularly a kind of clock compensation method based on RTC (Real-Time-Clock) module on microcontroller (Micro-Controller-Unit) sheet.
Background technology
Along with the development of science and technology, the progress of chip design manufacturing technology, the application of high-performance LSI becomes main flow, traditional discrete special chip scheme is gradually by SOC (system on a chip) (SOC, System-On-Chip) scheme replaced, and the SOC scheme of advanced person can not only make electronic product reduce power consumption, reduces volume, meet the higher speed of service and Electro Magnetic Compatibility, and significantly can reduce the Material Cost of product, improve product competitiveness in the market.
Summary of the invention
The technical problem to be solved in the present invention is: provide a kind of clock compensation method being applicable to SOC scheme, reduces costs while ensureing clock compensation precision.
The technical solution adopted in the present invention is: a kind of clock compensation method being applicable to SOC scheme, comprising:
Adopt thermo-sensitive resistor to carry out temperature sampling, obtain the voltage at thermo-sensitive resistor two ends and carry out AD conversion in real time, obtaining the ADC value that thermo-sensitive resistor both end voltage is at each temperature corresponding;
To the clocking error calibration register write temperature compensation value of microcontroller, make the error of time of day of crystal oscillator within ± 0.04s/d, thus obtain the corresponding relation of ADC value and temperature compensation value at each temperature;
By formula Offset=Intercept+B1*x
1+ B2*x
2+ B3*x
3+ B4*x
4+ B5*x
5+ B6*x
6result of calculation add temperature compensation value under crystal oscillator transition temperature, as median Offset1; When this median is positive number, Offset1 ∣=0x800 is utilized to calculate final offset; When this median is negative, ((256+Offset1) ∣ 0x100) ∣ 0x8000 calculates final offset to utilize Offset1=; Then will calculate in the clocking error calibration register of gained final offset write microcontroller, the clock compensation function utilizing microcontroller to carry carries out clock skew compensation,
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 value.
Beneficial effect of the present invention is: 1, adopt thermo-sensitive resistor to carry out temperature sampling, temperature sensor adopted compared to prior art, cost is lower.2, after adopting the inventive method to compensate, crystal oscillator error of time of day all controls, within ± 0.3s/d (3.47ppm), can meet the required precision of relevant criterion and the requirement of batch production completely in the temperature range of-40 DEG C to 60 DEG C.
Accompanying drawing explanation
Fig. 1 is the circuit diagram of clock system of the present invention.
Fig. 2 is the temperature variant curve chart of 32.768kHz crystal precision of the present invention.
Fig. 3 is the graph of relation of thermo-sensitive resistor of the present invention and temperature.
Fig. 4 is the matched curve figure of thermo-sensitive resistor resistance of the present invention about temperature.
Fig. 5 is ADC value of the present invention and temperature compensation value data profile.
Fig. 6 is temperature compensation curve 6 order polynomial matched curve figure of the present invention.
Embodiment
As shown in Figure 1, the present embodiment clock system comprises, the JYTF05-103F3I type NTC thermo-sensitive resistor of the special microcontroller of Renesas's R7F0C004M2DFB intelligent electric energy meter, Seiko wrist-watch crystal oscillator (32.768kHz), Shenzhen Jinyang Electronic Co., Ltd..
Microcontroller clock accuracy compensation function, in order to revise the frequency shift (FS) of crystal oscillator, its adjustable scope is-274.6ppm to+212.6ppm, max quantization error is ± 0.48ppm, minimum resolution is 0.96ppm, can meet the frequency shifted calibration of crystal within the scope of total temperature completely.
Digital circuit operationally all needs clock source to drive, and Real Time Clock System is also like this, and accurate clock source is the basic guarantee of clock system accurate timing.But typical 32.768kHz tuning fork crystal can not provide degree of precision in wide temperature range, in whole temperature range, frequency deviation size parabolically (as shown in Figure 2), under room temperature, (+25 DEG C) precision representative value is ± 20ppm, in high temperature and low-temperature region deterioration in accuracy, precision can lower than 150ppm (representative value).The relation of crystal deviation size and temperature can represent with following quadratic function as shown in Figure 2: Δ Err=K (T-T
0)
2+ Δ E
0, wherein Δ Err is crystal deviation size (ppm), and K is buckling constant, and T is temperature, T
0for transition temperature, Δ E
0for the crystal deviation under transition temperature.
Shown in the graph of a relation 3 of thermo-sensitive resistor resistance size and temperature, this curve is one that inverse proportion function R=K/ (T+a) is positioned at Y-axis forward, has good monotonicity, in formula, R is resistance size, T is corresponding temperature, and K is proportionality coefficient, and a is the skew of curve in X-axis.
In order to better meet the calculated performance of microcontroller, the present embodiment adopts the polynomial algorithm of product, and thermo-sensitive resistor representative value is at each temperature done curve, as shown in Figure 4, and its polynomial equation R=Intercept+B1*x
1+ B2*x
2+ B3*x
3+ B4*x
4, wherein, Intercept=-26726.5268, B1=-1081.9808, B2=43.5242, B3=-1.2093, B4=0.0114; In summary, at specific temperature, thermo-sensitive resistor has specific resistance value, is changed by bleeder circuit and A/D, has specific ADC value; And at a certain temperature, the frequency deviation of crystal oscillator is also certain, can carry out representative of ambient temperature by the ADC value that pressure drop on thermo-sensitive resistor is corresponding thus, microcontroller provides offset accurately according to embedded algorithm again, and this is basic compensation principle of the present invention.
The present embodiment clock compensation method, comprising:
1) adopt thermo-sensitive resistor to carry out temperature sampling, obtain the voltage at thermo-sensitive resistor two ends and carry out AD conversion in real time, obtaining the ADC value that thermo-sensitive resistor both end voltage is at each temperature corresponding.In this example, inner A/D modular converter voltage reference is system power source voltage VCC, identical with thermo-sensitive resistor sample circuit supply voltage, therefore at identical temperature, the value of thermo-sensitive resistor both end voltage size after AD conversion does not change with the change of supply voltage VCC, this is also this circuit reason that under (5V supply voltage) and power-down state, (3.6V supply voltage) all can normally work under the state of working on power, and is also the general principle of the fluctuation of this circuit energy adaptive power supply and electrical source exchange.
2) to the clocking error calibration register write temperature compensation value of microcontroller, make the error of time of day of crystal oscillator within ± 0.04s/d, thus obtain the corresponding relation of ADC value and temperature compensation value at each temperature.Be specially, 5 are randomly drawed as sample from 50 model machines, with 5 DEG C for step value obtains the raw compensation data of-40 DEG C to 65 DEG C, manual adjustment write microcontroller clock calibrates for error the offset data of register, make each temperature spot error of time of day within ± 0.04s/d, can table 1 data.
Table 1 ADC value at each temperature and offset data
3, by formula Offset=Intercept+B1*x
1+ B2*x
2+ B3*x
3+ B4*x
4+ B5*x
5+ B6*x
6(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 value) result of calculation add temperature compensation value under crystal oscillator transition temperature, as median Offset1; When this median is positive number, Offset1 ∣=0x800 is utilized to calculate final offset; When this median is negative, ((256+Offset1) ∣ 0x100) ∣ 0x8000 calculates final offset to utilize Offset1=; Then will calculate in the clocking error calibration register of gained final offset write microcontroller, the clock compensation function utilizing microcontroller to carry carries out clock skew compensation.
In this example, formula Offset=Intercept+B1*x
1+ B2*x
2+ B3*x
3+ B4*x
4+ B5*x
5+ B6*x
6derivation be:
Based on table 1 data, the offset of other temperature spots, as transition temperature, is deducted the offset under transition temperature by 20 DEG C, eliminates each crystal Δ E
0the inconsistent impact brought, and 16 binary data are converted to the decimal system, obtain the result of table 2, wherein various kinds table is followed successively by the offset of transition temperature 20 degrees Celsius: 32,30,31,31,32.
The data that table 2 processed at each temperature
Data in table 2 being placed in temperature is abscissa, in the same coordinate system being ordinate, obtains the value of ADC shown in Fig. 5 and temperature compensation value data profile with ADC value.As can be seen from the figure, each sample data has good consistency, can describe the corresponding relation of its ADC value and offset completely with formula.Fig. 5 OriginLab software is done 6 order polynomial matchings, and obtain the matched curve of the order polynomial of temperature compensation curve 6 shown in Fig. 6, expression formula is Offset=Intercept+B1*x
1+ B2*x
2+ B3*x
3+ B4*x
4+ B5*x
5+ B6*x
6; 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 value.
The length of the clocking error calibration register of microcontroller is 2 bytes, and highest order is enable bit, and the 9th is sign bit, and when median Offset1 is negative, character position 1, gets the complement code of its low byte.So when median Offset1 is positive number, Offset1 ∣=0x8000 is utilized to calculate final offset; And when this median is negative, ((256+Offset) ∣ 0x100) ∣ 0x8000 calculates final offset to utilize Offset=; Again by final offset write corresponding registers SUBCUD, can complete and clock jitter is compensated accurately.
Separately get the sample of 5 model machines as checking at random, the effect after adopting the inventive method to compensate is as follows:
Table 3 algorithm compensation compliance test result data
Can find out from table 3 data, because the otherness of the device such as crystal oscillator, thermo-sensitive resistor, after the inventive method compensates, the error of time of day of 5 sample tables all controls, within ± 0.3s/d (3.47ppm), can meet the required precision of relevant criterion and the requirement of batch production completely in the temperature range of-40 DEG C to 60 DEG C.
Claims (1)
1. be applicable to a clock compensation method for SOC scheme, it is characterized in that comprising:
Adopt thermo-sensitive resistor to carry out temperature sampling, obtain the voltage at thermo-sensitive resistor two ends and carry out AD conversion in real time, obtaining the ADC value that thermo-sensitive resistor both end voltage is at each temperature corresponding;
To the clocking error calibration register write temperature compensation value of microcontroller, make the error of time of day of crystal oscillator within ± 0.04s/d, thus obtain the corresponding relation of ADC value and temperature compensation value at each temperature;
By formula Offset=Intercept+B1*x
1+ B2*x
2+ B3*x
3+ B4*x
4+ B5*x
5+ B6*x
6result of calculation add temperature compensation value under crystal oscillator transition temperature, as median Offset1; When this median is positive number, Offset1 ∣=0x800 is utilized to calculate final offset; When this median is negative, ((256+Offset1) ∣ 0x100) ∣ 0x8000 calculates final offset to utilize Offset1=; Then by calculating in the clocking error calibration register of gained final offset write microcontroller, 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 value.
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 true CN104682952A (en) | 2015-06-03 |
CN104682952B 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 (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060194561A1 (en) * | 2001-08-15 | 2006-08-31 | Norman Robert D | Systems and methods for self-calibration |
CN103248358A (en) * | 2013-05-30 | 2013-08-14 | 上海贝岭股份有限公司 | Real-time clock compensating device and method |
US20140004887A1 (en) * | 2012-06-29 | 2014-01-02 | Qualcomm Incorporated | Crystal oscillator calibration |
CN103499803A (en) * | 2013-09-09 | 2014-01-08 | 扬州市万泰电器厂有限公司 | Method for improving precision of built-in real-time clock of electric energy meter MCU |
-
2015
- 2015-02-11 CN CN201510072309.6A patent/CN104682952B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060194561A1 (en) * | 2001-08-15 | 2006-08-31 | Norman Robert D | Systems and methods for self-calibration |
US20140004887A1 (en) * | 2012-06-29 | 2014-01-02 | Qualcomm Incorporated | Crystal oscillator calibration |
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 |
Non-Patent Citations (1)
Title |
---|
邓志鹏: "石英晶体振荡器温度补偿技术的研究", 《中国优秀硕士学位论文全文数据库信息科技辑》 * |
Also Published As
Publication number | Publication date |
---|---|
CN104682952B (en) | 2018-05-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7791418B2 (en) | Systems and methods for compensating for variations of the output of a real-time clock | |
CN106505996B (en) | A kind of RTC chip high-precision frequency bias compensation method of combination variable capacitance | |
CN110380724B (en) | RTC clock frequency temperature compensation chip | |
CN102118160B (en) | Circuit and method for generating clock signal | |
CN103176400B (en) | Intelligent ammeter clock calibration method | |
CN100456858C (en) | Time error compensation device and method for terminal | |
CN102435975B (en) | Clock calibration method of intelligent cost control electric energy meter | |
US5771180A (en) | Real time clock and method for providing same | |
CN103441760A (en) | High-precision annular oscillator, and frequency calibration circuit and method thereof | |
CN102163041B (en) | Wide range temperature error compensating method of real-time clock and system thereof | |
CN103901942B (en) | For the calibration method and device of the clock accuracy of terminal | |
CN101959298B (en) | Method and device for calibrating slow timing clock and terminal | |
CN102163040B (en) | Built-in hardware clock module with temperature compensation function | |
CN116106605A (en) | Electric energy meter parameter compensation method, medium and system considering temperature change | |
CN203299557U (en) | Real-time clock compensation device | |
CN104682952A (en) | Clock compensation method suitable for SOC (system-on-chip) scheme | |
CN112737507B (en) | Method for realizing RTC high precision based on temperature sensor | |
CN113644908A (en) | Temperature compensation method and system of crystal oscillator | |
CN104135232B (en) | A kind of crystal oscillator and frequency search method | |
CN102571035B (en) | For generation of circuit and the method for clock signal | |
CN203492007U (en) | High-precision ring oscillator and frequency calibration circuit thereof | |
CN102916654A (en) | Crystal oscillator ageing compensation method | |
CN205748699U (en) | A kind of linear transform circuit for negative tempperature coefficient thermistor | |
CN106612104B (en) | Real-time clock error compensation device and method | |
CN114879799B (en) | Band-gap reference circuit and temperature compensation method of band-gap reference voltage |
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 |