Oscillator device and oscillator frequency calibration method

文档序号:786531 发布日期:2021-04-09 浏览:28次 中文

阅读说明:本技术 一种振荡器装置及振荡器频率校准方法 (Oscillator device and oscillator frequency calibration method ) 是由 南炳在 郑永一 于 2020-12-29 设计创作,主要内容包括:本发明提供一种振荡器装置及振荡器频率校准方法。所述振荡器装置包括:参考振荡器,用于输出参考振荡器信号;目标振荡器,用于输出目标振荡器信号;计数模块,用于在对参考振荡器信号的周期计数至预设计数值的时长内,对目标振荡器信号的周期进行计数,得到第一计数值;比较模块,用于将第一计数值与目标计数值进行比较,得到比较结果;修正模块,用于根据比较结果,修正目标振荡器输出的目标振荡器信号的频率;其中,参考振荡器信号的频率低于目标振荡器信号的频率。根据本发明实施例的振荡器装置,通过使目标振荡器信号跟踪参考振荡器信号,可以降低目标振荡器信号的频率波动,并且目标振荡器不需要使用接口时钟,因此负载较低、功耗也较小。(The invention provides an oscillator device and an oscillator frequency calibration method. The oscillator device includes: a reference oscillator for outputting a reference oscillator signal; a target oscillator for outputting a target oscillator signal; the counting module is used for counting the period of the target oscillator signal within the time length from the period of the reference oscillator signal to a preset counting value to obtain a first counting value; the comparison module is used for comparing the first count value with a target count value to obtain a comparison result; the correction module is used for correcting the frequency of the target oscillator signal output by the target oscillator according to the comparison result; wherein the frequency of the reference oscillator signal is lower than the frequency of the target oscillator signal. According to the oscillator device provided by the embodiment of the invention, the target oscillator signal tracks the reference oscillator signal, so that the frequency fluctuation of the target oscillator signal can be reduced, and the target oscillator does not need to use an interface clock, so that the load is lower and the power consumption is lower.)

1. An oscillator device, comprising:

a reference oscillator for outputting a reference oscillator signal;

a target oscillator for outputting a target oscillator signal;

the counting module is used for counting the period of the target oscillator signal within the time length from the period of the reference oscillator signal to a preset counting value to obtain a first counting value;

the comparison module is used for comparing the first count value with a target count value to obtain a comparison result;

the correction module is used for correcting the frequency of a target oscillator signal output by the target oscillator according to the comparison result;

wherein the frequency of the reference oscillator signal is lower than the frequency of the target oscillator signal.

2. The oscillator device of claim 1, wherein the target count value is equal to a target output frequency of the target oscillator multiplied by the preset count value divided by a frequency of the reference oscillator signal.

3. The oscillator device of claim 1, wherein the comparison module comprises:

a calculating unit for calculating a difference between the first count value and a target count value;

the oscillator device further includes:

and the error control module is used for controlling the correction module to correct the frequency of the target oscillator signal output by the target oscillator under the condition that the difference value exceeds a preset error range, and controlling the correction module to stop correcting the frequency of the target oscillator signal output by the target oscillator under the condition that the difference value does not exceed the preset error range.

4. The oscillator device of claim 1, wherein the correction module comprises:

a first correction unit configured to increase a frequency of a target oscillator signal output by the target oscillator until the first count value is equal to the target count value, when the first count value is smaller than the target count value;

a second correction unit configured to decrease the frequency of the target oscillator signal output by the target oscillator until the first count value is equal to the target count value, when the first count value is greater than the target count value.

5. The oscillator device according to claim 1, further comprising:

and the tracking step length setting module is used for setting a tracking step length according to the comparison result, and the tracking step length is used for determining the correction amplitude of the correction module when the frequency of the target oscillator signal output by the target oscillator is corrected.

6. The oscillator arrangement according to claim 5, characterized in that the tracking step size is:

