CN105116712A - Method for automatically calibrating built-in crystal oscillator - Google Patents
Method for automatically calibrating built-in crystal oscillator Download PDFInfo
- Publication number
- CN105116712A CN105116712A CN201510466770.XA CN201510466770A CN105116712A CN 105116712 A CN105116712 A CN 105116712A CN 201510466770 A CN201510466770 A CN 201510466770A CN 105116712 A CN105116712 A CN 105116712A
- Authority
- CN
- China
- Prior art keywords
- built
- crystal oscillator
- bus
- standard frequency
- square wave
- 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.)
- Pending
Links
Abstract
The invention discloses a method for automatically calibrating a built-in crystal oscillator. According to the method, after a chip starts working, the chip enters an automatic calibration mode, then a square wave of standard frequency is input through an IO, and whether to adjust the built-in crystal oscillator to be larger or smaller is judged by using a mathematical algorithm to calculate the number of clocks clk between two square waves of standard frequency till a frequency error of the built-in crystal oscillator is in a theoretical range. The method is simple and convenient to realize and low in cost, and can satisfy requirements of adjustment of built-in crystal oscillators of different chips.
Description
Technical field
The invention belongs to the technical field of chip, particularly the frequency control of the built-in crystal oscillator of chip.
Background technology
In order to save system cost, increasing chip uses built-in crystal oscillator to provide work clock to chip now, but due to the deviation of production technology, built-in crystal oscillator and actual theoretical value have certain deviation, and also can be variant between chip and chip, particularly relate on the equipment of employing various chips, frequency between different chip is difficult to accomplish complete unity, therefore, often cannot meet requirement of system design at the application scenario chip high to clock accuracy, cause a hidden trouble to system.
Patented claim 201410266409.8 discloses a kind of method reducing electric time-keeping error, the method relates to the method that built-in crystal oscillator carries out temperature compensation real-time timepiece chip, the RTC that the method utilizes single-chip microcomputer to connect respectively, digital display device, infrared receiving terminal, Bluetooth chip, power supply, described RTC is connected with power supply by voltage stabilizing chip, under software support, make the timing product of conventional internal crystal oscillator temperature compensation RTC, not only there is the year of calibration RTC, month, week, day, time, point, the function of second register, also has the function of the built-in 32768Hz crystal oscillator of calibration RTC, it is convenient that crystal oscillator frequency skew is recalibrated, personalized compensation calibration its crystal oscillator can realize the year Error Absolute Value timing that is less than 1 second.This patented claim is by the RTC alignment time, needs additionally to increase external hardware, improves the cost of calibration, and this calibration is based on RTC, calibrated by the built-in crystal oscillator of RTC, be subject to restriction and the restriction of RTC chip itself, and be not suitable for the calibration of other built-in crystal oscillator.
Summary of the invention
For solving the problem, the object of the present invention is to provide a kind of built-in crystal oscillator automatic calibrating method, the method can carry out the calibration of built-in crystal oscillator automatically, makes the control errors of built-in crystal oscillator within theoretical error, avoids system to occur hidden danger.
Another object of the present invention is the built-in crystal oscillator automatic calibrating method of one provided, the method judges built-in crystal oscillator to tune up or turn down by the number of clock clk between square wave of adjusting frequency, until built-in crystal oscillation frequency error is in teachings, realize easy, with low cost, the built-in crystal oscillator adjustment needs of different chip can be met.
For achieving the above object, technical scheme of the present invention is as follows.
A kind of built-in crystal oscillator automatic calibrating method, the method comprises the steps:
101, system electrification, enters calibrating mode;
102, square wave is produced; The square wave of a standard frequency is inputted by IO;
Described square wave frequency be preferably not more than built-in crystal oscillator ten thousand/.
103, calibrate, calculate the number of clock clk between two standard frequency square waves, judge built-in crystal oscillator to tune up or turn down with this, and calibrate according to result of calculation, until built-in crystal oscillation frequency error controls in teachings.
For the method for calibration, being the size of data by changing in feedback bus, adjusting built-in crystal oscillator clock.
The excessive situation causing built-in crystal oscillator deviation range to exceed+12.7% to-12.8% of discrete type for technique, the bit wide (step-length changes the constant or constant bit wide of step-length of 0.2% bit wide into and becomes 9, and the scope of built-in crystal oscillator adjustment is+25.5% to-25.6%) of the step-length of adjustment or BUS can be strengthened.
The present invention judges built-in crystal oscillator to tune up or turn down by the number of clock clk between square wave of adjusting frequency, the built-in crystal oscillator clock of automatic adjustment, until built-in crystal oscillation frequency error is in teachings, the method realizes easy, with low cost, the built-in crystal oscillator adjustment needs of different chip can be met.
Accompanying drawing explanation
Fig. 1 is the chip structure block diagram that the present invention implements.
Fig. 2 is the control flow chart that the present invention implements.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearly understand, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
Please refer to shown in Fig. 1, for realizing hardware block diagram of the present invention.After chip is started working, (mode entering calibration is multiple to make chip enter automatic calibration mode, can be controlled by IO, also can by the control that says the word, also automatic calibration mode can be entered in certain a period of time after chip powers on), then the square wave (square wave frequency is preferably not more than ten thousand/of built-in crystal oscillator) of a standard frequency is inputted by IO, digital algorithm judges built-in crystal oscillator to tune up or turn down by the number calculating clock clk between two standard frequency square waves, until built-in crystal oscillation frequency error is in teachings.
Figure 2 shows that the process flow diagram of built-in crystal oscillator automatic calibration, concrete control flow is as follows.
201, chip enters normal mode of operation;
202, judge whether chip enters automatic calibration pattern, if do not enter automatic calibration pattern, waiting for and enter automatic calibration pattern, not affecting other various functions of chip when waiting for automatic calibration pattern; If enter automatic calibration pattern, continue next step;
203, judge the outside square wave whether having input standard frequency, if do not had, wait standard frequency square wave to be entered; If there is standard frequency square wave input, continue next step;
204, judge the number of built-in crystal oscillator clock between two standard frequency square waves, if number is in theoretical error range, exit the calibration of automatic calibration Pattern completion; If number in theoretical error range, does not continue next step;
205, change the size of data in feedback bus, adjustment onboard clock, then jumps to step 4.
Suppose that built-in chip type crystal oscillator Theoretical Design value is 16M, built-in crystal oscillator adjustment feedback bus is the BUS [7:0] of 8, BUS [7] represents adjustment direction, BUS [7]=1 built-in crystal oscillator clock adjusts toward fast direction, BUS [7]=0 built-in crystal oscillator clock adjusts toward slow direction, as BUS [7:0]=8 ' hFF, built-in crystal oscillator clock is the fastest, as BUS [7:0]=8 ' h00, built-in crystal oscillator clock is the slowest, default value is BUS [7:0]=8 ' h80, the step-length that BUS [7:0] adjusts is 0.1%, the scope of built-in crystal oscillator adjustment is+12.7% to-12.8%, built-in crystal oscillator deviation range is caused to exceed+12.7% to-12.8% if the discrete type of technique is excessive, (step-length changes the constant or constant bit wide of step-length of 0.2% bit wide into and becomes 9 can to strengthen the bit wide of the step-length of adjustment or BUS, the scope of built-in crystal oscillator adjustment is+25.5% to-25.6%), the standard frequency square wave of input is 1KHz, between two standard frequency square waves, built-in crystal oscillator clock number is 16000 in theory.If built-in Crystal Oscillator Errors can not more than 0.05%, so between two standard frequency square waves, built-in crystal oscillator clock number is 15992 to 16008, the adjustment of built-in crystal oscillator clock is carried out below according to the adjustment flow process of lower mask body.
301, before starting adjustment, built-in crystal oscillator is 15MHz, and between two standard frequency square waves, built-in crystal oscillator clock number is 15000, not in teachings, and less than theoretical value, need built-in crystal oscillator to adjust toward fast direction.
Now, BUS [7]=1, makes BUS [6]=1, BUS [5:0]=6 ' h00, and after adjustment, built-in crystal oscillator value is 15MHz* (1+2^6*0.1%)=15.96MHz.
If built-in crystal oscillator clock number is 15960 between 302 two standard frequency square waves, not in teachings, and less than theoretical value.
Now, BUS [7:6] remains unchanged, and makes BUS [5]=1, BUS [4:0]=5 ' h00, and after adjustment, built-in crystal oscillator value is 15MHz* (1+2^6*0.1%+2^5*0.1%)=16.44MHz.
If built-in crystal oscillator clock number is 16440 between 303 two standard frequency square waves, not in teachings, and larger than theoretical value;
Now, BUS [7:6] remains unchanged, and make BUS [5]=0, BUS [4]=1, BUS [3:0]=4 ' h0, after adjustment, built-in crystal oscillator value is 15MHz* (1+2^6*0.1%+2^4*0.1%)=16.20MHz.
If built-in crystal oscillator clock number is 16200 between 304 two standard frequency square waves, not in teachings, and larger than theoretical value.
Now, BUS [7:5] remains unchanged, BUS [4]=0, makes BUS [3]=1, BUS [2:0]=3 ' h0, and after adjustment, built-in crystal oscillator value is 15MHz* (1+2^6*0.1%+2^3*0.1%)=16.08MHz.
If built-in crystal oscillator clock number is 16080 between 305 two standard frequency square waves, not in teachings, and larger than theoretical value.
Now, BUS [7:4] remains unchanged, BUS [3]=0, makes BUS [2]=1, BUS [1:0]=2 ' h0, and after adjustment, built-in crystal oscillator value is 15MHz* (1+2^6*0.1%+2^2*0.1%)=16.02MHz.
If built-in crystal oscillator clock number is 16020 between 306 two standard frequency square waves, not in teachings, and larger than theoretical value.
Now, BUS [7:3] remains unchanged, BUS [2]=0, and make BUS [1]=1, BUS [0]=1 ' h0, after adjustment, built-in crystal oscillator value is 15MHz* (1+2^6*0.1%+2^1*0.1%)=15.99MHz.
If built-in crystal oscillator clock number is 15990 between 307 two standard frequency square waves, not in teachings, and less than theoretical value.
Now, BUS [7:1] remains unchanged, and makes BUS [0]=1 ' h1, and after adjustment, built-in crystal oscillator value is 15MHz* (1+2^6*0.1%+2^1*0.1%+2^0*0.1%)=16.005MHz.
308, between two standard frequency square waves, built-in crystal oscillator clock number is 16005, in teachings, completes automatic calibration function, exits automatic calibration function.
By step above, the value finally obtaining BUS [7:0] is 8 ' b1100_0011.As can be seen from process above also, the number of required standard frequency square wave is identical with BUS bit wide.In above-mentioned example, the bit wide of BUS is 8, only needs the square wave of 8 standard frequencies just can complete the automatic calibration of built-in crystal oscillator.Suppose that in above-mentioned example, built-in Crystal Oscillator Errors can not more than 0.1%, between two standard frequency square waves, built-in crystal oscillator clock number is 15984 to 16016, the calibration of built-in crystal oscillator just can be stopped when step 307, the BUS value finally obtained is that 8 ' b1100_0010, step 307-308 become following description:
If built-in crystal oscillator clock number is 15990 between 307 two standard frequency square waves, in teachings (15984 to 16016), stop the calibration of built-in crystal oscillator.
Now, BUS [7:1] remains unchanged, and BUS [0] also remains unchanged (BUS [0]=0).
308, between two standard frequency square waves, built-in crystal oscillator clock number is 15990, in teachings, completes automatic calibration function, exits automatic calibration function.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, all any amendments done within the spirit and principles in the present invention, equivalent replacement and improvement etc., all should be included within protection scope of the present invention.
Claims (4)
1. a built-in crystal oscillator automatic calibrating method, the method comprises the steps:
101, system electrification, enters calibrating mode;
102, square wave is produced; The square wave of a standard frequency is inputted by IO;
103, calibrate, calculate the number of clock clk between two standard frequency square waves, judge built-in crystal oscillator to tune up or turn down with this, and calibrate according to result of calculation, until built-in crystal oscillation frequency error controls in teachings.
2. as right 1 require as described in built-in crystal oscillator automatic calibrating method, it is characterized in that described square wave frequency be not more than built-in crystal oscillator ten thousand/.
3. as right 1 require as described in built-in crystal oscillator automatic calibrating method, it is characterized in that the method for calibration, being the size of data by changing in feedback bus, adjusting built-in crystal oscillator clock.
4. as right 4 require as described in built-in crystal oscillator automatic calibrating method, it is characterized in that the excessive situation causing built-in crystal oscillator deviation range to exceed+12.7% to-12.8% of discrete type for technique, the step-length of adjustment or the bit wide of BUS can be strengthened.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510466770.XA CN105116712A (en) | 2015-08-03 | 2015-08-03 | Method for automatically calibrating built-in crystal oscillator |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510466770.XA CN105116712A (en) | 2015-08-03 | 2015-08-03 | Method for automatically calibrating built-in crystal oscillator |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105116712A true CN105116712A (en) | 2015-12-02 |
Family
ID=54664731
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510466770.XA Pending CN105116712A (en) | 2015-08-03 | 2015-08-03 | Method for automatically calibrating built-in crystal oscillator |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105116712A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106066661A (en) * | 2016-07-12 | 2016-11-02 | 中南大学 | A kind of calibration system of the SOC being easily achieved built-in high accuracy RC Oscillator |
CN110916518A (en) * | 2019-11-29 | 2020-03-27 | 九阳股份有限公司 | Control method of food processing machine |
CN113552794A (en) * | 2021-06-24 | 2021-10-26 | 南方电网科学研究院有限责任公司 | Automatic calibration device and method for clock signal in power chip |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB1385890A (en) * | 1971-12-16 | 1975-03-05 | Suisse Pour Lindustrie Horloge | Arrangement for correcting of seconds indication of a timepiece |
CN2852221Y (en) * | 2005-05-31 | 2006-12-27 | 上海自动化仪表股份有限公司 | Rotary speed measure control card and its decentralized control system |
US7371005B1 (en) * | 2006-11-16 | 2008-05-13 | Intersil Americas Inc. | Automatic circuit and method for temperature compensation of oscillator frequency variation over temperature for a real time clock chip |
CN101930211A (en) * | 2010-08-24 | 2010-12-29 | 西安交通大学 | Clock source device based on GPS second pulse and control method thereof |
CN101995816A (en) * | 2010-10-25 | 2011-03-30 | 珠海精准电子有限公司 | Automatic clock calibration method and automatic clock calibration device |
CN103684358A (en) * | 2013-11-21 | 2014-03-26 | 航天科工深圳(集团)有限公司 | Sampling pulse generation method and device |
CN104679098A (en) * | 2013-11-29 | 2015-06-03 | 上海华虹集成电路有限责任公司 | Automatic calibration circuit for clock frequency of microcontroller |
-
2015
- 2015-08-03 CN CN201510466770.XA patent/CN105116712A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB1385890A (en) * | 1971-12-16 | 1975-03-05 | Suisse Pour Lindustrie Horloge | Arrangement for correcting of seconds indication of a timepiece |
CN2852221Y (en) * | 2005-05-31 | 2006-12-27 | 上海自动化仪表股份有限公司 | Rotary speed measure control card and its decentralized control system |
US7371005B1 (en) * | 2006-11-16 | 2008-05-13 | Intersil Americas Inc. | Automatic circuit and method for temperature compensation of oscillator frequency variation over temperature for a real time clock chip |
CN101930211A (en) * | 2010-08-24 | 2010-12-29 | 西安交通大学 | Clock source device based on GPS second pulse and control method thereof |
CN101995816A (en) * | 2010-10-25 | 2011-03-30 | 珠海精准电子有限公司 | Automatic clock calibration method and automatic clock calibration device |
CN103684358A (en) * | 2013-11-21 | 2014-03-26 | 航天科工深圳(集团)有限公司 | Sampling pulse generation method and device |
CN104679098A (en) * | 2013-11-29 | 2015-06-03 | 上海华虹集成电路有限责任公司 | Automatic calibration circuit for clock frequency of microcontroller |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106066661A (en) * | 2016-07-12 | 2016-11-02 | 中南大学 | A kind of calibration system of the SOC being easily achieved built-in high accuracy RC Oscillator |
CN106066661B (en) * | 2016-07-12 | 2019-03-08 | 中南大学 | The calibration system of high-precision rc oscillator built in a kind of SOC |
CN110916518A (en) * | 2019-11-29 | 2020-03-27 | 九阳股份有限公司 | Control method of food processing machine |
CN113552794A (en) * | 2021-06-24 | 2021-10-26 | 南方电网科学研究院有限责任公司 | Automatic calibration device and method for clock signal in power chip |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109067394B (en) | On-chip clock calibration device and calibration method | |
CN104122936B (en) | A kind of MCU chip frequency-dividing clock means for correcting and method | |
US8488506B2 (en) | Oscillator settling time allowance | |
CN104679098A (en) | Automatic calibration circuit for clock frequency of microcontroller | |
CN104753499B (en) | Duty ratio calibrating circuit | |
US10042383B2 (en) | Navigation system and mouse device | |
CN105116712A (en) | Method for automatically calibrating built-in crystal oscillator | |
CN101834598A (en) | Frequency correction circuit and frequency correction method thereof | |
CN102412957A (en) | High-precision synchronous clock adjusting method | |
CN104158616A (en) | Clock synchronization method and device in optical fiber transmission system | |
CN101090547A (en) | Method and device for calibrating sleep clock of TD-SCDMA terminal | |
CN103092258A (en) | Clock generation circuit self-correction system and clock generation circuit self-correction method | |
JP2000174615A (en) | Method and device for automatically correcting internal clock frequency of integrated circuit | |
US6747374B2 (en) | Circuit for correcting deviation in oscillating frequency | |
CN104135232B (en) | A kind of crystal oscillator and frequency search method | |
TWI638517B (en) | Mitigation of long wake-up delay of a crystal oscillator | |
US10146250B2 (en) | Method and circuit for adjusting the frequency of a clock signal | |
CN108988832B (en) | Method for detecting a delay associated with an electronic device and corresponding electronic device | |
CN111510129B (en) | Fractional frequency division system and fractional frequency division method for pure digital circuit | |
CN105873190B (en) | A kind of clock correcting method and terminal of closed loop | |
CN204065907U (en) | A kind of MCU chip frequency-dividing clock means for correcting | |
CN106612104B (en) | Real-time clock error compensation device and method | |
CN104753497A (en) | Method and device for correcting OSCPPS | |
CN103023433B (en) | Improved high-precision oscillator | |
CN103513698B (en) | A kind of clock signal calibration, device and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20151202 |
|
RJ01 | Rejection of invention patent application after publication |