Fast, adaptive oscillator frequency calibration method, circuit, and oscillator system
The oscillator frequency is calibrated by using a counter and a binary approximation algorithm, which solves the problem of oscillator frequency deviation and achieves a fast and low-power frequency calibration effect.
Patent Information
- Application Number
- CN202410233351.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-01
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-03-01
AI Technical Summary
In the prior art, the oscillator frequency is affected by the environment after open-loop operation, resulting in frequency deviation, which affects the accuracy of the clock signal. In addition, the existing calibration method is complex or has high power consumption, making it difficult to quickly calibrate and reduce loop power consumption when the frequency fluctuation is small.
By controlling the counter to count the number of rising and falling edges of the oscillator, initialization and recalibration are performed. The coarse and fine adjustment control words are combined with the binary approximation algorithm to quickly adjust the frequency to the set frequency and reduce loop power consumption.
The system can quickly calibrate the frequency when the oscillator frequency fluctuation is small, thus reducing the loop power consumption and improving the reliability and frequency accuracy of the system.
Smart Images

Figure CN119582840B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a fast and adaptive oscillator frequency calibration method, circuit, oscillator system, equipment and medium. Background Art
[0002] Clock circuits are widely used in the field of Internet of Things technology, especially in the fields of wake-up receivers and variable intermediate frequency receivers.
[0003] Current transceivers often require the use of a phase-locked loop (PLL), or a frequency calibration loop based on a counter can be used to generate a clock signal. This has the advantages of a simple structure, low power consumption and small area.
[0004] In actual use, after the oscillator has been working in open loop for a period of time, it will be affected by the environment, resulting in a certain deviation in the frequency output by the oscillator, which in turn affects the accuracy of the output clock signal. In this case, the frequency output of the oscillator needs to be recalibrated. However, the phase-locked loop is relatively complex and its power consumption is relatively high; the frequency calibration loop based on the counter requires a long time of calibration to output the frequency control word, and then control the frequency accuracy of the clock signal output by the oscillator to meet the requirements. In this process, the frequency output of the oscillator fluctuates greatly, which is not conducive to the reliability of the system.
[0005] Therefore, how to quickly calibrate the frequency of the oscillator while reducing the power consumption of the loop when the frequency fluctuation of the oscillator output is small has become a technical problem that urgently needs to be solved in the industry. Summary of the Invention
[0006] The present invention provides a fast and adaptive oscillator frequency calibration method, circuit, oscillator system, device and medium to solve the problem of how to quickly calibrate the oscillator frequency when the oscillator output frequency fluctuation is small while taking into account the problem of reducing the power consumption of the loop.
[0007] According to a first aspect of the present invention, there is provided a fast, adaptive oscillator frequency calibration method for calibrating the frequency of an oscillator based on a counter, wherein the oscillator is electrically connected to the counter, the method comprising:
[0008] Controlling the counter to count the number of rising edges and falling edges output by the oscillator within a first set time to obtain a first count value;
[0009] Based on a reference clock signal, a set frequency, and the first count value, the oscillator is initialized for frequency calibration, so that the oscillator outputs the set frequency and obtains a corresponding frequency control signal, wherein the frequency control signal includes a plurality of control words arranged in descending order from a high bit to a low bit;
[0010] Controlling the oscillator to be in an open-loop state;
[0011] After a second set time, the oscillator is controlled to enter a closed-loop state from an open-loop state to recalibrate the frequency of the oscillator. The recalibrating the frequency of the oscillator includes:
[0012] Controlling the counter to count the number of rising edges and falling edges output by the oscillator within the first set time to obtain a second count value;
[0013] Obtaining an actual frequency output by the oscillator based on the second count value and the reference clock signal;
[0014] Comparing the actual frequency output by the oscillator with the set frequency to obtain an adjustment word;
[0015] According to the adjustment word bit and the reference clock signal, the control word from the adjustment word bit to the lower bit is adjusted in sequence to recalibrate the frequency of the oscillator so that the oscillator outputs the set frequency and controls the oscillator from the closed-loop state to the open-loop state.
[0016] Optionally, the control word includes a coarse adjustment control word arranged in sequence from the high bit to the i+1th bit, and a fine adjustment control word arranged from the i-th bit to the low bit, and the calibration time required for the fine adjustment control word is greater than the calibration time required for the coarse adjustment control word; wherein i is an integer greater than or equal to 1.
[0017] Optionally, the total calibration time required for the coarse adjustment control word is less than the calibration time required for the fine adjustment control word.
[0018] Optionally, adjust the i-th control word, including:
[0019] Based on the set frequency and the frequency accuracy corresponding to the i-th control word, obtain a reference base value corresponding to the i-th control word, the reference base value including sub-reference base values corresponding to the i-th control word at different times;
[0020] Controlling the counter to count the number of rising edges and falling edges output by the oscillator to obtain a third count value;
[0021] comparing the third count value with the corresponding reference base value in real time within the calibration time corresponding to the i th control word, and adjusting the value of the i th control word based on the comparison result;
[0022] If the deviation between the third count value and the corresponding sub-reference base value is greater than the first threshold value, the counter is controlled to stop updating the third count value, and the value of the i th control word is adjusted based on a bisection approximation method; wherein the first threshold value corresponds to the frequency accuracy of the i th control word;
[0023] If the deviation between the third count value and the corresponding sub-reference base value is less than or equal to the first threshold value, the counter is controlled to continue counting the number of rising edges and falling edges of the oscillator output within the calibration time corresponding to the i th control word, and updating the third count value;
[0024] If the deviation between the third count value and the corresponding sub-reference base value is less than or equal to the first threshold value, and the counting time of the counter is equal to the calibration time corresponding to the i th control word, the counter is controlled to stop updating the third count value, and the value of the i th control word is adjusted based on a bisection approximation method.
[0025] Optionally, the formula of the calibration time required by each control word is:
[0026]
[0027] Wherein, t CNT is the calibration time required by the control word, f0 is the actual frequency of the oscillator, and ppm is the frequency accuracy.
[0028] Optionally, obtaining the control word of the lowest bit includes:
[0029] obtaining a first frequency output by the oscillator corresponding to the control word of the lowest bit being 0, and a second frequency output by the oscillator corresponding to the control word of the lowest bit being 1;
[0030] comparing the first frequency and the second frequency with the set frequency respectively to determine the control word of the lowest bit.
[0031] Optionally, comparing the actual frequency output by the oscillator with the set frequency to obtain the adjustment word includes:
[0032] comparing the actual frequency output by the oscillator with the set frequency, and if the error between the actual frequency of the oscillator and the set frequency is greater than a second threshold value, determining the adjustment word in the bits from the highest bit to the i+1 th bit;
[0033] If the error between the actual frequency output by the oscillator and the set frequency is less than or equal to a second threshold, the adjustment word bit is determined in the i-th to low bits.
[0034] According to a second aspect of the present invention, there is provided a frequency calibration circuit, comprising:
[0035] a first counting unit, configured to control the counter to count the number of rising edges and falling edges output by the oscillator within a first set time to obtain a first count value;
[0036] an initialization frequency calibration unit, configured to perform initialization frequency calibration on the oscillator based on a reference clock signal, a set frequency, and the first count value, so that the oscillator outputs the set frequency and obtains a corresponding frequency control signal, wherein the frequency control signal includes a plurality of control words arranged in order from high to low bits;
[0037] an open-loop control unit, configured to control the oscillator to be in the open-loop state;
[0038] A frequency recalibration unit is used to control the oscillator from an open-loop state to a closed-loop state after a second set time, so as to recalibrate the frequency of the oscillator; wherein the frequency recalibration unit includes:
[0039] a second counting subunit, configured to control the counter to count the number of rising edges and falling edges output by the oscillator within the first set time to obtain a second count value;
[0040] an actual frequency obtaining subunit, configured to obtain an actual frequency output by the oscillator based on the second count value and the reference clock signal;
[0041] an adjustment bit obtaining subunit, configured to compare the actual frequency output by the oscillator with the set frequency to obtain an adjustment bit;
[0042] The frequency recalibration subunit is used to adjust the control words from the adjustment word bit to the lower bit in sequence according to the adjustment word bit and the reference clock signal, so as to recalibrate the frequency of the oscillator so that the oscillator outputs the set frequency.
[0043] According to a third aspect of the present invention, an oscillator system is provided, comprising: an oscillator, a counter, and the frequency calibration circuit according to the second aspect of the present invention.
[0044] According to a fourth aspect of the present invention, there is provided an electronic device comprising the fast and adaptive oscillator frequency calibration method according to the first aspect of the present invention.
[0045] According to a fourth aspect of the present application, a computer readable storage medium is provided, which stores a computer program, and the computer program, when executed by a processor, implements the fast and adaptive oscillator frequency calibration method according to the first aspect of the present application.
[0046] The fast and adaptive oscillator frequency calibration method, circuit, oscillator system, device and medium provided by the present application can quickly calibrate the frequency of the oscillator when the frequency fluctuation of the oscillator is small, and reduce the power consumption of the loop. BRIEF DESCRIPTION OF DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of these drawings.
[0048] Figure 1 is a flowchart of the fast and adaptive oscillator frequency calibration method in an embodiment of the present application Figure One ;
[0049] Figure 2 is a flowchart of the fast and adaptive oscillator frequency calibration method in an embodiment of the present application Figure Two ;
[0050] Figure 3 is a structural diagram of the frequency calibration circuit in an embodiment of the present application Figure One ;
[0051] Figure 4 is a structural diagram of the frequency calibration circuit in an embodiment of the present application Figure Two ;
[0052] Figure 5 is a structural diagram of the oscillator system in an embodiment of the present application
[0053] Figure 6 is a structural diagram of an exemplary electronic device in an embodiment of the present application
[0054] Reference numerals:
[0055] 1 - frequency calibration circuit;
[0056] 2 - oscillator;
[0057] 3 - counter;
[0058] 20 - first counting unit;
[0059] 30 - initialization frequency calibration unit;
[0060] 40 - open loop control unit;
[0061] 50 - frequency re-calibration unit;
[0062] 501 - second counting sub-unit;
[0063] 502 - actual frequency obtaining sub-unit;
[0064] 503 - adjustment word bit obtaining sub-unit;
[0065] 504 - frequency re-calibration sub-unit. DETAILED DESCRIPTION
[0066] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0067] The terms "first", "second", "third", "fourth" and the like (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0068] The technical solutions of the present application will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and some embodiments may not be described again for the same or similar concepts or processes.
[0069] In view of the problem that it is difficult to ensure that the power consumption of the loop is reduced while the frequency of the oscillator is quickly calibrated in the prior art, the present invention provides a fast and adaptive oscillator frequency calibration method, which controls the oscillator to enter an open-loop state after completing the initialization frequency calibration, and controls the oscillator from the open-loop state to a closed-loop state after a second set time, and obtains the actual frequency output by the oscillator, compares the actual frequency output by the oscillator with the set frequency, and obtains the adjustment word bit; according to the adjustment word bit and the reference clock signal, sequentially adjusts the control word from the adjustment word bit to the low bit to recalibrate the frequency of the oscillator, so that the oscillator outputs the set frequency, and controls the oscillator from the closed-loop state to the open-loop state. Therefore, the present invention can quickly calibrate the frequency of the oscillator while reducing the power consumption of the loop when the frequency fluctuation of the oscillator output is small.
[0070] Please refer to Figure 1 An embodiment of the present invention provides a fast and adaptive oscillator frequency calibration method for calibrating the frequency of an oscillator 2 based on a counter 3, wherein the oscillator 2 is electrically connected to the counter 3, and the method includes:
[0071] S11: Control the counter 3 to count the number of rising edges and falling edges output by the oscillator 2 within a first set time to obtain a first count value;
[0072] S12: Based on a reference clock signal, a set frequency, and the first count value, the oscillator 2 is initialized for frequency calibration, so that the oscillator 2 outputs the set frequency and obtains a corresponding frequency control signal, wherein the frequency control signal includes a plurality of control words arranged in descending order from a high bit to a low bit;
[0073] In one embodiment, the initialization frequency calibration of the oscillator 2 in step S12 includes the following steps:
[0074] S121: Obtaining an actual frequency output by the oscillator 2 based on the first count value and the reference clock signal;
[0075] S122: Compare the actual frequency output by the oscillator 2 with the set frequency, and determine the control words from high to low in sequence based on a binary approximation method, so that the oscillator 2 outputs the set frequency and obtains a corresponding frequency control signal.
[0076] S13: Control the oscillator 2 to be in an open-loop state;
[0077] S14: After a second set time, the oscillator 2 is controlled to enter a closed loop state from an open loop state;
[0078] Specifically, after the second set time, the oscillator 2 is controlled to enter a closed loop state from an open loop state to start frequency recalibration of the oscillator 2;
[0079] S15: Control the counter 3 to count the number of rising edges and falling edges output by the oscillator 2 within the first set time to obtain a second count value;
[0080] S16: Obtaining an actual frequency output by the oscillator 2 based on the second count value and the reference clock signal;
[0081] S17: Compare the actual frequency output by the oscillator 2 with the set frequency to obtain an adjustment bit;
[0082] This is because the frequency drift of the oscillator 2 during open-loop operation is not very large, and therefore, there is no need to calibrate all control words of the oscillator 2 as in the initial frequency calibration.
[0083] S18: According to the adjustment word bit and the reference clock signal, adjust the control word from the adjustment word bit to the lower bit in sequence to recalibrate the frequency of the oscillator 2 so that the oscillator 2 outputs the set frequency, and return to S13.
[0084] In one embodiment, the control word includes a coarse adjustment control word arranged in sequence from the highest bit to the i+1th bit, and a fine adjustment control word arranged from the ith bit to the lowest bit, and the calibration time required for the fine adjustment control word is greater than the calibration time required for the coarse adjustment control word; wherein i is an integer greater than or equal to 1.
[0085] In a preferred embodiment, the total calibration time required for the coarse-adjustment control words is less than the calibration time required for the fine-adjustment control words. This is because, in the control process of sequentially determining the control words from high to low bits based on the binary search algorithm, the calibration time required for the higher-order control words can be adaptively reduced as needed, since the frequency accuracy required for the higher-order control words is lower; similarly, the calibration time required for the lower-order control words can be adaptively increased as needed, since the frequency accuracy required for the lower-order control words is higher.
[0086] In actual design, the calibration time required for each fine-tuning control word and the calibration time required for each coarse-tuning control word can also be set to be the same; the present invention is not limited to this, and those skilled in the art can select an appropriate calibration time.
[0087] In this case, the step S17 of comparing the actual frequency output by the oscillator 2 with the set frequency to obtain the adjustment bit includes:
[0088] Comparing the actual frequency output by the oscillator 2 with the set frequency, if the error between the actual frequency of the oscillator 2 and the set frequency is greater than a second threshold, determining the adjustment word bit from the high bit to the (i+1)th bit;
[0089] If the error between the actual frequency output by the oscillator 2 and the set frequency is less than or equal to a second threshold, the adjustment word bit is determined in the i-th to low bits.
[0090] In this case, please refer to Figure 2 , the adjustment of the i-th control word in step S18 includes:
[0091] S181: Based on the set frequency and the frequency accuracy corresponding to the i-th control word, obtain a reference base value corresponding to the i-th control word, where the reference base value includes sub-reference base values corresponding to the i-th control word at different times;
[0092] S182: Control the counter 3 to count the number of rising edges and falling edges output by the oscillator 2 to obtain a third count value;
[0093] S183: within a calibration time corresponding to the i-th control word, comparing the third count value with a corresponding reference base value in real time, and adjusting and correcting the value of the i-th control word based on the comparison result;
[0094] Specifically, within the calibration time corresponding to the i-th control word, the third count value is compared with the corresponding reference base value in real time, and the value of the i-th control word is adjusted and corrected based on the comparison result, wherein:
[0095] If the deviation between the third count value and the corresponding sub-reference base value is greater than a first threshold, controlling the counter 3 to stop counting and adjusting the value of the i-th control word based on a binary approximation method; wherein the first threshold corresponds to the frequency accuracy of the i-th control word;
[0096] If the deviation between the third count value and the corresponding sub-reference base value is less than or equal to the first threshold, controlling the counter 3 to continue counting the number of rising edges and falling edges output by the oscillator 2 within the calibration time corresponding to the i-th control word, and updating the third count value;
[0097] If the deviation between the third count value and the corresponding sub-reference base value is less than or equal to the first threshold, and the counting time of the counter 3 is equal to the calibration time corresponding to the i-th control word, then the counter 3 is controlled to stop counting, and the value of the i-th control word is adjusted and corrected based on the binary approximation method;
[0098] In a specific embodiment, the i-th control word has different reference base values corresponding to different time periods. Taking the case where the reference base value of the i-th control word is 500 during 10 cycles of the reference clock signal and the reference base value of the i-th control word is 1000 during 20 cycles of the reference clock signal as an example, the time required for frequency calibration of the i-th control word of the present invention is described.
[0099] If the third count value is 499 during 10 cycles of the reference clock signal, it is determined that a deviation between the third count value and the corresponding reference base value is less than a first threshold, and further counting is required to improve system accuracy;
[0100] Therefore, the counter 3 is controlled to continue counting the number of rising edges and falling edges output by the oscillator 2 within the calibration time corresponding to the i-th control word, and the third count value is updated;
[0101] When counting to the 20th cycle of the reference clock signal, if the third count value is 995, it is determined that a deviation between the third count value and the corresponding reference base value is greater than a first threshold, and the value of the i-th control word may be adjusted and corrected based on a binary approximation method, and the value of the next control word may be adjusted and corrected;
[0102] If, within the calibration time corresponding to the i-th control word, the difference between the third count value and the corresponding reference base value is less than the first threshold, the counter is controlled to stop updating the third count value, and based on the third count value counted within the calibration time corresponding to the i-th control word, the value of the i-th control word is adjusted and corrected in a binary approximation manner.
[0103] Of course, when initializing the frequency calibration of the oscillator, the above method can also be used to determine each control word, so as to adjust the counting time of each control word in real time and adaptively according to the counting result, thereby reducing the average power consumption of the entire system.
[0104] The calibration time required for each control word corresponds to the frequency accuracy of each control word. The formula for the calibration time required for each control word is:
[0105]
[0106] Among them, t CNT is the calibration time required for the control word, f0 is the actual frequency of the oscillator 2, and ppm is the frequency accuracy.
[0107] Taking the oscillator 2 having a set frequency of 2.4 GHz, including a 6-bit coarse adjustment control word and a 6-bit fine adjustment control word, with each fine adjustment control word corresponding to a resolution of 150 ppm (i.e., 360 kHz), and the reference clock signal having a frequency of 24 MHz as an example, the time required for frequency recalibration of the present invention is described as follows:
[0108] When determining the maximum calibration time, you can refer to the formula
[0109]
[0110] Wherein, CNT is the count value of the counter 3, N is the number of cycles of the reference clock signal, and f REF is the frequency of the reference clock signal, f R0 The frequency is set as described.
[0111] When determining the least significant bit of the control word, the output frequency of the oscillator 2 when the least significant bit of the control word is 0 may differ from the output frequency of the oscillator 2 when the least significant bit of the control word is 1 by 150 ppm. In this case, to further improve the accuracy of the frequency calibration and ensure that the actual frequency output by the oscillator 2 is the set frequency, in one embodiment, determining the least significant bit of the control word includes:
[0112] Obtaining a first frequency output by the oscillator 2 corresponding to a control word with the lowest bit being 0, and a second frequency output by the oscillator 2 corresponding to a control word with the lowest bit being 1;
[0113] The first frequency and the second frequency are respectively compared with the set frequency to determine the least significant control word.
[0114] Assume that the counter 3 counts the number of rising edges and falling edges of the oscillator 2 output corresponding to the least significant bit of the control word being 0 and the least significant bit of the control word being 1, respectively, within 100 clock cycles of the reference clock signal, to obtain a fourth count value and a fifth count value, wherein the difference between the fourth count value and the fifth count value is 3;
[0115] Considering that the counting error of the counter 3 is ±1, the accuracy corresponding to 100 clock cycles of the reference clock signal is low, making it difficult for the oscillator 2 to output the setting signal. Therefore, the calibration time corresponding to the fine-tuning control word should be extended.
[0116] If the counter 3 counts the number of rising edges and falling edges of the oscillator 2 output corresponding to the lowest bit control word being 0 and the lowest bit control word being 1 within 200 clock cycles of the reference clock signal, respectively, to obtain a sixth count value and a seventh count value, wherein the difference between the sixth count value and the seventh count value is 6; the calibration time corresponding to the fine-tuning control word can be corresponded to 200 clock cycles of the reference clock signal (i.e., 8.32us).
[0117] At the same time, since the sum of the calibration time required for the coarse adjustment control word is less than the calibration time required for the fine adjustment control word, when the oscillator 2 includes a 6-bit coarse adjustment control word and a 6-bit fine adjustment control word, the time for initializing the frequency calibration can be controlled within 80us, thereby achieving rapid calibration of the frequency of the oscillator 2 and reducing the power consumption of the loop; if the frequency of the oscillator 2 needs to be recalibrated, it can adjust each control word starting from the adjustment word bit, thereby making the frequency fluctuation of the oscillator 2 output smaller during frequency recalibration.
[0118] In addition, please refer to Figure 3 , an embodiment of the present invention further provides a frequency calibration circuit 1, comprising:
[0119] A first counting unit 20 is used to control the counter 3 to count the number of rising edges and falling edges output by the oscillator 2 within a first set time to obtain a first count value;
[0120] an initialization frequency calibration unit 30 for performing an initialization frequency calibration on the oscillator 2 based on a reference clock signal, a set frequency, and the first count value, so that the oscillator 2 outputs the set frequency and obtains a corresponding frequency control signal, wherein the frequency control signal includes a plurality of control words arranged in descending order from a high bit;
[0121] An open-loop control unit 40, configured to control the oscillator 2 to be in the open-loop state;
[0122] The frequency recalibration unit 50 is used to control the oscillator 2 from the open loop state to the closed loop state after the second set time, so as to recalibrate the frequency of the oscillator 2; wherein, please refer to Figure 4 , the frequency recalibration unit includes:
[0123] A second counting subunit 501 is configured to control the counter 3 to count the number of rising edges and falling edges output by the oscillator 2 within the first set time to obtain a second count value;
[0124] an actual frequency obtaining subunit 502, configured to obtain an actual frequency output by the oscillator 2 based on the second count value and the reference clock signal;
[0125] The adjustment bit obtaining unit 503 is configured to compare the actual frequency output by the oscillator 2 with the set frequency, and obtain an adjustment bit;
[0126] The frequency re-calibration unit 504 is configured to sequentially adjust the control word from the adjustment bit to the low bit according to the adjustment bit and the reference clock signal, so as to perform frequency re-calibration on the oscillator 2, and make the oscillator 2 output the set frequency.
[0127] In addition, referring to Figure 5 The embodiment of the present application further provides an oscillator 2 system, comprising the oscillator 2, the counter 3 and the frequency calibration circuit 1.
[0128] For example, the oscillator 2 can be a ring oscillator, a hysteretic oscillator or the like, and the present application is not limited to the specific form of the oscillator 2.
[0129] In an embodiment, the oscillator system can be an ultra-low power transceiver system, such as a wake-up receiver system, an uncertain intermediate frequency receiver system or the like, or a high-performance transceiver system, such as a mobile phone system or the like, and the frequency calibration circuit 1 provided by the present application can reduce the calibration time of the corresponding oscillator 2 and reduce the power consumption of the transceiver.
[0130] In addition, the embodiment of the present application further provides an electronic device, referring to Figure 6 The electronic device 6 comprises a memory 62, a processor 61 and a program stored in the memory 62 and executable on the processor 61, and the processor 61 can implement the steps of the fast and adaptive oscillator frequency calibration method in the foregoing scheme of the present application when executing the program. The processor 61 can communicate with the memory 62 through a bus 63.
[0131] In addition, the embodiment of the present application further provides a computer readable storage medium, which stores a computer program, and the computer program is executable on the processor to implement the steps of the fast and adaptive oscillator frequency calibration method in the foregoing scheme of the present application.
[0132] The system, device, module or unit illustrated in the foregoing embodiments can be specifically implemented by a computer chip or entity, or by a product with certain functions. A typical implementation device is a computer, and the specific form of the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver device, a game console, a tablet computer, a wearable device or a combination of any of these devices.
[0133] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0134] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0135] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0136] In summary, the embodiment of the present invention controls the oscillator to enter an open-loop state after completing initial frequency calibration, and controls the oscillator to enter a closed-loop state from the open-loop state after a second set time, obtains the actual frequency output by the oscillator, compares the actual frequency output by the oscillator with the set frequency, and obtains the adjustment word bit; based on the adjustment word bit and the reference clock signal, sequentially adjusts the control word from the adjustment word bit to the lower bit to recalibrate the oscillator frequency, so that the oscillator outputs the set frequency, and controls the oscillator to enter an open-loop state from the closed-loop state. Thus, the present invention can quickly calibrate the oscillator frequency when the frequency fluctuation of the oscillator output is small, while also reducing the power consumption of the loop.
[0137] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A fast, adaptive oscillator frequency calibration method for calibrating the frequency of a counter-based oscillator, wherein: The oscillator is electrically connected to the counter, and the method includes: Controlling the counter to count the number of rising edges and falling edges output by the oscillator within a first set time to obtain a first count value; Based on a reference clock signal, a set frequency, and the first count value, the oscillator is initialized for frequency calibration, so that the oscillator outputs the set frequency and obtains a corresponding frequency control signal, wherein the frequency control signal includes a plurality of control words arranged in descending order from a high bit to a low bit; Controlling the oscillator to be in an open-loop state; After a second set time, the oscillator is controlled to enter a closed-loop state from an open-loop state to recalibrate the frequency of the oscillator. The recalibrating the frequency of the oscillator includes: Controlling the counter to count the number of rising edges and falling edges output by the oscillator within the first set time to obtain a second count value; Obtaining an actual frequency output by the oscillator based on the second count value and the reference clock signal; Comparing the actual frequency output by the oscillator with the set frequency to obtain an adjustment bit; According to the adjustment word bit and the reference clock signal, the control word from the adjustment word bit to the lower bit is adjusted in sequence to recalibrate the frequency of the oscillator so that the oscillator outputs the set frequency and controls the oscillator from the closed-loop state to the open-loop state.
2. The fast, adaptive oscillator frequency calibration method according to claim 1, characterized in that: The control word includes a coarse adjustment control word arranged in sequence from the highest bit to the i+1th bit, and a fine adjustment control word arranged from the ith bit to the lowest bit, and the calibration time required for the fine adjustment control word is greater than the calibration time required for the coarse adjustment control word; wherein i is an integer greater than or equal to 1.
3. The fast, adaptive oscillator frequency calibration method according to claim 2, characterized in that: The sum of calibration time required for the coarse adjustment control words is less than the calibration time required for the fine adjustment control words.
4. The fast, adaptive oscillator frequency calibration method according to claim 2, characterized in that: Adjust the i-th control word, including: Based on the set frequency and the frequency accuracy corresponding to the i-th control word, obtain a reference base value corresponding to the i-th control word, the reference base value including sub-reference base values corresponding to the i-th control word at different times; Controlling the counter to count the number of rising edges and falling edges output by the oscillator to obtain a third count value; During the calibration time corresponding to the i-th control word, the third count value is compared with the corresponding reference base value in real time, and the value of the i-th control word is adjusted and corrected based on the comparison result, wherein: If a deviation between the third count value and the corresponding sub-reference base value is greater than a first threshold, controlling the counter to stop updating the third count value and adjusting and correcting the value of the i-th control word based on a binary approximation method; wherein the first threshold corresponds to the frequency accuracy of the i-th control word; If a deviation between the third count value and the corresponding sub-reference base value is less than or equal to a first threshold, controlling the counter to continue counting the number of rising edges and falling edges output by the oscillator within the calibration time corresponding to the i-th control word, and updating the third count value; If the deviation between the third count value and the corresponding sub-reference base value is less than or equal to the first threshold, and the counting time of the counter is equal to the calibration time corresponding to the i-th control word, the counter is controlled to stop updating the third count value, and the value of the i-th control word is adjusted and corrected based on the binary approximation method.
5. The fast, adaptive oscillator frequency calibration method according to claim 4, characterized in that: The formula for the calibration time required for each control word is: Among them, t CNT is the calibration time required for the control word, f0 is the actual frequency of the oscillator, and ppm is the frequency accuracy.
6. The fast, adaptive oscillator frequency calibration method according to claim 5, characterized in that: Get the lowest bit of the control word, including: Obtaining a first frequency output by the oscillator corresponding to a least significant bit of the control word being 0, and a second frequency output by the oscillator corresponding to a least significant bit of the control word being 1; The first frequency and the second frequency are respectively compared with the set frequency to determine the least significant control word.
7. The fast, adaptive oscillator frequency calibration method according to any one of claims 2 to 6, characterized in that: Comparing the actual frequency output by the oscillator with the set frequency to obtain an adjustment word, including: Comparing the actual frequency output by the oscillator with the set frequency, and if the error between the actual frequency of the oscillator and the set frequency is greater than a second threshold, determining the adjustment word bit from the high bit to the (i+1)th bit; If the error between the actual frequency output by the oscillator and the set frequency is less than or equal to a second threshold, the adjustment word bit is determined in the i-th to low bits.
8. A frequency calibration circuit, characterized in that: include: a first counting unit, configured to control a counter to count the number of rising edges and falling edges output by the oscillator within a first set time to obtain a first count value; an initialization frequency calibration unit, configured to perform initialization frequency calibration on the oscillator based on a reference clock signal, a set frequency, and the first count value, so that the oscillator outputs the set frequency and obtains a corresponding frequency control signal, wherein the frequency control signal includes a plurality of control words arranged in order from high to low bits; An open-loop control unit, configured to control the oscillator to be in an open-loop state; A frequency recalibration unit is used to control the oscillator from an open-loop state to a closed-loop state after a second set time, so as to recalibrate the frequency of the oscillator; wherein the frequency recalibration unit includes: a second counting subunit, configured to control the counter to count the number of rising edges and falling edges output by the oscillator within the first set time to obtain a second count value; an actual frequency obtaining subunit, configured to obtain an actual frequency output by the oscillator based on the second count value and the reference clock signal; an adjustment bit obtaining subunit, configured to compare the actual frequency output by the oscillator with the set frequency to obtain an adjustment bit; The frequency recalibration subunit is used to adjust the control words from the adjustment word bit to the lower bit in sequence according to the adjustment word bit and the reference clock signal, so as to recalibrate the frequency of the oscillator so that the oscillator outputs the set frequency.
9. An oscillator system, characterized in that include: An oscillator, a counter, and a frequency calibration circuit as claimed in claim 8.
10. An electronic device, characterized in that: The method comprises a memory, a processor, and a program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 7 when executing the program.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Clock frequency calibration method and device
CN106130547A
Frequency calibration method and circuit
CN108023589A