ERVAL=A*|(N-K)|,

wherein, ERVALFor the tracking step length, A is a preset coefficient, and N isThe target count value, K, is the first count value.

7. A method of oscillator frequency calibration, comprising:

counting the period of a target oscillator signal output by a target oscillator within the time length from the period counting of a reference oscillator signal output by a reference oscillator to a preset counting value to obtain a first counting value;

comparing the first count value with a target count value to obtain a comparison result;

correcting the frequency of a target oscillator signal output by the target oscillator according to the comparison result;

wherein the frequency of the reference oscillator signal is lower than the frequency of the target oscillator signal.

8. The oscillator frequency calibration method of claim 7, wherein the target count value is equal to a target output frequency of the target oscillator multiplied by the preset count value divided by a frequency of the reference oscillator signal.

9. The oscillator frequency calibration method according to claim 7, wherein the comparing the first count value with a target count value to obtain a comparison result comprises:

calculating a difference value between the first count value and a target count value;

the correcting the frequency of the target oscillator signal output by the target oscillator according to the comparison result comprises:

and correcting the frequency of the target oscillator signal output by the target oscillator under the condition that the difference value exceeds a preset error range.

10. The oscillator frequency calibration method according to claim 7, wherein the correcting the frequency of the target oscillator signal output by the target oscillator according to the comparison result comprises:

increasing the frequency of a target oscillator signal output by the target oscillator until the first count value is equal to the target count value, if the first count value is less than the target count value;

in the case where the first count value is greater than the target count value, decreasing the frequency of a target oscillator signal output by the target oscillator until the first count value is equal to the target count value.

11. The oscillator frequency calibration method of claim 7, further comprising:

and setting a tracking step length according to the comparison result, wherein the tracking step length is used for determining the correction amplitude when the frequency of the target oscillator signal output by the target oscillator is corrected.

12. The oscillator frequency calibration method of claim 11, wherein the tracking step size is:

ERVAL=A*|(N-K)|,

wherein, ERVALAnd for the tracking step length, A is a preset coefficient, N is the target counting value, and K is the first counting value.

Technical Field

The invention relates to the technical field of oscillators, in particular to an oscillator device and an oscillator frequency calibration method.

Background

Clocks have an important role in digital circuits, and digital signals require clock pulses to control the reception and transmission of data. Therefore, a high-precision and high-stability clock signal is important. However, in the working process of the oscillator, the frequency of the oscillator deviates from the original oscillation frequency due to the change of the ambient environment and the application temperature, so that a large error is generated in the frequency of the oscillator, and the display effect of the display panel is finally affected.

Disclosure of Invention

In view of the above, the present invention provides an oscillator device and an oscillator frequency calibration method, which can solve the problem in the prior art that an oscillator is easily affected by external environment changes, and thus a large error is generated in the frequency of an output clock signal.

In order to solve the technical problems, the invention adopts the following technical scheme:

in a first aspect, an embodiment of the present invention provides an oscillator apparatus, including:

a reference oscillator for outputting a reference oscillator signal;

a target oscillator for outputting a target oscillator signal;

the counting module is used for counting the period of the target oscillator signal within the time length from the period of the reference oscillator signal to a preset counting value to obtain a first counting value;

the comparison module is used for comparing the first count value with a target count value to obtain a comparison result;

the correction module is used for correcting the frequency of a target oscillator signal output by the target oscillator according to the comparison result;

wherein the frequency of the reference oscillator signal is lower than the frequency of the target oscillator signal.

Optionally, the target count value is equal to a target output frequency of the target oscillator multiplied by the preset count value and divided by a frequency of the reference oscillator signal.

Optionally, the comparing module includes:

a calculating unit for calculating a difference between the first count value and a target count value;

the oscillator device further includes:

