The calibration method and calibration circuit of a kind of internal clock

文档序号:1744433 发布日期:2019-11-26 浏览:29次 中文

阅读说明:本技术 一种片内时钟的校准方法和校准电路 (The calibration method and calibration circuit of a kind of internal clock ) 是由 李立 杨磊 范振伟 于 2019-08-12 设计创作,主要内容包括:本发明实施例涉及一种片内时钟的校准方法和校准电路,所述校准方法包括:根据片内时钟的目标锁定频率确定外部输入的参考时钟方波信号和时钟计数阈值;片内时钟校准电路接入外部输入的参考时钟方波信号;片内时钟校准电路对参考时钟方波信号的高电平进行计数,并同时对内部振荡器产生的片内时钟信号进行计数;当外部输入的参考时钟方波信号的数量达到所述时钟计数阈值时,停止所述计数,并获取当前片内时钟信号的计数值;比较片内时钟信号的计数值与所述时钟计数阈值;如果所述片内时钟信号的计数值大于或小于所述时钟计数阈值,调整内部振荡器的电流以调整内部振荡器的校准控制字,从而对所述片内时钟进行校准。(The present embodiments relate to the calibration methods of a kind of internal clock and calibration circuit, and the calibration method includes: to determine externally input reference clock square-wave signal and clock count threshold value according to the target lock-on frequency of piece internal clock;Piece internal clock calibrates circuit and accesses externally input reference clock square-wave signal;Piece internal clock calibration circuit counts the high level of reference clock square-wave signal, and the piece clock signal generated simultaneously to internal oscillator counts;When the quantity of externally input reference clock square-wave signal reaches the clock count threshold value, stop the counting, and obtain the count value of current slice clock signal;Compare the count value and the clock count threshold value of piece clock signal;If the count value of described clock signal is more than or less than the clock count threshold value, the electric current of internal oscillator is adjusted to adjust the calibration control word of internal oscillator, to calibrate to described internal clock.)

1. the calibration method of a kind of internal clock, which is characterized in that the calibration method includes:

Externally input reference clock square-wave signal and clock count threshold value are determined according to the target lock-on frequency of piece internal clock;

Piece internal clock calibrates circuit and accesses externally input reference clock square-wave signal;

Piece internal clock calibration circuit counts the high level of the reference clock square-wave signal, and simultaneously to internal oscillator The piece clock signal of generation is counted;

When the quantity of externally input reference clock square-wave signal reaches the clock count threshold value, stop the counting, and Obtain the count value of current slice clock signal;

Compare the count value and the clock count threshold value of piece clock signal;

If the count value of described clock signal is more than or less than the clock count threshold value, the electricity of internal oscillator is adjusted Stream is to adjust the calibration control word of internal oscillator, to calibrate to described internal clock.

2. calibration method according to claim 1, which is characterized in that the method also includes:

Judge whether the number of clock alignment reaches setting calibration number, if not provided, school according to claim 1 above Quasi- method carries out clock alignment again.

3. calibration method according to claim 1, which is characterized in that the electric current of the adjustment internal oscillator is interior to adjust The calibration control word of portion's oscillator specifically includes:

Frequency error value is determined according to the count value of described clock signal and the clock count threshold value, according to the frequency Error amount adjusts the electric current of the internal oscillator to adjust the calibration control word of internal oscillator.

4. calibration method according to claim 3, which is characterized in that the amplitude of accommodation of the electric current of the internal oscillator with The frequency error value is directly proportional.

5. a kind of calibration circuit to realize any calibration method of the claims 1-4, which is characterized in that the school Quasi- circuit includes: piece external clock signal generator, counter, processor, current adjusting device and internal oscillator;

Described external clock signal generator is used for input reference clock square-wave signal;

The counter is used to count the reference clock square-wave signal, and to the piece that the internal oscillator generates Clock signal is counted;

The processor is used to compare the count value and the clock count threshold value of piece clock signal, if described internal clock The count value of signal is more than or less than the clock count threshold value, generates current modifying signal;

The current adjusting device adjusts the electric current of internal oscillator according to the current modifying signal to adjust internal oscillator Calibration control word, to be calibrated to described internal clock.

