Disclosure of Invention
The present invention is directed to the problem in the prior art, and provides a method for estimating a crystal oscillator frequency, which enables an XO to be applied to a wider range of electronic products (e.g., GNSS receivers), estimates the frequency of the XO, and enables the XO to be used at any temperature. By using the method, the device can achieve the same frequency deviation range performance as that of the TCXO, and can be used in a plurality of products.
In order to achieve the above object, a technical solution of the present invention is a method for estimating a crystal oscillator frequency, the method including the steps of:
step 1) in factory production, storing a default temperature frequency characteristic curve into a nonvolatile memory for each device;
step 2) in factory production, for each device, measuring the frequency deviation of the crystal oscillator at a temperature, and storing the frequency deviation into a nonvolatile memory;
step 3) updating the frequency offset in the lookup table when the device is used for the first time;
step 4), reading the temperature by the device, and estimating the frequency of the current crystal oscillator by using the updated lookup table;
and 5) operating the functional module, and updating the lookup table according to the output of the functional module.
As a modification of the present invention, in the step 1), a crystal temperature frequency characteristic curve is represented as df0(T), where T is the crystal temperature, and the curve is generally determined by the cutting mode and the cutting angle in the production process; in the same cutting mode, the curve of each crystal oscillator is also different and is generated by the difference of crystals and the cutting angle and other controls of production. For the same model and batch of crystal oscillators, the same temperature-frequency characteristic curve is used, and the curve is written into a Non-volatile Memory (Non-volatile Memory) in the device production process according to a lookup table (for example, 1C one point). The temperature frequency characteristic curve can be provided by a crystal oscillator supplier, or can be obtained by averaging the temperature frequency characteristic curves at various temperature points after measuring several crystal oscillators in a laboratory by a device manufacturer. Due to the frequency of the crystal in the device, it is also related to the load capacitance of the crystal in each device. The actual frequency of the crystal in the device is therefore considered to be the frequency offset value (df0(T), determined by temperature) plus an offset (df _ lc, determined by the load capacitance) in this look-up table; this offset varies from device to device. The actual frequency deviation value of the crystal oscillator frequency is expressed by the following formula:
df(T)=df0(T)+df_lc;
if the step size of the temperature is 1C, then T ═ 30C, -29C, -28C, …,83C,84C,85C, i.e. a look-up table with a total of 126 rows.
It can be seen that the content df0(T) written in the factory production of the device by this default lookup table is a relative value between the respective temperatures, and not an actual value of the crystal frequency in the device
As an improvement of the present invention, in the step 2), in order to obtain an actual value of the crystal frequency offset in one device at a certain temperature, the crystal frequency in each device needs to be measured on a production line of a factory. The crystal oscillator in the device uses an external thermistor to measure the crystal oscillator temperature, or uses an internal thermistor to measure the crystal oscillator temperature (i.e. a thermistor crystal oscillator), the device needs an analog-to-digital converter (ADC) to obtain the value of the temperature, and if a device is measured on a factory production line, the temperature of the crystal oscillator is T1, and the measured crystal oscillator frequency is df1(T1), then the following results are obtained:
df1(T1)=df0(T1)+df_lc;
thus, it is possible to solve:
df_lc=df1(T1)–df0(T1);
the device stores the value df _ lc in non-volatile memory.
Measuring the frequency offset of the crystal in the device at the factory may use one of a number of methods. For example, a single frequency signal with a known frequency may be input to the device, and the frequency of the signal is measured by Fast Fourier Transform (FFT) inside the device, and the measured frequency will have a corresponding offset due to the crystal frequency offset, and the crystal frequency offset may be calculated from the offset. Another method is that a single frequency signal is sent by a device to a receiving device on the factory production line, the receiving device measures the frequency of the signal through FFT, the measured frequency has a corresponding offset due to the crystal frequency offset, and the crystal frequency offset can be calculated from the offset.
As an improvement of the present invention, in step 3), after the above two steps are completed, when the device is powered on for the first time after being taken out of the factory, the df _ lc obtained in step 2) and the default lookup table df0(T) stored in step 1) are read from the non-volatile memory, and the actual frequency offset of the crystal oscillator at each temperature point is calculated:
df(T)=df0(T)+df_lc=df0(T)+df1(T1)–df0(T1);
thus obtaining the initial estimated value of the actual frequency deviation of the crystal oscillator under all temperatures (-30C to 85C), df (T);
the device stores these initial estimates in the non-volatile memory, and the device may choose to replace the corresponding values df0(T) in the look-up table of step 1) with these initial estimates df (T), or store df (T) in a new look-up table in the non-volatile memory. The lookup table storing df (t) is referred to hereinafter as the "df lookup table".
As an improvement of the present invention, in the step 4), the df lookup table functions as: in the subsequent use of the device, when the crystal oscillator bias needs to be known (for example, before GNSS signal acquisition or before cellular signal acquisition), the temperature of the crystal oscillator is read, and then an estimated value of the current frequency of the crystal oscillator is obtained in the df lookup table, and the estimated value of the current frequency of the crystal oscillator can help a GNSS module or a cellular system (for example, 4G LTE, NB-IoT, 5G) receiving module to quickly acquire a signal, so that the user experience is greatly improved.
As an improvement of the present invention, in the step 5), since the frequency of the GNSS signal and the frequency of the downlink signal of the cellular system are known, after the GNSS module or the cellular system receiving module captures the signal, the current frequency of the crystal oscillator is estimated more accurately according to the frequency of the signal. For example. The true frequency offset of the crystal oscillator is expressed as d in ppm. When the cellular system receiver obtains the frequency of the signal after acquiring and/or tracking that is f1 (knowing that the frequency of the signal transmitted from the base station is f), it can estimate that the frequency offset of the crystal oscillator is d1 ═ f1-f)/f × 1e6, which is ppm. In the above example, assuming that the true frequency offset of the crystal oscillator is d-4.3 ppm and f-800 MHz, if the frequency of the captured signal is f1 (800MHz +4kHz), then the estimated frequency offset is (f1-f)/f 1e6 (800MHz +4kHz-800MHz)/800MHz 1e6 is 5ppm.
Compared with the prior art, the method has the advantages that 1) the method in the technical scheme is simpler and more reliable; 2) the method has no any requirement on the variation curve of the crystal oscillator frequency along with the temperature, reduces the production cost of the crystal oscillator and increases the selection of equipment manufacturers on crystal oscillator suppliers;
The specific implementation mode is as follows:
for the purpose of enhancing an understanding of the present invention, the present embodiment will be described in detail below with reference to the accompanying drawings. In this application, a "device" refers to any electronic device or terminal using a crystal oscillator, such as a mobile phone, an internet of things module or terminal, a GNSS receiver, and so on.
Example 1: referring to fig. 1, a method of estimating a crystal oscillator frequency, the method comprising the steps of:
step 1) in factory production, storing a default temperature frequency characteristic curve into a nonvolatile memory for each device;
step 2) in factory production, for each device, measuring the frequency deviation of the crystal oscillator at a temperature, and storing the frequency deviation into a nonvolatile memory;
step 3) updating the frequency offset in the lookup table when the device is used for the first time;
step 4), reading the temperature by the device, and estimating the frequency of the current crystal oscillator by using the updated lookup table;
and 5) operating the functional module, and updating the lookup table according to the output of the functional module.
In the step 1), a crystal oscillator temperature frequency characteristic curve is represented as df0(T), wherein T is the crystal oscillator temperature, and the curve is generally determined by a cutting mode and a cutting angle in a production process; for the same model and batch of crystal oscillators, the same temperature-frequency characteristic curve is used, and the curve is written into a Non-volatile Memory (Non-volatile Memory) in the device production process according to a lookup table (for example, 1C one point). The actual frequency of the crystal in the device is therefore considered to be the frequency offset value (df0(T), determined by temperature) plus an offset (df _ lc, determined by the load capacitance) in this look-up table; this offset varies from device to device. The actual frequency deviation value of the crystal oscillator frequency is expressed by the following formula:
df(T)=df0(T)+df_lc;
if the step size of the temperature is 1C, then T ═ 30C, -29C, -28C, …,83C,84C,85C, i.e. a look-up table with a total of 126 rows.
It can be seen that the content df0(T) written in the factory production of the device by this default look-up table is a relative value between the respective temperatures, and not an actual value of the crystal frequency in the device.
In the step 2), in order to obtain an actual value of the frequency offset of the crystal oscillator in one device at a certain temperature, the frequency of the crystal oscillator in each device needs to be measured on a production line of a factory. The crystal oscillator in the device uses an external thermistor to measure the crystal oscillator temperature, or uses an internal thermistor to measure the crystal oscillator temperature (i.e. a thermistor crystal oscillator), the device needs an analog-to-digital converter (ADC) to obtain the value of the temperature, and if a device is measured on a factory production line, the temperature of the crystal oscillator is T1, and the measured crystal oscillator frequency is df1(T1), then the following results are obtained:
df1(T1)=df0(T1)+df_lc;
thus, it is possible to solve:
df_lc=df1(T1)–df0(T1);
the device stores the value df _ lc in non-volatile memory.
Measuring the frequency offset of the crystal in the device at the factory may use one of a number of methods. For example, a single frequency signal with a known frequency may be input to the device, and the frequency of the signal is measured by Fast Fourier Transform (FFT) inside the device, and the measured frequency will have a corresponding offset due to the crystal frequency offset, and the crystal frequency offset may be calculated from the offset. Another method is that a single frequency signal is sent by a device to a receiving device on the factory production line, the receiving device measures the frequency of the signal through FFT, the measured frequency has a corresponding offset due to the crystal frequency offset, and the crystal frequency offset can be calculated from the offset.
In step 3), after the above two steps are completed, when the device is powered on for the first time after leaving the factory, the df _ lc obtained in step 2) and the default lookup table df0(T) stored in step 1) are read from the nonvolatile memory, and the actual frequency offset of the crystal oscillator at each temperature point is calculated:
df(T)=df0(T)+df_lc=df0(T)+df1(T1)–df0(T1);
thus obtaining the initial estimated value of the actual frequency deviation of the crystal oscillator under all temperatures (-30C to 85C), df (T);
the device stores these initial estimates in the non-volatile memory, and the device may choose to replace the corresponding values df0(T) in the look-up table of step 1) with these initial estimates df (T), or store df (T) in a new look-up table in the non-volatile memory.
In the step 4), the df lookup table functions as: in the subsequent use of the device, when the crystal oscillator bias needs to be known (for example, before GNSS signal acquisition or before cellular signal acquisition), the temperature of the crystal oscillator is read, and then an estimated value of the current frequency of the crystal oscillator is obtained in the df lookup table, and the estimated value of the current frequency of the crystal oscillator can help a GNSS module or a cellular system (for example, 4G LTE, NB-IoT, 5G) receiving module to quickly acquire a signal, so that the user experience is greatly improved.
In the step 5), since the frequency of the GNSS signal and the frequency of the downlink signal of the cellular system are known, after the GNSS module or the cellular system receiving module captures the signal, the current frequency of the crystal oscillator is estimated more accurately according to the frequency of the signal.
The specific embodiment is as follows: referring to fig. 1-3, the present application proposes a method of estimating the frequency of a crystal oscillator (XO). The working principle is as follows, as shown in figure 2:
step 1): in factory production, for a crystal oscillator of one model, a default temperature frequency characteristic curve, namely the change curve information of frequency deviation (frequency offset) along with temperature is stored in a nonvolatile memory in an electronic device according to a lookup table format;
step 2): in factory production test, for each device, measuring the frequency deviation of a crystal oscillator at a temperature;
step 3): when the device is used for the first time, updating the frequency offsets at all temperatures in the lookup table according to the measurement result of a factory;
step 4): the device reads the temperature and then uses a look-up table to estimate the crystal frequency offset at any time. The frequency deviation information of the crystal oscillator is used for a functional module (such as a cellular system transceiver module and a GNSS positioning module) in a device to greatly reduce the signal searching range and achieve the same performance as that of the crystal oscillator with temperature compensation;
step 5): during the use process, the device updates the lookup table according to the frequency offset estimation of the crystal oscillator output by the functional module (such as a cellular system transceiver module, a GNSS positioning module) in the device and the read temperature of the crystal oscillator.
The detailed workflow is as follows (fig. 3 illustrates a schematic diagram of a device using a crystal oscillator, which supports both cellular communication systems and GNSS):
step 1): the temperature frequency characteristic curve of the crystal oscillator can be represented as df0(T), wherein T is the temperature of the crystal oscillator. This curve is generally determined by the cutting pattern and cutting angle during the production process. Fig. 1 shows a temperature-frequency characteristic curve in the AT cutting mode. In the same cutting mode, the curve of each crystal oscillator is also different and is generated by the difference of crystals and the cutting angle and other controls of production. For the same model and batch of crystal oscillators, the same temperature-frequency characteristic curve can be used, and the curve is written into a Non-volatile Memory (Non-volatile Memory) in the device production process according to a lookup table (for example, 1C one point). As shown in table 1.
Table 1: default temperature frequency Curve example (i.e., df0 lookup Table)
This temperature frequency characteristic curve can be provided by the crystal oscillator supplier or can be obtained by the device manufacturer by averaging the temperature quotients at various temperature points after measuring several crystal oscillators in a laboratory. Due to the frequency of the crystal in the device, it is also related to the load capacitance of the crystal in each device. The actual frequency of the crystal in the device can be considered to be roughly the frequency offset value (df0(T), determined by temperature) in the lookup table plus an offset (df _ lc, determined by load capacitance) that varies from device to device. The actual frequency deviation value of the crystal oscillator frequency can be expressed by the following formula:
df(T)=df0(T)+df_lc;
if the step size of the temperature is 1C, then T ═ 30C, -29C, -28C, …,83C,84C,85C, i.e. a look-up table with a total of 126 rows.
It can be seen that the content df0(T) written in the factory production of the device by this default look-up table is a relative value between the respective temperatures, and not an actual value of the crystal frequency in the device.
Step 2): in order to obtain the actual value of the crystal frequency offset of a device at a certain temperature, the crystal frequency of each device needs to be measured on the production line of a factory. The crystal oscillator in the device can use an external thermistor to measure the crystal oscillator temperature or an internal thermistor to measure the crystal oscillator temperature (i.e. a thermistor crystal oscillator). The device requires an analog-to-digital converter (ADC) to obtain a value of temperature. Assuming that the temperature of the crystal oscillator is T1 when a device is measured on a factory line, the crystal oscillator frequency measured at this time is df1 (T1). Then it can be found that:
df1(T1)=df0(T1)+df_lc;
thus, it is possible to solve:
df_lc=df1(T1)–df0(T1);
the device stores the value df _ lc in non-volatile memory.
Measuring the frequency offset of the crystal in the device at the factory may use one of a number of methods. For example, a single frequency signal with a known frequency may be input to the device, and the frequency of the signal is measured by Fast Fourier Transform (FFT) inside the device, and the measured frequency will have a corresponding offset due to the crystal frequency offset, and the crystal frequency offset may be calculated from the offset. Another method is that a device sends a single-frequency signal to a receiving device on the factory production line, the receiving device measures the frequency of the signal through FFT, the measured frequency has a corresponding offset due to the crystal oscillator frequency offset, and the crystal oscillator frequency offset can be calculated from the offset; step 3): after the above two steps are completed, when the device is powered on for the first time after being taken out of the factory, the df _ lc obtained in step 2) and the default lookup table df0(T) stored in step 1) are read from the nonvolatile memory, and the actual frequency offset of the crystal oscillator at each temperature point is calculated:
df(T)=df0(T)+df_lc=df0(T)+df1(T1)–df0(T1);
thus obtaining the initial estimated value of the actual frequency deviation of the crystal oscillator under all temperatures (-30C to 85C), df (T);
the device stores these initial estimates in non-volatile memory. The device may choose to replace the corresponding value df0(T) in the look-up table of step 1) with these initial estimate values df (T), or store df (T) in a new look-up table in the non-volatile memory. The lookup table storing df (t) is referred to hereinafter as the "df lookup table". For example, the above step calculates df _ lc to be 9ppm, and table 2 is an example of a temperature frequency curve after the device is initialized for the first time when the device is turned on (i.e., a df lookup table);
the frequency (df) in Table 2 is the frequency (df0) in Table 1 plus 9 ppm.
Table 2: an example of a temperature frequency curve (i.e., df look-up table) after a first power-on initialization of the device;
step 4): the role of the df lookup table: in the subsequent use of the device, when the crystal oscillator bias needs to be known (for example, before GNSS signal acquisition or before cellular signal acquisition), the temperature of the crystal oscillator is read, and then an estimated value of the current frequency of the crystal oscillator can be obtained in the df lookup table. The current frequency estimation value of the crystal oscillator can help the GNSS module or the cellular system (e.g. 4G LTE, NB-IoT, 5G) receiving module to quickly acquire signals, thereby greatly improving the user experience.
Step 5): since the frequency of the GNSS signal and the frequency of the downlink signal of the cellular system are known, after the GNSS module or the cellular system receiving module captures the signal, the current frequency of the crystal oscillator can be estimated more accurately according to the frequency of the signal. For example. The true frequency offset of the crystal oscillator is expressed as d in ppm. When the cellular system receiver obtains the frequency of the signal after acquiring and/or tracking that is f1 (knowing that the frequency of the signal transmitted from the base station is f), it can estimate that the frequency offset of the crystal oscillator is d1 ═ f1-f)/f × 1e6, which is ppm. In the above example, assuming that the true frequency offset of the crystal oscillator is d-4.3 ppm and f-800 MHz, if the frequency of the captured signal is f1 (800MHz +4kHz), then the estimated frequency offset is (f1-f)/f 1e6 (800MHz +4kHz-800MHz)/800MHz 1e6 is 5ppm.
At this time, the temperature of the crystal oscillator can be read simultaneously, and if the temperature is 7C, the frequency deviation of the crystal oscillator at 7C is 5ppm. The device may update the frequency offset information for the line of df lookup table 7C with 5ppm. As shown in table 3.
Table 3: device temperature frequency curve example (i.e. df look-up table), frequency of temperature 7 ℃ is updated from 2.8ppm to 5 ppm;
table 3: device temperature frequency curve example (i.e., df look-up table);
this process will improve the accuracy of the df lookup table. Meanwhile, the problem of long-term change of the crystal oscillator frequency along with time can be solved.
It should be noted that the above-mentioned embodiments are not intended to limit the scope of the present invention, and all equivalent modifications and substitutions based on the above-mentioned technical solutions are within the scope of the present invention as defined in the claims.