and the error control module is used for controlling the correction module to correct the frequency of the target oscillator signal output by the target oscillator under the condition that the difference value exceeds a preset error range, and controlling the correction module to stop correcting the frequency of the target oscillator signal output by the target oscillator under the condition that the difference value does not exceed the preset error range.

Optionally, the modification module includes:

a first correction unit configured to increase a frequency of a target oscillator signal output by the target oscillator until the first count value is equal to the target count value, when the first count value is smaller than the target count value;

a second correction unit configured to decrease the frequency of the target oscillator signal output by the target oscillator until the first count value is equal to the target count value, when the first count value is greater than the target count value.

Optionally, the method further includes:

and the tracking step length setting module is used for setting a tracking step length according to the comparison result, and the tracking step length is used for determining the correction amplitude of the correction module when the frequency of the target oscillator signal output by the target oscillator is corrected.

Optionally, the tracking step size is:

ERVAL=A*|(N-K)|,

wherein, ERVALAnd for the tracking step length, A is a preset coefficient, N is the target counting value, and K is the first counting value.

Another embodiment of the present invention provides an oscillator frequency calibration method, including:

counting the period of a target oscillator signal output by a target oscillator within the time length from the period counting of a reference oscillator signal output by a reference oscillator to a preset counting value to obtain a first counting value;

comparing the first count value with a target count value to obtain a comparison result;

comparing the first count value with a target count value to obtain a comparison result;

correcting the frequency of a target oscillator signal output by the target oscillator according to the comparison result;

wherein the frequency of the reference oscillator signal is lower than the frequency of the target oscillator signal.

Optionally, the target count value is equal to a target output frequency of the target oscillator multiplied by the preset count value and divided by a frequency of the reference oscillator signal.

Optionally, the comparing the first count value with the target count value to obtain a comparison result includes:

calculating a difference value between the first count value and a target count value;

the correcting the frequency of the target oscillator signal output by the target oscillator according to the comparison result comprises:

and correcting the frequency of the target oscillator signal output by the target oscillator under the condition that the difference value exceeds a preset error range.

Optionally, the modifying, according to the comparison result, the frequency of the target oscillator signal output by the target oscillator includes:

increasing the frequency of a target oscillator signal output by the target oscillator until the first count value is equal to the target count value, if the first count value is less than the target count value;

in the case where the first count value is greater than the target count value, decreasing the frequency of a target oscillator signal output by the target oscillator until the first count value is equal to the target count value.

Optionally, the method further includes:

and setting a tracking step length according to the comparison result, wherein the tracking step length is used for determining the correction amplitude when the frequency of the target oscillator signal output by the target oscillator is corrected.

Optionally, the tracking step size is:

ERVAL=A*|(N-K)|,

wherein, ERVALAnd for the tracking step length, A is a preset coefficient, N is the target counting value, and K is the first counting value.

The technical scheme of the invention has the following beneficial effects:

according to the oscillator device provided by the embodiment of the invention, the target oscillator signal tracks the reference oscillator signal, so that the frequency fluctuation of the target oscillator signal can be reduced, and the target oscillator does not need to use an interface clock, so that the load is lower and the power consumption is lower.

Drawings

Fig. 1 is a schematic structural diagram of an RC oscillator in the prior art;

FIG. 2 is a schematic diagram of a high-speed oscillator using a phase-locked loop in the prior art;

fig. 3 is a schematic structural diagram of an oscillator device according to an embodiment of the present invention;

fig. 4 is a schematic diagram of a preset error range of a target oscillator according to an embodiment of the present invention;

FIG. 5 is a diagram illustrating a first count value according to an embodiment of the present invention;

FIG. 6 is a schematic diagram of tracking steps provided by an embodiment of the present invention;

fig. 7 is a flowchart illustrating an oscillator frequency calibration method according to an embodiment of the present invention.

Detailed Description

In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the drawings of the embodiments of the present invention. It is to be understood that the embodiments described are only a few embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the described embodiments of the invention, are within the scope of the invention.