6. calibration circuit according to claim 5, which is characterized in that the processor is also used to judge time of clock alignment Whether number reaches setting calibration number, if it is not, carrying out clock alignment again.

7. calibration circuit according to claim 5, which is characterized in that the processor is specifically used for, according in described The count value of clock signal and the clock count threshold value determine frequency error value, described interior according to frequency error value adjustment The electric current of portion's oscillator is to adjust the calibration control word of internal oscillator.

8. calibration circuit according to claim 7, which is characterized in that the amplitude of accommodation of the electric current of the internal oscillator with The frequency error value is directly proportional.

Technical field

The present invention relates to the calibration methods of chip design art field more particularly to a kind of internal clock and calibration circuit.

Background technique

For digital circuitry, one to stablize accurate clock most important to the work of circuit system.It is nearly all Digital display circuit processing signal be all to be carried out step by step by clock, system components be also by clock realize synchronize, The circuit for generating this clock signal is exactly clock circuit.

The core of clock circuit is a more stable clock oscillator (generally all with crystal oscillator), and oscillator generates Be sine wave, frequency is not necessarily the clock frequency of circuit work, so this sine wave is divided, handles, is formed Clock pulses is then dispensed for the place of needs.Use when allowing each section works in system.

Error of the clock oscillator due to manufacturing process, chip (die) meeting of the different places of same wafer (wafer) Different frequencies of oscillation is generated, although can all there is clock alignment usually before factory, inevitably can also have clock has partially The situation of poor inaccuracy, therefore also need to calibrate the clock signal frequency of clock oscillator in use.How It is calibrated after chip factory so as to guarantee the accurate of chip clock, is the problem of emphasis of the present invention is inquired into.

Summary of the invention

The object of the present invention is to provide the calibration methods of a kind of internal clock and calibration circuit, can effectively believe clock Number deviation be automatically corrected adjustment, ensure that the accuracy of piece internal clock.

To achieve the above object, in a first aspect, the present invention provides the calibration method of a kind of internal clock, the calibration side Method includes:

Externally input reference clock square-wave signal and clock count threshold are determined according to the target lock-on frequency of piece internal clock Value;

Piece internal clock calibrates circuit and accesses externally input reference clock square-wave signal;

Piece internal clock calibration circuit counts the high level of the reference clock square-wave signal, and shakes simultaneously to inside The piece clock signal for swinging device generation is counted;

When the quantity of externally input reference clock square-wave signal reaches the clock count threshold value, stop the meter Number, and obtain the count value of current slice clock signal;

Compare the count value and the clock count threshold value of piece clock signal;

If the count value of described clock signal is more than or less than the clock count threshold value, internal oscillator is adjusted Electric current to adjust the calibration control word of internal oscillator, to be calibrated to described internal clock.

Preferably, the method also includes:

Judge whether the number of clock alignment reaches setting calibration number, if not provided, according to calibration side described above Method carries out clock alignment again.

Preferably, the electric current of the adjustment internal oscillator is specifically included with the calibration control word for adjusting internal oscillator:

Frequency error value is determined according to the count value of described clock signal and the clock count threshold value, according to described Frequency error value adjusts the electric current of the internal oscillator to adjust the calibration control word of internal oscillator.

It is further preferred that the amplitude of accommodation of the electric current of the internal oscillator is directly proportional to the frequency error value.

Second aspect, the school that the embodiment of the invention provides a kind of to realize calibration method described in above-mentioned first aspect Quasi- circuit, the calibration circuit include: piece external clock signal generator, counter, processor, current adjusting device and internal vibration Swing device;

Described external clock signal generator is used for input reference clock square-wave signal;

The counter is generated for counting to the reference clock square-wave signal, and to the internal oscillator Piece clock signal counted;

The processor is used to compare the count value and the clock count threshold value of piece clock signal, if in described The count value of clock signal is more than or less than the clock count threshold value, generates current modifying signal;

The current adjusting device adjusts the electric current of internal oscillator according to the current modifying signal to adjust internal vibration The calibration control word of device is swung, to calibrate to described internal clock.

Preferably, the processor is also used to judge whether the number of clock alignment reaches setting calibration number, if do not had Have, then carries out clock alignment again.

Preferably, the processor is specifically used for, according to the count value of described clock signal and the clock count Threshold value determines frequency error value, adjusts the electric current of the internal oscillator according to the frequency error value to adjust internal oscillator Calibration control word.

