Disclosure of Invention
The embodiment of the invention provides a crystal oscillator control circuit, a crystal oscillator starting control method and electronic equipment, which are used for realizing rapid crystal oscillator starting and low power consumption in the crystal oscillator starting process.
In a first aspect, an embodiment of the present invention provides a crystal oscillator control circuit, including a crystal oscillator driving module, a signal processing module, a capacitor array control module, a capacitor array module, and a crystal oscillator that are sequentially connected,
The crystal oscillator driving module is used for providing driving energy for the crystal oscillator and outputting a first clock signal generated by the crystal oscillator to the signal processing module;
the signal processing module is used for carrying out preset processing on the received first clock signal to obtain a second clock signal, and outputting the second clock signal to the capacitor array control module;
The capacitor array control module is used for generating a first control signal under the control of the second clock signal and outputting the first control signal to the capacitor array module;
the capacitor array module is used for setting an initial capacitance value of the crystal oscillator under the control of the first control signal, and adjusting the oscillation starting waveform and the oscillation frequency of the crystal oscillator by changing the load capacitance value of the crystal oscillator.
The crystal oscillator control circuit provided by the embodiment of the invention consists of five parts, namely a crystal oscillator driving module, a crystal oscillator, a capacitor array module, a capacitor array control module and a signal processing module. The system comprises a crystal oscillator driving module, a signal processing module, a capacitance array control module and a capacitance array module, wherein the crystal oscillator driving module is connected with the crystal oscillator and is used for providing driving energy for the crystal oscillator and converting a sine wave of crystal oscillation into a square wave to enable the crystal oscillator to maintain reliable piezoelectric oscillation characteristics and output corresponding oscillation waveforms, the signal processing module is used for carrying out preset processing on a received first clock signal to obtain a second clock signal and outputting the second clock signal to the capacitance array control module, the capacitance array control module is used for generating a first control signal under the control of the second clock signal and outputting the first control signal to the capacitance array module so as to realize quick oscillation starting and smooth control of the oscillation starting waveform of the crystal oscillator, and the capacitance array module is connected with the crystal oscillator and is used for setting the initial capacitance value of the oscillation starting of the crystal oscillator under the control of the first control signal sent by the capacitance array control module and adjusting the oscillation starting waveform and oscillation frequency of the crystal oscillator by changing the load capacitance value of the crystal oscillator. Compared with the prior art, the crystal oscillator can rapidly start oscillation through the capacitance value change of the capacitor array module, and meanwhile, the power consumption in the oscillation starting process is reduced.
In one possible implementation, the capacitor array module adjusts the oscillation starting waveform and the oscillation frequency of the crystal oscillator by changing the load capacitance value of the crystal oscillator, and is specifically used for:
when the waveform of the crystal oscillator reaches a preset amplitude, the load capacitance of the crystal oscillator is controlled to reach a target capacitance value by increasing the set capacitance value each time, and the oscillation starting waveform and the oscillation frequency of the crystal oscillator are regulated.
According to the crystal oscillator control circuit provided by the embodiment of the invention, when the waveform of the crystal oscillator reaches the preset amplitude, the load capacitance of the crystal oscillator is controlled to obtain the target capacitance value by increasing the set capacitance value each time, so that the influence on the oscillation waveform of the crystal oscillator can be reduced, and the oscillation waveform of the crystal oscillator is smoother and more stable when the capacitance is regulated.
In one possible implementation, the crystal oscillator is a single external high-frequency crystal oscillator or a single external low-frequency crystal oscillator, and the crystal oscillator driving module, the capacitor array control module and the signal processing module are all arranged inside the chip.
In one possible implementation, the capacitor array module comprises a plurality of capacitor assemblies and switch assemblies connected between each capacitor assembly and a ground wire, wherein each switch assembly is used for performing a switching action according to a first control signal sent by the capacitor array control module so as to control whether the capacitor assembly connected with each switch assembly is connected with the capacitor array module or not.
In one possible implementation, the capacitor array module is further used for adjusting the oscillation starting waveform and the oscillation frequency of the crystal oscillator by changing the load capacitance value of the crystal oscillator, wherein the way of changing the load capacitance value of the crystal oscillator comprises one or more of thermometer coding and binary coding.
In one possible implementation, the capacitive array module is specifically configured to:
The capacitance component with the change of the capacitance value of the load capacitance of the crystal oscillator larger than a preset threshold value adopts a thermometer coding mode;
And a binary coding mode is adopted for the capacitor component of which the capacitance value of the load capacitor of the crystal oscillator is changed by less than or equal to a preset threshold value.
In one possible implementation, the capacitive array control module includes a digital comparator and a up-down counter connected in sequence, wherein,
The digital comparator is used for comparing the first control signal output by the capacitor array control module with the second control signal corresponding to the target capacitance value and outputting an adjusting signal for adjusting the first control signal;
and the bidirectional counter is used for counting the regulating signal output by the digital comparator under the control of the second clock signal and regulating the first control signal according to the counting result.
In one possible implementation, the preset processing of the signal processing module includes one or more of frequency division processing and time delay processing.
In a second aspect, an embodiment of the present invention provides an electronic device, including a crystal oscillator control circuit according to any one of the first aspect of the embodiment of the present invention.
In a third aspect, an embodiment of the present invention provides a method for controlling a crystal oscillator, which is used in the crystal oscillator control circuit in any one of the first aspect of the embodiment of the present invention, where the method includes:
The crystal oscillator driving module drives the crystal oscillator to generate a first clock signal and outputs the first clock signal to the signal processing module;
The signal processing module presets a processing clock signal to obtain a second clock signal, and outputs the second clock signal to the capacitor array control module;
the capacitor array control module generates a first control signal based on the second clock signal and transmits the first control signal to the capacitor array module;
The capacitor array module sets an initial capacitance value of the crystal oscillator based on the control of the first control signal, and adjusts the oscillation starting waveform and oscillation frequency of the crystal oscillator by changing the load capacitance value of the crystal oscillator.
In one possible implementation, the capacitor array module adjusts a start-up waveform and an oscillation frequency of the crystal oscillator by changing a load capacitance value of the crystal oscillator, including:
When the waveform of the crystal oscillator reaches a preset amplitude, the load capacitance is controlled to reach a target capacitance value by increasing the set capacitance value each time, and the oscillation starting waveform and the oscillation frequency of the crystal oscillator are regulated.
Detailed Description
The embodiments of the present invention will be described below with reference to the accompanying drawings, and it should be understood that the embodiments described herein are for illustration and explanation of the present invention only, and are not intended to limit the present invention.
In view of the fact that a stable and rapid crystal oscillation starting mode cannot be provided in the prior art, the embodiment of the invention provides a crystal oscillation control circuit which is used for providing the stable and rapid crystal oscillation starting mode, and achieves rapid crystal oscillation starting and low power consumption.
The following describes the scheme provided by the embodiment of the invention in detail with reference to the accompanying drawings.
As shown in fig. 2, the embodiment of the invention provides a crystal oscillator control circuit, which comprises a crystal oscillator driving module 21, a signal processing module 22, a capacitor array control module 23, a capacitor array module 24 and a crystal oscillator 25 which are sequentially connected, wherein the crystal oscillator driving module 21 is also connected with the crystal oscillator 25,
The crystal oscillator driving module 21 is configured to provide driving energy for the crystal oscillator 25, and output a first clock signal (clk_osc) generated by the crystal oscillator 25 to the signal processing module 22;
The signal processing module 22 is configured to perform a preset process on the received first clock signal (clk_osc) to obtain a second clock signal (ck_r), and output the second clock signal (ck_r) to the capacitor array control module 23;
The capacitor array control module 23 is configured to generate a first control signal (cap_ctl) under the control of the second clock signal (ck_r) output from the signal processing module 22, and output the first control signal (cap_ctl) to the capacitor array module 24.
The capacitor array module 24 is configured to set an initial capacitance for the crystal oscillator 25 to start vibrating under the control of the first control signal (cap_ctl) sent by the capacitor array control module 23, and adjust a start-up waveform and an oscillation frequency of the crystal oscillator 25 by changing a load capacitance value of the crystal oscillator 25.
In the implementation, when the load capacitance value of the crystal oscillator is changed and the oscillation starting waveform and the oscillation frequency of the crystal oscillator are adjusted, the capacitor array module can control the load capacitance of the crystal oscillator to reach the target capacitance value by increasing the set capacitance value each time when the crystal oscillator waveform reaches the preset amplitude so as to adjust the oscillation starting waveform and the oscillation frequency of the crystal oscillator. The preset amplitude may be set according to an empirical value, which is not limited in the embodiment of the present invention.
The initial capacitance may be flexibly set according to an actual scene, for example, the initial capacitance may be 0, or may be a minimum capacitance value or a multiple of the minimum capacitance value of the capacitance array module, where the set capacitance value may be a minimum capacitance adjustment amount of the capacitance array module, or may be a multiple of the minimum capacitance adjustment amount of the capacitance array module.
Of course, it should be noted that, in the process of increasing the set capacitance value to control the load capacitance of the crystal oscillator to reach the target capacitance value each time, the set capacitance value may be fixed, that is, the first control signal is specifically used to adjust the capacitance value of the capacitor array module to start with the initial capacitance and uniformly increase with the set capacitance value as intervals to reach the target capacitance value, the set capacitance value may also be continuously changed, for example, the set capacitance value is smaller when the adjustment starts, and the set capacitance value is continuously increased with the increase of the adjustment time, and of course, the set capacitance value may also be changed with other rules or randomly, which is not limited in the embodiment of the present invention.
In one example, the first control signal (cap_ctl) generated by the capacitive array control module may adjust the capacitance value of the capacitive array module starting from 0 and increasing uniformly at intervals of a minimum capacitance adjustment value of the capacitive array module to reach a target capacitance value.
In particular, after the circuit is enabled, the initial value of the capacitor array is set to 0 by the capacitor array control module 23, that is, cap_ctl=0, the circuit is rapidly started in the minimum load capacitor mode, when the oscillation amplitude of the crystal oscillator 25 increases to a preset value, the crystal oscillator driving module outputs a first clock signal (clk_osc), and after delay and frequency division processing by the signal processing module 22, outputs a second clock signal (ck_r), the capacitor array control module 23 compares the first control signal (cap_ctl) with a second control signal (cap_code) corresponding to the target capacitance value, and since the first control signal (cap_ctl) is smaller than the second control signal (cap_code) at the beginning, the first control signal (cap_ctl) is added with 1 when the rising edge of the second clock signal (ck_r) arrives, and each clock period of the second clock signal (ck_r) is performed once during the comparison until the first control signal (cap_ctl) is equal to the second control signal (cap_code), that is, the capacitor array is adjusted from 0 to the target capacitance value. And the capacitance added each time is the smallest capacitance unit in the capacitance array, so that the influence on the vibration starting waveform is small, and the waveform change is gentle.
Through the scheme, the capacitance value of the capacitor array module is adjusted in the crystal oscillator oscillation starting process, the minimum load capacitance is used for starting oscillation in the crystal oscillator oscillation starting stage, rapid oscillation starting is achieved, the load capacitance of the crystal oscillator is controlled by increasing the set capacitance value each time in the oscillation starting process, the capacitance is gradually adjusted to the target capacitance, the oscillation amplitude of the crystal oscillator is enabled to be small in change, rapid smooth oscillation starting is finally completed, and after the capacitor array is adjusted, the oscillation amplitude is rapidly increased, and finally stability is achieved. Compared with the prior art, the method reduces the power consumption in the vibration starting process while realizing quick vibration starting.
Further, in one possible implementation, the crystal oscillator is a single external high-frequency crystal oscillator or a single external low-frequency crystal oscillator, and the crystal oscillator driving module, the capacitor array control module and the signal processing module are all arranged inside the chip.
The following describes each module in the crystal oscillator control circuit in detail with reference to the accompanying drawings.
As shown in fig. 3, a is a common implementation structure of a crystal oscillating circuit, where a is an inverter structure, and power consumption of a crystal oscillator has a positive correlation with a supply voltage and a positive correlation with a load capacitance. b and c are single ended structures, and since they take the form of a constant tail current, the power consumption is independent of the supply voltage, and is related to the oscillation amplitude and the load capacitance. d is a single-ended structure with an amplitude control module, and the amplitude control module can detect the amplitude of oscillation voltage of the crystal oscillator and give real-time control, so that the power consumption of the circuit is controlled. The power consumption of the circuit is independent of the supply voltage, but dependent on the oscillation amplitude and the load capacitance.
As shown in fig. 4, an equivalent model of the crystal oscillator is shown, where Co, rm, cm, and Lm are intrinsic parameters. C1 and C2 are external load capacitors of the crystal oscillator, can be made on a PCB or in a chip, and can adjust the starting time of the crystal oscillator by changing the size of the load capacitors. The oscillation start time τ of the crystal oscillator can be represented by formula 1, where Re (Z C) is the negative resistance of the oscillation start circuit and can be represented by formula 2:
as shown in fig. 5, for a 24MHz crystal oscillator, the load capacitance has a large effect on the start-up time.
In one possible implementation, the capacitor array module comprises a plurality of capacitor assemblies and switch assemblies connected between each capacitor assembly and a ground line, wherein each switch assembly is used for performing a switching action according to a first control signal (CAP_CTL) sent by the capacitor array control module so as to control whether the capacitor assembly connected with each switch assembly is connected with the capacitor array module or not.
In one possible implementation, the capacitor array module is further used for adjusting the oscillation starting waveform and the oscillation frequency of the crystal oscillator by changing the load capacitance value of the crystal oscillator, wherein the way of changing the load capacitance value of the crystal oscillator comprises one or more of thermometer coding and binary coding.
Specifically, a capacitance component in the capacitance array module, which changes the capacitance value of the load capacitance of the crystal oscillator by more than a preset threshold value, adopts a capacitance thermometer coding mode. And a capacitor component in the capacitor array module, which changes the capacitance value of the load capacitor of the crystal oscillator by less than or equal to a preset threshold value, adopts a binary coding mode. The preset threshold value can be flexibly set according to an empirical value or an actual scene, which is not limited by the embodiment of the invention.
As shown in FIG. 6, the thermometer coded capacitor array has the advantages of small influence on the oscillation waveform and good performance because only one unit capacitor is turned on or off during each adjustment, and the disadvantage of more switches needed and the need of decoding by the controller. As shown in FIG. 7, the binary coded capacitor array has the advantages of small number of required switches, only N switches for N Bit arrays, large disturbance to waveforms during capacitor adjustment and poor performance.
In one possible implementation, for a 10 Bit (Bit) capacitive array, 2 10 or 1024 switches are required if a thermometer coded capacitive array is used, but only 10 switches are required if a binary coded capacitive array is used.
In order to achieve both performance and area, the thermometer coded capacitor array and the binary coded capacitor array can be used in a fused mode, wherein the thermometer coded array is used for high-order bits, and the binary coded array is used for low-order bits. This reduces the number of switches and reduces the disturbance to the waveform during capacitance adjustment.
As shown in fig. 8, the capacitive array control module includes a digital comparator 81 and a UP-DOWN counter 82 connected in sequence, wherein the digital comparator 81 is used for comparing a first control signal (cap_ctl) output by the capacitive array control module with a second control signal (cap_code) corresponding to a target capacitance value, outputting an adjustment signal (UP/DOWN) for adjusting the first control signal (cap_ctl), and the UP-DOWN counter 82 is used for counting the adjustment signal (UP/DOWN) output by the digital comparator 81 under the control of the second clock signal (ck_r) and adjusting the first control signal (cap_ctl) according to the counting result.
The capacitor array control module operates according to the principle that a digital comparator compares a first control signal (CAP_CTL) and a second control signal (CAP_CODE), if the first control signal (CAP_CTL) is larger than the second control signal (CAP_CODE), up=0, down=1, when a clock edge arrives, a down-counter performs a down-1 operation, i.e. the first control signal (CAP_CTL) is decremented by 1, and then performs the next comparison, if the first control signal (CAP_CTL) is smaller than the second control signal (CAP_CODE), up=1, down=0, when the clock edge arrives, the down-counter performs a 1-Up operation, i.e. the first control signal (CAP_CTL) is incremented by 1, and then performs the next comparison, if the first control signal (CAP_CTL) is equal to the second control signal (CAP_CODE), and when the clock edge arrives, the down=0 maintains the original value, and finally the first control signal (CAP_CTL) is equal to the second control signal (CAP_CODE) through a plurality of comparison/counting cycles.
As shown in fig. 9, the signal processing unit is composed of a delay unit 91 and a frequency divider 92. According to the principle of phase noise injection, the signal amplitude is adjusted at the highest point or the lowest point, so that the interference to the signal is minimum, and therefore, the control clock of the counter can be delayed by the delay unit 91 to make the phase shift (for example, 90 degrees) to achieve the best effect. The delay unit 91 has various structures, as shown in fig. 10, a uses an RC low-pass filter to delay the first clock signal (clk_osc), and in fig. 10, b uses a plurality of delay elements connected in series to achieve the purpose of delay. After delay, each time the oscillating signal reaches the peak, the capacitor array is adjusted, so that interference to the signal is reduced, and the specific adjustment process is shown in fig. 11. It should be noted that, the clock of the up-down counter is derived from the crystal oscillator itself, the capacitance is gradually increased in the oscillation starting stage, if the capacitance increases too fast, the oscillation starting amplitude becomes smaller, and the clock is interrupted, so that in order to smoothly switch the load capacitance, the continuous too fast change of the load is avoided, and the clock of the crystal oscillator is divided by the frequency divider 92, thereby controlling the speed of capacitance adjustment.
Fig. 12 and 13 show a comparison between a vibration waveform of a solution provided by the embodiment of the present invention and a vibration waveform of a conventional solution in the prior art during a vibration starting process of a high-frequency crystal oscillator. The sinusoidal waveform at the output of the crystal oscillator is shown in fig. 12, and the first clock signal (clk_osc) waveform converted to a square wave is shown in fig. 13. The first waveform is a conventional oscillation starting waveform for starting oscillation of a target capacitor, compared with the conventional oscillation starting waveform provided by the scheme, the conventional oscillation starting waveform is much slower, the conventional oscillation starting time is about 600 microseconds (mu S), the conventional oscillation starting waveform only needs 200 mu S and the phase difference is 400 mu S, the third waveform represents that the oscillation starts with the minimum load capacitor, after the oscillation starting is completed, the capacitor is adjusted to the target capacitor at one time, and the mode is quick in oscillation starting, but the waveform generates larger disturbance when the capacitor is adjusted, and a period of time is needed after the capacitor is adjusted to re-stabilize the oscillation amplitude of the waveform.
As shown in fig. 14, in the process of starting the low-frequency crystal oscillator, the scheme provided by the embodiment of the invention is compared with the starting waveform of the conventional scheme in the prior art. The first waveform is a crystal oscillator oscillation starting waveform provided by the embodiment of the invention, the crystal oscillator oscillates by the minimum load capacitance, the capacitance is gradually adjusted to the target capacitance in the oscillation starting process, and finally the rapid smooth oscillation starting is finished, and the second waveform is a conventional oscillation starting waveform which oscillates by the target capacitance, and compared with the crystal oscillator oscillation starting speed provided by the scheme, the crystal oscillator oscillation starting waveform is much slower. As can be seen, the conventional start-up time is about 700 milliseconds (mS), whereas the present solution is only 40mS, which is faster by 660mS.
Based on the same inventive thought, the embodiment of the invention also provides electronic equipment, which comprises the crystal oscillator control circuit provided by the embodiment of the invention.
Based on the same inventive concept, as shown in fig. 15, the embodiment of the invention further provides a method for controlling the starting of a crystal oscillator, which is used for the crystal oscillator control circuit provided by the embodiment of the invention, and the method may include the following steps:
Step 1501, a crystal oscillator driving module drives a crystal oscillator to generate a first clock signal and outputs the first clock signal to a signal processing module;
step 1502, a signal processing module presets a processing clock signal to obtain a second clock signal, and outputs the second clock signal to a capacitor array control module;
Step 1503, the capacitor array control module generates a first control signal based on the second clock signal, and transmits the first control signal to the capacitor array module;
In step 1504, the capacitor array module sets an initial capacitance value of the crystal oscillator based on the control of the first control signal, and adjusts the oscillation starting waveform and the oscillation frequency of the crystal oscillator by changing the load capacitance value of the crystal oscillator.
In one possible implementation, the capacitor array module adjusts a start-up waveform and an oscillation frequency of the crystal oscillator by changing a load capacitance value of the crystal oscillator, including:
When the waveform of the crystal oscillator reaches a preset amplitude, the load capacitance is controlled to reach a target capacitance value by increasing the set capacitance value each time, and the oscillation starting waveform and the oscillation frequency of the crystal oscillator are regulated.
The initial capacitance may be flexibly set according to an actual scene, for example, the initial capacitance may be 0, or may be a minimum capacitance value or a multiple of the minimum capacitance value of the capacitance array module, where the set capacitance value may be a minimum capacitance adjustment amount of the capacitance array module, or may be a multiple of the minimum capacitance adjustment amount of the capacitance array module.
In the process of increasing the set capacitance value each time to control the load capacitance of the crystal oscillator to reach the target capacitance value, the set capacitance value can be fixed, namely, the first control signal is specifically used for adjusting the capacitance value of the capacitance array module to start with the initial capacitance and uniformly increase to reach the target capacitance value with the set capacitance value as intervals, the set capacitance value can also be changed continuously, for example, the set capacitance value is smaller when the adjustment is started, and the set capacitance value is increased continuously along with the increase of the adjustment time, and of course, the set capacitance value can also be changed in other rules or randomly.
In one example, the first control signal (cap_ctl) generated by the capacitive array control module may adjust the capacitance value of the capacitive array module starting from 0 and increasing uniformly at intervals of a minimum capacitance adjustment value of the capacitive array module to reach a target capacitance value.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any adaptations, uses, or adaptations of the disclosure following the general principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.