Fig. 1 is a schematic diagram of an RC oscillator in the prior art. As shown in fig. 1, the general RC oscillator has the advantages of a simple principle, a small size, and low power consumption, but when a clock with a high frequency is output, the frequency change due to temperature is large.

Fig. 2 is a schematic diagram of a high-speed oscillator using a phase-locked loop in the prior art. As shown in fig. 2, a conventional high-speed oscillator using a Phase Locked Loop (PLL) includes a Phase detector, a charge pump, a Loop filter, a voltage controlled oscillator, a frequency divider, etc., which has a complex principle and has advantages of small frequency variation of an output clock signal and real-time tracking of an output frequency, but such an oscillator has a large size and high power consumption, and in a display system, the PLL is over-designed, which may cause an increase in cost.

Therefore, please refer to fig. 3, which is a schematic structural diagram of an oscillator device according to an embodiment of the present invention. As shown in fig. 3, an oscillator device provided in an embodiment of the present invention may include:

a reference oscillator 31 for outputting a reference oscillator signal;

a target oscillator 32 for outputting a target oscillator signal;

the counting module 33 is configured to count the period of the target oscillator signal within a time period from the period of the reference oscillator signal to a preset count value, so as to obtain a first count value;

a comparing module 34, configured to compare the first count value with a target count value to obtain a comparison result;

a correcting module 35, configured to correct a frequency of a target oscillator signal output by the target oscillator according to the comparison result;

wherein the frequency of the reference oscillator signal is lower than the frequency of the target oscillator signal.

In the embodiment of the present invention, the frequency of the reference oscillator signal output by the reference oscillator 31 is low and is almost negligibly affected by the environmental conditions (such as temperature), and after the reference oscillator signal whose frequency is set to a given value is output by the reference oscillator 31, it can be considered that the frequency of the reference oscillator signal output by the reference oscillator 31 will remain unchanged. The frequency of the target oscillator is high and is easily affected by the environmental conditions (such as temperature) in which the target oscillator 32 is set to output a target oscillator signal having a given frequency, and the frequency of the target oscillator signal fluctuates if the temperature of the target oscillator is increased or decreased.

In some embodiments of the invention, the lower the frequency of the reference oscillator signal within a certain frequency range, the higher the confidence of the reference. The reference oscillator signal may be a low-speed clock signal, and the target oscillator signal may be a high-speed clock signal.

In the embodiment of the present invention, the reference oscillator signal output by the reference oscillator 31 is sent to the counting module 33 for counting, and the target oscillator signal output by the target oscillator 32 is also sent to the counting module 33 for counting, where the counting module 33 counts the period of the input signal. The counting value of the reference oscillator signal may be preset, so that the period of the target oscillator signal is also synchronously counted within a time period from the period counting of the reference oscillator signal to the preset counting value to obtain a first counting value, that is, the target oscillator signal is also counted while the period counting of the reference oscillator signal is started, and the counting of the reference oscillator signal and the target oscillator signal is stopped when the period counting value of the reference oscillator signal is preset to obtain the first counting value of the period of the target oscillator signal within the period.

In the embodiment of the present invention, the comparing module 34 is configured to compare the first count value with a target count value to obtain a comparison result of the first count value and the target count value; since the reference oscillator signal is a given value and the target output frequency to be output by the target oscillator is also a determined value, the target count value is uniquely determined when the count value of the period of the reference oscillator signal is determined. Specifically, the target count value may be equal to a target output frequency of the target oscillator multiplied by the preset count value divided by a frequency of the reference oscillator signal. That is, since the reference oscillator signal is a given value and the target output frequency of the target oscillator is also a determined value, the ratio of the two is determined, and the target count value can be uniquely determined when the count value of the period of the reference oscillator signal is determined; for example, if the frequency of the reference oscillator signal is 1MHz, the target output frequency is 100MHz, and the preset count value of the reference oscillator signal is 1, that is, if the cycle number of the reference oscillator signal is 1, the target count value should be equal to the target output frequency 100MHz multiplied by the cycle number 1 of the reference oscillator signal, and then divided by the frequency 1MHz of the reference oscillator signal, so as to finally obtain a target count value of 100; for another example, when the preset count value of the reference oscillator signal is 10, that is, when the number of cycles of the reference oscillator signal is 10, the target count value should be equal to 1000.