It is further preferred that the amplitude of accommodation of the electric current of the internal oscillator is directly proportional to the frequency error value.

The calibration method of provided in an embodiment of the present invention internal clock is adjusted by comparing with external reference clock Electric current is adjusted come the calibration control word to oscillator, to realize in the use process after chip factory to piece internal clock Automatic calibration, ensure that the accuracy of piece internal clock.This method is simple and easy, is suitable for industrialization and uses.

Detailed description of the invention

Fig. 1 is the method flow diagram of the calibration method of provided in an embodiment of the present invention internal clock;

Fig. 2 is the schematic diagram of calibration circuit provided in an embodiment of the present invention.

Specific embodiment

Below by drawings and examples, technical scheme of the present invention will be described in further detail.

The calibration method of piece internal clock of the invention can be used for after chip itself piece internal clock powers on every time in use Clock alignment.

Fig. 1 is the flow chart of the calibration method of provided in an embodiment of the present invention internal clock, as shown in Figure 1, this method master It to execute in accordance with the following steps.

Step 110, according to the target lock-on frequency of piece internal clock determine externally input reference clock square-wave signal and when Clock count threshold;

Specifically, can determine clock according to the target lock-on frequency of piece internal clock first in the calibration of performing chip internal clock Count threshold, and externally input reference clock square-wave signal is determined according to target lock-on frequency.

The target lock-on frequency of piece internal clock refers to the frequency that piece internal clock needs to be calibrated, such as 12MHz, 32KHz etc. It, can be different and corresponding according to the target lock-on frequency of piece internal clock Deng, the square-wave signal of the external reference clock of calibration input It determines.In general, we are counted using the high level of square-wave signal.

Step 120, piece internal clock calibration circuit accesses externally input reference clock square-wave signal;

Step 130, piece internal clock calibration circuit counts the high level of reference clock square-wave signal, and simultaneously internally The piece clock signal that portion's oscillator generates is counted;

Specifically, counting to the high level of reference clock square-wave signal, accurate count value is obtained, that is, is used for conduct The count value of benchmark.The piece clock signal generated to internal oscillator counts, and obtained count value is actual inside vibration The count value that device is generated with current oscillating frequency is swung, when the frequency of internal oscillator shifts, which also can be corresponding Generation variation.This count value is exactly the reference frame for carrying out internal oscillator frequency adjustment.

Step 140, when the quantity of externally input reference clock square-wave signal reaches clock count threshold value, stop meter Number, and obtain the count value of current slice clock signal;

Step 150, compare the count value and clock count threshold value of piece clock signal;

If under the count value and clock count threshold value unanimous circumstances that compare piece clock signal, it is believed that piece internal clock is Accurately, without to internal oscillator making frequency adjustment.Otherwise calibration process is executed according to step 150.

Step 160, as the count value of chankings clock signal is more than or less than clock count threshold value, adjustment internal oscillator Electric current to adjust the calibration control word of internal oscillator, to be calibrated to piece internal clock.

Specifically, being provided with calibration control word, the current or voltage inside adjustable oscillator in clock oscillator Realize the adjustment of oscillator frequency, which stores in circuit in digital form, when controlling clock frequency by control word Corresponding analog quantity is converted into control the clock signal frequency of clock oscillator.The size of control word and clock oscillator when Clock signal frequency is in monotonic increasing function relationship, i.e. control word is bigger, and the clock signal frequency of corresponding clock oscillator is higher. Therefore, frequency error value can be determined according to the count value and clock count threshold value of piece clock signal, according to frequency error value It is controlled in the adjustment present invention to generate the electric current of the internal oscillator of internal clock signal with the calibration for adjusting internal oscillator Word.In a concrete implementation, the amplitude of accommodation of the electric current of internal oscillator is directly proportional to frequency error value.

Step 170, judge whether the number of clock alignment reaches setting calibration number;

Specifically, can be set for repeatedly calibrating for the accuracy of calibration.Calibration number is preset, and to Calibration number through completing is counted.Calibration number is preset when reaching, it is believed that calibration is completed, and terminates calibration, if do not had Have, return step 110 continues to calibrate.

