Miniaturized self-calibration crystal oscillator
By using a microcontroller and frequency adjustment circuit in the self-correcting crystal oscillator, combined with the external second pulse input signal, self-correction of the crystal is achieved, solving the problem of excessive size caused by FPGA in the prior art, and miniaturization and frequency stability are achieved. Effect.
Patent Information
- Application Number
- CN202411167865.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-12-03
AI Technical Summary
The existing self-calibration crystal oscillator requires the use of FPGA to achieve self-calibration function, resulting in a larger overall size and difficult to miniaturize.
The microcontroller is used to realize the self-calibration function, through the frequency adjustment circuit and external second pulse input signal, the crystal frequency is adjusted using the timer and DAC channel to realize the self-calibration of the crystal.
The crystal oscillator is miniaturized, with the smallest overall size of 10mm*10mm, while ensuring the stability and accuracy of frequency.
Smart Images

Figure CN119070744A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of oscillators, in particular to a miniaturized self-calibration crystal oscillator. Background Art
[0002] In some applications, a self-correcting crystal oscillator needs to use an FPGA to implement the self-correction function, but the large size of the FPGA will cause the overall size of the crystal oscillator to be larger. Summary of the invention
[0003] The purpose of the present invention is to provide a miniaturized self-calibration crystal oscillator, which realizes the self-calibration function by using a single chip microcomputer.
[0004] The technical solution adopted by the present invention to achieve its technical purpose is: a miniaturized self-calibration crystal oscillator, including a crystal, a single-chip microcomputer, a frequency adjustment circuit and an external second pulse input signal;
[0005] The external second pulse input signal is connected to the single chip microcomputer;
[0006] The crystal provides an external clock for the single chip microcomputer;
[0007] The single chip microcomputer uses the frequency adjustment circuit to adjust the frequency of the crystal according to the following steps;
[0008] Step A, initializing a timer of the single chip microcomputer;
[0009] Step B, configuring the timer parameters according to the nominal frequency of the crystal so that the timer counts one round for 1s;
[0010] Step C, using a pin as the input capture channel of the timer and connecting it to an external standard second pulse input;
[0011] Step D, when the selected edge appears on the pin, immediately capture the current value of the counter;
[0012] Step E: If the current actual frequency of the crystal captures the same value every 1s, then stop the adjustment step and end; if the current actual frequency of the crystal captures different values every 1s, then turn to step F;
[0013] Step F, by calculating the difference between the current captured value and the previous captured value, the frequency offset of the crystal is obtained; then, according to the adjustment amount of the crystal frequency by the unit voltage, the voltage value for adjusting the current crystal frequency offset is calculated; the voltage value of the input frequency adjustment circuit is continuously changed so that the crystal oscillator frequency is stabilized near the nominal frequency, thereby completing the self-calibration of the crystal oscillator.
[0014] Further, in the above-mentioned miniaturized self-calibration crystal oscillator: the frequency adjustment circuit includes a varactor diode D1, a varactor diode D2, a resistor R20, a resistor R21, a resistor R22, a capacitor C32, a capacitor C33, and a capacitor C34;
[0015] A DAC channel for adjusting the crystal frequency of the single chip microcomputer is connected to the crystal in sequence through a series resistor R20, a resistor R21, a resistor R22 and a varactor diode D1, and the anode of the varactor diode D1 is connected to the crystal;
[0016] Capacitor C32, capacitor C33 and capacitor C34 are grounded between resistor R20 and resistor R21, resistor R21 and resistor R22, and resistor R22 and the cathode of varactor diode D1, respectively;
[0017] The cathode of the varactor diode D2 is connected to the connecting wire between the resistor R22 and the cathode of the varactor diode D1, and the anode is grounded.
[0018] Furthermore, in the above-mentioned miniaturized self-calibration crystal oscillator: the crystal provides an external clock for the single-chip microcomputer, including a 100M crystal Y1 and an oscillation circuit, the oscillation circuit includes an inverter U7, an inverter U8 and a rising edge triggered D-type flip-flop U5; an inductor L1 is connected across pins 1 and 3 of the crystal Y1, pins 2 and 4 of the crystal Y1 are grounded, pin 1 of the crystal Y1 is connected to the input end of the inverter U7 after being filtered by the first filtering circuit, pin 3 of the crystal Y1 is connected to the output end of the inverter U7 after being filtered by the second filtering circuit, the output end of the inverter U7 is coupled to the input end of the inverter U8 through a coupling capacitor C24, the output end of the inverter U8 is coupled to the CLK end of the rising edge triggered D-type flip-flop U5 through a coupling capacitor C17, and the output clock signal (SYSCLK) of the rising edge triggered D-type flip-flop U5 is connected to the single-chip microcomputer.
[0019] Furthermore, in the above-mentioned miniaturized self-calibration crystal oscillator: inverter U7 and inverter U8 both use a single-channel 2V to 5.5V inverter of model SN74AHC1G04.
[0020] Furthermore, in the above-mentioned miniaturized self-calibration crystal oscillator: the rising edge triggered D-type flip-flop U5 adopts a rising edge triggered D-type flip-flop of model SN 74LVC1G80.
[0021] Furthermore, in the above-mentioned miniaturized self-calibration crystal oscillator: the first filtering circuit includes an inductor L2, a capacitor C26, a capacitor C28, a capacitor C29, and a resistor R23; the pin 1 of the crystal Y1 is connected to one end of the parallel capacitor C28 and the capacitor C29 through the inductor L2, the other end of the parallel capacitor C28 and the capacitor C29 is connected to one end of the resistor R23 and the capacitor C26, the other end of the resistor R23 is grounded, and the other end of the capacitor C26 is connected to the input end of the inverter U7.
[0022] Furthermore, in the above-mentioned miniaturized self-calibration crystal oscillator: the second filtering circuit includes an inductor L3, a capacitor C30, a capacitor C31, a capacitor C27, and a resistor R19; the pin 3 of the crystal Y1 is respectively connected to one end of the inductor L3, the capacitor C30, the capacitor C31, and the resistor R19, the other ends of the inductor L3, the capacitor C30, and the capacitor C31 are grounded, and the other end of the resistor R19 is connected to the output end of the inverter U7 through the capacitor C27.
[0023] Furthermore, in the above-mentioned miniaturized self-calibration crystal oscillator: the single chip microcomputer adopts a single chip microcomputer of model GD32F350GX.
[0024] The present invention uses only one single chip microcomputer to realize the self-correction function, thereby reducing the overall size of the crystal oscillator to a minimum of 10 mm*10 mm.
[0025] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Attached Figure 1 Principle block diagram of a miniaturized self-calibrating crystal oscillator according to Embodiment 1 of the present invention;
[0027] Attached Figure 2 Schematic diagram of the crystal, oscillator circuit and peripheral circuit of embodiment 1 of the present invention;
[0028] Attached Figure 3 A connection diagram of a single chip microcomputer used in Embodiment 1 of the present invention;
[0029] Attached Figure 4 The frequency adjustment circuit in embodiment 1 of the present invention. DETAILED DESCRIPTION
[0030] This embodiment is a miniaturized self-calibrated crystal oscillator. Figure 1 As shown: including crystal, single chip microcomputer, frequency adjustment circuit and external second pulse input signal;
[0031] The external second pulse input signal is connected to the single chip microcomputer;
[0032] The crystal provides an external clock for the microcontroller;
[0033] The microcontroller uses the frequency adjustment circuit to adjust the frequency of the crystal according to the following steps;
[0034] Step A, initializing a timer of the single chip microcomputer;
[0035] Step B, configuring the timer parameters according to the nominal frequency of the crystal so that the timer counts one round for 1s;
[0036] Step C, using a pin as the input capture channel of the timer and connecting it to an external standard second pulse input;
[0037] Step D, when the selected edge appears on the pin, immediately capture the current value of the counter;
[0038] Step E: If the current actual frequency of the crystal captures the same value every 1s, then stop the adjustment step and end; if the current actual frequency of the crystal captures different values every 1s, then turn to step F;
[0039] Step F, by calculating the difference between the current captured value and the previous captured value, the frequency offset of the crystal is obtained; then, according to the adjustment amount of the crystal frequency by the unit voltage, the voltage value for adjusting the current crystal frequency offset is calculated; the voltage value of the input frequency adjustment circuit is continuously changed so that the crystal oscillator frequency is stabilized near the nominal frequency, thereby completing the self-calibration of the crystal oscillator.
[0040] Specific:
[0041] like Figure 2 As shown in the figure, taking 100M crystal Y1 as an example, the oscillator circuit and peripheral circuit provide 100M SYSCLK signal for the microcontroller. The microcontroller model is GD32F350GX. Figure 3 As shown,
[0042] The specific circuit of the oscillator is as follows Figure 2 As shown: the crystal provides an external clock for the single-chip microcomputer, including a 100M crystal Y1 and an oscillation circuit and other peripheral circuits. The oscillation circuit includes an inverter U7, an inverter U8 and a rising edge triggered D-type flip-flop U5; an inductor L1 is connected across pins 1 and 3 of the crystal Y1, pins 2 and 4 of the crystal Y1 are grounded, pin 1 of the crystal Y1 is filtered by the first filtering circuit and then connected to the input end of the inverter U7, pin 3 of the crystal Y1 is filtered by the second filtering circuit and then connected to the output end of the inverter U7, the output end of the inverter U7 is coupled to the input end of the inverter U8 through a coupling capacitor C24, the output end of the inverter U8 is coupled to the CLK end of the rising edge triggered D-type flip-flop U5 through a coupling capacitor C17, and the output clock signal SYSCLK of the rising edge triggered D-type flip-flop U5 is connected to the single-chip microcomputer.
[0043] In this embodiment, the inverter U7 and the inverter U8 are both single-channel 2V to 5.5V inverters of model SN74AHC1G04. The rising edge triggered D-type flip-flop U5 is a rising edge triggered D-type flip-flop of model SN74LVC1G80.
[0044] Wherein: the first filtering circuit includes an inductor L2, a capacitor C26, a capacitor C28, a capacitor C29, and a resistor R23; the pin 1 of the crystal Y1 is connected to one end of the parallel capacitor C28 and the capacitor C29 through the inductor L2, the other end of the parallel capacitor C28 and the capacitor C29 is connected to one end of the resistor R23 and the capacitor C26, the other end of the resistor R23 is grounded, and the other end of the capacitor C26 is connected to the input end of the inverter U7. The second filtering circuit includes an inductor L3, a capacitor C30, a capacitor C31, a capacitor C27, and a resistor R19; the pin 3 of the crystal Y1 is connected to one end of the inductor L3, the capacitor C30, the capacitor C31, and the resistor R19 respectively, the other ends of the inductor L3, the capacitor C30, and the capacitor C31 are grounded, and the other end of the resistor R19 is connected to the output end of the inverter U7 through the capacitor C27.
[0045] In this embodiment, the frequency adjustment circuit is as follows: Figure 4 As shown, by utilizing a DAC channel of a single-chip microcomputer, an adjustable voltage is output and added to the varactor diode D1 and the varactor diode D2, and the capacitance thereof is changed, so that the frequency of the crystal can be adjusted.
[0046] Including varactor diode D1, varactor diode D2, resistor R20, resistor R21, resistor R22, capacitor C32, capacitor C33, capacitor C34;
[0047] The DAC channel for adjusting the crystal frequency of the single-chip microcomputer is connected to the crystal through the series resistor R20, the resistor R21, the resistor R22 and the varactor diode D1 in sequence, and the anode of the varactor diode D1 is connected to the crystal;
[0048] Capacitor C32, capacitor C33 and capacitor C34 are grounded between resistor R20 and resistor R21, resistor R21 and resistor R22, and resistor R22 and the cathode of varactor diode D1, respectively;
[0049] The cathode of the varactor diode D2 is connected to the connecting wire between the resistor R22 and the cathode of the varactor diode D1, and the anode is grounded.
[0050] like Figure 3As shown in the figure: Taking the GD32F350GX microcontroller as an example, a crystal is used to provide the microcontroller with an external clock signal SYSCLK as the system clock, a timer of the microcontroller is initialized, and the timer is configured with parameters according to the nominal frequency of the crystal, so that the timer counts once for 1s. The microcontroller uses a pin 1PPS as the input capture channel of the timer and is connected to the external standard second pulse input. Whenever the selected edge appears on the input pin, the current value of the counter is captured immediately. If the current actual frequency of the crystal is the nominal frequency, then theoretically the capture value is the same every 1s. If the capture value is different, it means that the current actual frequency of the crystal has shifted.
[0051] By calculating the difference between the current captured value and the previous captured value, the frequency offset of the crystal can be obtained; then, according to the adjustment amount of the crystal frequency by the unit voltage, the voltage value for adjusting the current crystal frequency offset can be calculated. By continuously changing the voltage value through the external standard second pulse signal, the crystal frequency is stabilized near the nominal frequency, thereby realizing the self-correction function of the crystal oscillator.
Claims
1. A miniaturized self-calibrating crystal oscillator, comprising a crystal, characterized in that: It also includes a single chip microcomputer, a frequency adjustment circuit and an external second pulse input signal; The external second pulse input signal is connected to the single chip microcomputer; The crystal provides an external clock for the single chip microcomputer; The single chip microcomputer uses the frequency adjustment circuit to adjust the frequency of the crystal according to the following steps; Step A, initializing a timer of the single chip microcomputer; Step B, configuring the timer parameters according to the nominal frequency of the crystal so that the timer counts one round for 1s; Step C, using a pin as the input capture channel of the timer and connecting it to an external standard second pulse input; Step D, when the selected edge appears on the pin, immediately capture the current value of the counter; Step E: If the current actual frequency of the crystal captures the same value every 1s, stop the adjustment step and end; If the actual frequency of the crystal is different every 1s, go to step F; Step F, by calculating the difference between the current captured value and the previous captured value, the frequency offset of the crystal is obtained; then, according to the adjustment amount of the crystal frequency by the unit voltage, the voltage value for adjusting the current crystal frequency offset is calculated; the voltage value of the input frequency adjustment circuit is continuously changed so that the crystal oscillator frequency is stabilized near the nominal frequency, thereby completing the self-calibration of the crystal oscillator.
2. The miniaturized self-calibrating crystal oscillator according to claim 1, characterized in that: The frequency adjustment circuit includes a varactor diode D1, a varactor diode D2, a resistor R20, a resistor R21, a resistor R22, a capacitor C32, a capacitor C33, and a capacitor C34; A DAC channel for adjusting the crystal frequency of the single chip microcomputer is connected to the crystal in sequence through a series resistor R20, a resistor R21, a resistor R22 and a varactor diode D1, and the anode of the varactor diode D1 is connected to the crystal; Capacitor C32, capacitor C33 and capacitor C34 are grounded between resistor R20 and resistor R21, resistor R21 and resistor R22, and resistor R22 and the cathode of varactor diode D1, respectively; The cathode of the varactor diode D2 is connected to the connecting wire between the resistor R22 and the cathode of the varactor diode D1, and the anode is grounded.
3. The miniaturized self-calibrating crystal oscillator according to claim 1, characterized in that: The crystal provides an external clock for the single-chip microcomputer, including a 100M crystal Y1 and an oscillation circuit, wherein the oscillation circuit includes an inverter U7, an inverter U8 and a rising edge triggered D-type flip-flop U5; an inductor L1 is connected between pins 1 and 3 of the crystal Y1, pins 2 and 4 of the crystal Y1 are grounded, pin 1 of the crystal Y1 is connected to the input end of the inverter U7 after being filtered by the first filtering circuit, pin 3 of the crystal Y1 is connected to the output end of the inverter U7 after being filtered by the second filtering circuit, the output end of the inverter U7 is coupled to the input end of the inverter U8 through a coupling capacitor C24, the output end of the inverter U8 is coupled to the CLK end of the rising edge triggered D-type flip-flop U5 through a coupling capacitor C17, and the output clock signal (SYSCLK) of the rising edge triggered D-type flip-flop U5 is connected to the single-chip microcomputer.
4. The miniaturized self-calibrating crystal oscillator according to claim 3, characterized in that: Inverter U7 and inverter U8 are both single-channel 2V to 5.5V inverters of model SN74AHC1G04.
5. The miniaturized self-calibrating crystal oscillator according to claim 3, characterized in that: The rising edge triggered D-type flip-flop U5 adopts a rising edge triggered D-type flip-flop of model SN74LVC1G80.
6. The miniaturized self-calibrating crystal oscillator according to claim 3, characterized in that: The first filtering circuit includes an inductor L2, a capacitor C26, a capacitor C28, a capacitor C29, and a resistor R23; the pin 1 of the crystal Y1 is connected to one end of the parallel capacitor C28 and the capacitor C29 through the inductor L2, the other end of the parallel capacitor C28 and the capacitor C29 is connected to one end of the resistor R23 and the capacitor C26, the other end of the resistor R23 is grounded, and the other end of the capacitor C26 is connected to the input end of the inverter U7.
7. The miniaturized self-calibrating crystal oscillator according to claim 3, characterized in that: The second filtering circuit includes an inductor L3, a capacitor C30, a capacitor C31, a capacitor C27, and a resistor R19; pin 3 of crystal Y1 is connected to one end of the inductor L3, the capacitor C30, the capacitor C31, and the resistor R19 respectively, the other ends of the inductor L3, the capacitor C30, and the capacitor C31 are grounded, and the other end of the resistor R19 is connected to the output end of the inverter U7 through the capacitor C27.
8. The miniaturized self-calibrated crystal oscillator according to any one of claims 1 to 7, characterized in that: The single chip microcomputer used is GD32F350GX.
Citation Information
Cited By
Crystal oscillator capable of self-correction without external second pulse input
CN224909443U