Finally, the correcting module 35 is configured to correct the frequency of the target oscillator signal output by the target oscillator according to the comparison result. Thus, by comparing the first count value with the target count value, the difference therebetween can be used as a guide to modify the target oscillator signal output by the target oscillator so that the frequency of the target oscillator signal tends toward the target output frequency.

According to the oscillator device provided by the embodiment of the invention, the target oscillator signal output by the target oscillator tracks the reference oscillator signal output by the reference oscillator, the frequency fluctuation of the target oscillator signal output by the target oscillator can be reduced, and an interface clock is not required to be used due to the adoption of the reference oscillator, so that the load is lower, and the power consumption is lower.

In some embodiments of the present application, the comparison module comprises:

a calculating unit for calculating a difference between the first count value and a target count value;

the oscillator device further includes:

an error control module 36, configured to control the correction module 35 to correct the frequency of the target oscillator signal output by the target oscillator 32 when the difference exceeds a preset error range, and control the correction module to stop correcting the frequency of the target oscillator signal output by the target oscillator 32 when the difference does not exceed the preset error range.

That is to say, the oscillator apparatus in the embodiment of the present invention further includes an error control module 36, the calculating unit in the comparing module 34 is configured to calculate a difference between the first counting value and the target counting value, and the error control module 36 is configured to determine whether to control the correcting module 35 to correct the frequency of the target oscillator signal output by the target oscillator 32 according to the difference calculated by the calculating unit. Specifically, the control and correction module 35 corrects the frequency of the target oscillator signal output by the target oscillator 32 when the difference exceeds the preset error range, and stops correcting the frequency of the target oscillator signal output by the target oscillator 32 when the difference does not exceed the preset error range. Therefore, by setting the preset error range in the error control module, the oscillator device corrects the frequency of the target oscillator signal only when the difference exceeds the preset error range, so that the problem of power consumption increase caused by keeping a correction mode all the time is avoided.

Fig. 4 is a schematic diagram of a preset error range of a target oscillator according to an embodiment of the present invention. As shown in fig. 4, the preset error range may be set according to an operating environment in which the target oscillator 32 is located. For example, in a scenario with a high precision requirement, the preset error range may be ± 1MHz, and in a scenario with a relatively low precision requirement, the preset allowable error range may be ± 2MHz, or even ± 4 MHz.

In this embodiment of the present application, optionally, the modification module 35 includes:

a first correction unit configured to increase a frequency of a target oscillator signal output by the target oscillator until the first count value is equal to the target count value, when the first count value is smaller than the target count value;

a second correction unit configured to decrease the frequency of the target oscillator signal output by the target oscillator until the first count value is equal to the target count value, when the first count value is greater than the target count value.

Since the difference between the first count value and the target count value represents the difference between the frequency of the target oscillator signal currently output by the target oscillator and the target output frequency, when the first count value is smaller than the target count value, which means that the frequency of the target oscillator signal currently output by the target oscillator is lower than the target output frequency, the frequency of the target oscillator signal currently output by the target oscillator should be increased until the first count value is equal to the target count value, that is, the frequency of the target oscillator signal currently output by the target oscillator is equal to the target output frequency; and if the first count value is greater than the target count value, which means that the frequency of the target oscillator signal currently output by the target oscillator is higher than the target output frequency, the frequency of the target oscillator signal currently output by the target oscillator should be decreased until the first count value is equal to the target count value, that is, the frequency of the target oscillator signal currently output by the target oscillator is equal to the target output frequency.