Illustrate calibration method of the invention below with several specific application scenarios.

Application scenarios 1:

In practical applications, after chip powers on, " high level duration 20us, the side of low level duration 500ns " are inputted outside piece Wave, internal circuit count the high level duration of square wave, if the frequency of chankings internal oscillator is accurately 12MHz, then high The count value of level counter should be 240, therefore in the case where count value is not 240, need the school to internal oscillator Quasi- control word is adjusted.Count value is greater than 240, then illustrates that the frequency of internal oscillator is higher than 12MHz, need to be scaled to adjust Electric current is turned down control word is calibrated, and electric current is otherwise just scaled, control word is tuned up.

Application scenarios 2:

In practical applications, after chip powers on, 32KHz clock calibration circuit is for carrying out school from ring oscillator in piece Standard, to reduce the error of real work clock and desired clock.The target lock-on frequency of piece internal clock is 32KHz.

Using system 12MHz clock (piece is outer or piece in 12MHz, depend on clock selecting pin) to the height of 32KHz clock Level is counted, and if the frequency of chankings internal oscillator is accurately 32KHz, then the count value of high level counter should be 266, therefore be not 266 in count value, it is necessary to the calibration control word of oscillator is adjusted, count value is greater than 266, then says The frequency of bright oscillator is lower than 32K, need to be scaled adjustment electric current and tunes up control word is calibrated, is otherwise just scaled Electric current turns control word down.

Correspondingly, the calibration circuit that the embodiment of the invention also provides a kind of to realize above-mentioned calibration method, comprising: piece External clock signal generator 1, counter 2, processor 3, current adjusting device 4 and internal oscillator 5;

Piece external clock signal generator 1 is used for input reference clock square-wave signal;

Counter 2 is used to count reference clock square-wave signal, and to the piece internal clock that internal oscillator 5 generates Signal is counted;

Processor 3 is used to compare the count value and clock count threshold value of piece clock signal, such as chankings clock signal Count value is more than or less than clock count threshold value, generates current modifying signal;

Specifically, processor 3 determines frequency error value, root according to the count value and clock count threshold value of piece clock signal The calibration control word of internal oscillator is adjusted according to the electric current of frequency error value adjustment internal oscillator.Preferably, internal oscillator The amplitude of accommodation of the electric current of device is directly proportional to frequency error value.

Current adjusting device 4 adjusts the electric current of internal oscillator according to current modifying signal to adjust the school of internal oscillator Quasi- control word, to be calibrated to piece internal clock.

Processor 3 be also used to judge the number of clock alignment whether reach setting calibration number, if it is not, again into Row clock calibration.

Processor 3 is specifically used for, and determines frequency error value according to the count value of piece clock signal and clock count threshold value, The electric current of internal oscillator is adjusted according to frequency error value to adjust the calibration control word of internal oscillator.

The calibration method of provided in an embodiment of the present invention internal clock is adjusted by comparing with external reference clock Electric current is adjusted come the calibration control word to oscillator, so that the automatic calibration to piece internal clock is realized, when ensure that in piece The accuracy of clock.This method is simple and easy, is suitable for industrialization and uses.

Professional should further appreciate that, described in conjunction with the examples disclosed in the embodiments of the present disclosure Unit and algorithm steps, can be realized with electronic hardware, computer software, or a combination of the two, hard in order to clearly demonstrate The interchangeability of part and software generally describes each exemplary composition and step according to function in the above description. These functions are implemented in hardware or software actually, the specific application and design constraint depending on technical solution. Professional technician can use different methods to achieve the described function each specific application, but this realization It should not be considered as beyond the scope of the present invention.

The step of method described in conjunction with the examples disclosed in this document or algorithm, can be executed with hardware, processor The combination of software module or the two is implemented.Software module can be placed in random access memory (RAM), memory, read-only storage Device (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technology neck In any other form of storage medium well known in domain.

Above-described specific embodiment has carried out further the purpose of the present invention, technical scheme and beneficial effects It is described in detail, it should be understood that being not intended to limit the present invention the foregoing is merely a specific embodiment of the invention Protection scope, all within the spirits and principles of the present invention, any modification, equivalent substitution, improvement and etc. done should all include Within protection scope of the present invention.

8页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:压控振荡器电路及锁相环电路

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类