Fig. 5 is a schematic diagram of a first count value according to an embodiment of the present invention. As shown in fig. 5, for example, if the number of cycles of the reference oscillator signal is 1 and the corresponding target count value is N, if the first count value is N +1 or N +2, it means that the frequency of the frequency signal currently output by the target oscillator is higher than the target output frequency, and the frequency of the target oscillator signal output by the target oscillator should be decreased until the first count value is equal to N; and if the first count value is N-1 or N-2, it means that the frequency of the frequency signal currently output by the target oscillator is lower than the target output frequency, and the frequency of the target oscillator signal output by the target oscillator should be increased until the first count value is equal to N.

In other embodiments of the present invention, if a certain preset error range is set by using the error control module, only by adjusting the frequency of the target oscillator signal output by the target oscillator until the difference between the first count value and the target count value falls within the preset error range, the target oscillator signal is output by the target oscillator. For example, if the preset error range is ± 10, that is, the absolute value of the difference between the target count value and the first count value is 10, the frequency of the target oscillator signal output by the target oscillator is only required to be adjusted until the difference between the first count value and the target count value is less than 10.

In this embodiment of the present invention, optionally, the oscillator device further includes:

and a tracking step setting module 37, configured to set a tracking step according to the comparison result, where the tracking step is used to determine a correction amplitude of the correction module when correcting the frequency of the target oscillator signal output by the target oscillator.

That is to say, in the embodiment of the present invention, since the difference between the first count value and the target count value may change to some extent, the embodiment of the present invention may further set the tracking step according to the difference between the first count value and the target count value, that is, the tracking step changes with the change of the difference, so that the target oscillator signal output by the target oscillator better tracks the reference oscillator signal, and meanwhile, the power consumption may also be reduced.

Optionally, the tracking step size is:

ERVAL=A*|(N-K)|,

wherein, ERVALAnd for the tracking step length, A is a preset coefficient, N is the target counting value, and K is the first counting value. The value of a may be set according to the value of | (N-K) |, and if the value of | (N-K) | decreases, the value of a may be set to decrease accordingly, so that the tracking step length decreases, and vice versa.

In other words, the change rule of the tracking step length along with the difference | (N-K) | may be: the larger the difference (N-K) is, the larger the tracking step length is, the smaller the difference (N-K) is, and the smaller the tracking step length is; that is, the larger the difference (N-K) |, the larger the difference is, the larger the difference between the frequency of the target oscillator signal output by the target oscillator and the target output frequency is, the larger the tracking step size should be, i.e., the correction amplitude should be increased, so as to quickly reduce the error, and the smaller the difference (N-K) |, the smaller the difference is, the smaller the difference between the frequency of the target oscillator signal output by the target oscillator and the target output frequency is, so that the output frequency is more accurate, and at this time, the tracking step size can be decreased, i.e., the correction amplitude can be reduced, so as to more accurately and more quickly correct the frequency of the target oscillator signal output by the target oscillator to be consistent with the target output frequency.

Fig. 6 is a schematic diagram of a tracking step according to an embodiment of the present invention. As shown in fig. 6, in the embodiment of the present invention, the size of the tracking step varies with the variation of the difference, so that the target oscillator signal output by the target oscillator better tracks the reference oscillator signal, and the power consumption can be reduced.

According to the oscillator device provided by the embodiment of the invention, the target oscillator signal tracks the reference oscillator signal, so that the frequency fluctuation of the target oscillator signal can be reduced, and the target oscillator does not need to use an interface clock, so that the load is lower and the power consumption is lower.

Fig. 7 is a flowchart illustrating an oscillator frequency calibration method according to an embodiment of the present invention. As shown in fig. 7, another embodiment of the present invention further provides an oscillator frequency calibration method, where the method is an embodiment of a method corresponding to the oscillator apparatus described above, and the method may include the following steps:

step 71: and counting the period of the target oscillator signal output by the target oscillator within the time length from the period counting of the reference oscillator signal output by the reference oscillator to the preset counting value to obtain a first counting value.

In the embodiment of the present invention, specifically, a reference oscillator signal may be output by a reference oscillator, where the reference oscillator signal is a given value; then, presetting a count value of the reference oscillator signal, that is, counting the period of the reference oscillator signal by using a counter and presetting the count value, for example, if the preset count value is 1, that is, if the preset period number of the reference oscillator signal is 1 and the preset count value is 100, the preset period number of the reference oscillator signal is 100; and counting the period of the target oscillator signal output by the target oscillator within the time period from the period of the reference oscillator signal to the preset count value, namely within the time period from 0 counting of the counter to the preset count value of the reference oscillator signal, so as to obtain a first count value.

In the embodiment of the invention, the frequency of the reference oscillator signal is lower than that of the target oscillator signal output by the target oscillator, the reference oscillator signal with lower frequency has better stability and is less influenced by the change of the external environment, the accuracy of frequency reference can be ensured, and the frequency change caused by temperature and the like is reduced. The target oscillator signal output by the target oscillator may be a high-speed clock signal.

Step 72: and comparing the first counting value with a target counting value to obtain a comparison result.

In the embodiment of the invention, the first counting value is compared with the target counting value to obtain a comparison result of the first counting value and the target counting value; since the reference oscillator signal is a given value and the target output frequency to be output by the target oscillator is also a determined value, the target count value is uniquely determined when the count value of the period of the reference oscillator signal is determined.

In an embodiment of the present invention, the target count value may be equal to a target output frequency of the target oscillator multiplied by the preset count value divided by a frequency of the reference oscillator signal. That is, since the reference oscillator signal is a given value and the target output frequency of the target oscillator is also a determined value, the ratio of the two is determined, and the target count value can be uniquely determined when the count value of the period of the reference oscillator signal is determined; for example, if the frequency of the reference oscillator signal is 1MHz, the target output frequency is 100MHz, and the preset count value of the reference oscillator signal is 1, that is, if the cycle number of the reference oscillator signal is 1, the target count value should be equal to the target output frequency 100MHz multiplied by the cycle number 1 of the reference oscillator signal, and then divided by the frequency 1MHz of the reference oscillator signal, so as to finally obtain a target count value of 100; for another example, when the preset count value of the reference oscillator signal is 10, that is, when the number of cycles of the reference oscillator signal is 10, the target count value should be equal to 1000.

Step 73: and correcting the frequency of the target oscillator signal output by the target oscillator according to the comparison result.

Finally, by comparing the first count value with the target count value, the difference between the first count value and the target count value can be used as a guide for correcting the target oscillator signal output by the target oscillator so as to lead the frequency of the target oscillator signal to approach the target output frequency.

According to the oscillator frequency calibration method provided by the embodiment of the invention, the target oscillator signal output by the target oscillator tracks the reference oscillator signal output by the reference oscillator, the frequency fluctuation of the target oscillator signal output by the target oscillator can be reduced, and an interface clock is not required to be used due to the adoption of the reference oscillator, so that the load is lower and the power consumption is lower.

In this embodiment of the present invention, optionally, the comparing the first count value with the target count value to obtain a comparison result includes:

calculating a difference value between the first count value and a target count value;

the correcting the frequency of the target oscillator signal output by the target oscillator according to the comparison result comprises:

and correcting the frequency of the target oscillator signal output by the target oscillator under the condition that the difference value exceeds a preset error range.

That is to say, in the embodiment of the present invention, a difference between the first count value and the target count value may be further calculated, and whether to correct the frequency of the target oscillator signal output by the target oscillator may be determined according to the calculated difference. Specifically, the frequency of the target oscillator signal output by the target oscillator is corrected when the difference exceeds a preset error range, and the correction of the frequency of the target oscillator signal output by the target oscillator is stopped when the difference does not exceed the preset error range. Therefore, by setting the preset error range in the error control module, the oscillator device corrects the frequency of the target oscillator signal only when the difference exceeds the preset error range, so that the problem of power consumption increase caused by keeping a correction mode all the time is avoided.

The correcting the frequency of the target oscillator signal output by the target oscillator according to the comparison result comprises:

increasing the frequency of a target oscillator signal output by the target oscillator until the first count value is equal to the target count value, if the first count value is less than the target count value;

in the case where the first count value is greater than the target count value, decreasing the frequency of a target oscillator signal output by the target oscillator until the first count value is equal to the target count value.

Since the difference between the first count value and the target count value represents the difference between the frequency of the target oscillator signal currently output by the target oscillator and the target output frequency, when the first count value is smaller than the target count value, which means that the frequency of the target oscillator signal currently output by the target oscillator is lower than the target output frequency, the frequency of the target oscillator signal currently output by the target oscillator should be increased until the first count value is equal to the target count value, that is, the frequency of the target oscillator signal currently output by the target oscillator is equal to the target output frequency; and if the first count value is greater than the target count value, which means that the frequency of the target oscillator signal currently output by the target oscillator is higher than the target output frequency, the frequency of the target oscillator signal currently output by the target oscillator should be decreased until the first count value is equal to the target count value, that is, the frequency of the target oscillator signal currently output by the target oscillator is equal to the target output frequency.

In some embodiments of the present invention, optionally, the frequency calibration method further includes:

and setting a tracking step length according to the comparison result, wherein the tracking step length is used for determining the correction amplitude when the frequency of the target oscillator signal output by the target oscillator is corrected.

That is to say, in the embodiment of the present invention, since the difference between the first count value and the target count value may change to some extent, the embodiment of the present invention may further set the tracking step according to the difference between the first count value and the target count value, that is, the tracking step changes with the change of the difference, so that the target oscillator signal output by the target oscillator better tracks the reference oscillator signal, and meanwhile, the power consumption may also be reduced.

Optionally, the tracking step size is:

ERVAL=A*|(N-K)|,

wherein, ERVALAnd for the tracking step length, A is a preset coefficient, N is the target counting value, and K is the first counting value. The value of a may be set according to the value of | (N-K) |, and if the value of | (N-K) | decreases, the value of a may be set to decrease accordingly, so that the tracking step length decreases, and vice versa.

In other words, the change rule of the tracking step length along with the difference | (N-K) | may be: the larger the difference (N-K) is, the larger the tracking step length is, the smaller the difference (N-K) is, and the smaller the tracking step length is; that is, the larger the difference (N-K) |, the larger the difference is, the larger the difference between the frequency of the target oscillator signal output by the target oscillator and the target output frequency is, the larger the tracking step size should be, i.e., the correction amplitude should be increased, so as to quickly reduce the error, and the smaller the difference (N-K) |, the smaller the difference is, the smaller the difference between the frequency of the target oscillator signal output by the target oscillator and the target output frequency is, so that the output frequency is more accurate, and at this time, the tracking step size can be decreased, i.e., the correction amplitude can be reduced, so as to more accurately and more quickly correct the frequency of the target oscillator signal output by the target oscillator to be consistent with the target output frequency.

According to the frequency calibration method provided by the embodiment of the invention, the frequency signal output by the oscillator tracks the reference oscillator signal, so that the frequency fluctuation of the frequency signal output by the oscillator can be reduced, and the oscillator does not need to use an interface clock, so that the load is lower and the power consumption is lower.

While the foregoing is directed to embodiments of the present invention, it will be appreciated by those skilled in the art that various changes and modifications may be made without departing from the principles of the invention, and it is intended that all such changes and modifications be considered as within the scope of the invention.

14页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种数模转换器

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!

技术分类