Frequency compensation method and device, electronic equipment, chip and storage medium

By acquiring the environmental parameters of the target crystal oscillator, training the target model using base station signals, and combining it with a neural network for real-time optimization, the problem that traditional frequency compensation techniques cannot accurately fit the nonlinear temperature characteristics and aging drift of TSX crystal oscillators is solved, achieving high-precision and low-cost frequency compensation results.

CN121907237APending Publication Date: 2026-04-21BEIJING X RING TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING X RING TECHNOLOGY CO LTD
Filing Date
2025-12-18
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Traditional frequency compensation techniques struggle to accurately fit the nonlinear temperature characteristics of thermistor crystal oscillators (TSX) and cannot effectively track and compensate for crystal oscillator aging drift, leading to a dilemma between cost and accuracy in high-precision scenarios.

Method used

By acquiring the environmental parameters of the target crystal oscillator, training is performed using signals transmitted from the base station to establish a target model. Based on this model, the output frequency of the crystal oscillator is compensated, and real-time optimization is performed using a neural network to adapt to the aging process of the crystal oscillator.

Benefits of technology

It improves the accuracy and stability of the crystal oscillator output frequency, reduces the overall system cost, adapts to the crystal oscillator aging process, and achieves high-precision frequency compensation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121907237A_ABST
    Figure CN121907237A_ABST
Patent Text Reader

Abstract

The invention provides a frequency compensation method and device, electronic equipment, a chip and a storage medium. The method comprises the following steps: acquiring environmental parameters of a target crystal oscillator; determining a compensation value of the target crystal oscillator through a target model based on the environmental parameters, the target model being obtained by training according to frequency information related to a first signal sent by the base station; and compensating the output frequency of the target crystal oscillator by adopting the compensation value. The model can be continuously optimized by using data in an actual operation environment to adapt to the aging process of the crystal oscillator, and the compensation precision of the target crystal oscillator can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of frequency compensation, and more particularly to a frequency compensation method, apparatus, electronic device, chip, and storage medium. Background Technology

[0002] The temperature-compensated crystal oscillator industry has experienced rapid and sustained growth in recent years. Neural network technology has gradually been applied in the field of crystal oscillator compensation. Simultaneously, the development of mobile communication technology allows terminal devices to obtain high-precision frequency references through network synchronization signals, providing new possibilities for improving the accuracy of low-cost crystal oscillators. How to effectively control hardware costs while ensuring high clock signal stability remains a common and critical technical challenge. Summary of the Invention

[0003] This disclosure provides a frequency compensation method, apparatus, electronic device, chip, and storage medium that can improve the compensation accuracy of a target crystal oscillator.

[0004] A first aspect of this disclosure provides a frequency compensation method, the method comprising: acquiring environmental parameters of a target crystal oscillator; determining a compensation value for the target crystal oscillator based on the environmental parameters and a target model obtained by training on frequency information related to a first signal transmitted by a base station; and compensating the output frequency of the target crystal oscillator using the compensation value.

[0005] In some embodiments of this disclosure, obtaining environmental parameters of the target crystal oscillator includes at least one of the following: acquiring the temperature parameters of the target crystal oscillator; acquiring the power supply voltage provided to the target crystal oscillator; and acquiring the cumulative operating time of the target crystal oscillator.

[0006] In some embodiments of this disclosure, a compensation value is used to compensate the output frequency of the target crystal oscillator, including: adjusting the parameters of the frequency divider and / or phase-locked loop corresponding to the target crystal oscillator based on the compensation value to compensate the output frequency of the target crystal oscillator.

[0007] In some embodiments of this disclosure, the target model is obtained by training the first model using a first frequency difference and environmental parameters of the target crystal oscillator when receiving the first signal, wherein the first frequency difference is the frequency difference between the reference frequency of the first signal and the output frequency of the target crystal oscillator when receiving the first signal.

[0008] A second aspect of this disclosure provides a method for training a target model. The method includes: acquiring a first training dataset, the first training dataset including at least one of a first frequency difference, environmental parameters of a target crystal oscillator when receiving a first signal, multiple historical environmental parameters, and historical frequency differences corresponding to the multiple historical environmental parameters, wherein the first frequency difference is the frequency difference between a reference frequency of the first signal and the output frequency of the target crystal oscillator when receiving the first signal, and the first signal is transmitted by a base station; training a first model using the first training dataset to obtain a target model, the target model being used to compensate for the output frequency of the target crystal oscillator.

[0009] In some embodiments of this disclosure, the method further includes: sending a request to a base station to request the establishment of a connection with the base station; receiving a first signal sent by the base station; demodulating the first signal to determine a reference frequency of the first signal.

[0010] In some embodiments of this disclosure, training a first model with a first training dataset to obtain a target model includes: training the first model based on a first frequency difference and environmental parameters of the target crystal oscillator when receiving a first signal to obtain the target model.

[0011] In some embodiments of this disclosure, a first model is trained using a first training dataset to obtain a target model, including: training the first model based on a first frequency difference, environmental parameters of the target crystal oscillator when receiving the first signal, multiple historical environmental parameters, and historical frequency differences corresponding to the multiple historical environmental parameters to obtain a trained target model.

[0012] In some embodiments of this disclosure, the method further includes: obtaining a second training dataset, the second training dataset including multiple historical environment parameters and historical frequency differences corresponding to each historical environment parameter; and training a second model using the second training dataset to obtain a first model.

[0013] A third aspect of this disclosure provides a frequency compensation device, which includes: an acquisition module for acquiring environmental parameters of a target crystal oscillator; a processing module for determining a compensation value for the target crystal oscillator based on the environmental parameters and a target model, wherein the target model is trained based on frequency information related to a first signal transmitted by a base station; and using the compensation value to compensate the output frequency of the target crystal oscillator.

[0014] In some embodiments of this disclosure, the target model is obtained by training a first model using a first frequency difference and environmental parameters of the target crystal oscillator when receiving the first signal, wherein the first frequency difference is the frequency difference between the reference frequency of the first signal and the output frequency of the target crystal oscillator when receiving the first signal. The processing module is further configured to: A fourth aspect of this disclosure provides a training apparatus for a target model. The apparatus includes: a processing module configured to acquire a first training dataset, the first training dataset including at least one of a first frequency difference, environmental parameters of a target crystal oscillator when receiving a first signal, multiple historical environmental parameters, and historical frequency differences corresponding to the multiple historical environmental parameters, wherein the first frequency difference is the frequency difference between a reference frequency of the first signal and the output frequency of the target crystal oscillator when receiving the first signal, and the first signal is transmitted by a base station; and to train a first model using the first training dataset to obtain a target model, the target model being used to compensate for the output frequency of the target crystal oscillator.

[0015] In some embodiments of this disclosure, the processing module is further configured to: train the first model based on the first frequency difference and the environmental parameters of the target crystal oscillator when receiving the first signal, to obtain the target model.

[0016] A fifth aspect of this disclosure provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the methods described in the first and second aspects of this disclosure.

[0017] A sixth aspect of this disclosure provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to perform the methods described in the first and second aspects of this disclosure.

[0018] A seventh aspect of this disclosure provides a chip including at least one processor and a communication interface; the communication interface is used to receive signals input to the chip or signals output from the chip, and the processor communicates with the communication interface and implements the methods described in the first and second aspects of this disclosure through logic circuits or executing code instructions.

[0019] In summary, the frequency compensation method proposed in this disclosure can train a target model based on the frequency information related to the first signal sent by the base station, and use the trained target model to predict the compensation value based on the environmental parameters of the target crystal oscillator. This can improve the prediction accuracy of the compensation value, make the output frequency accuracy of the compensated target crystal oscillator higher, realize the continuous optimization of the model using data from the actual operating environment, adapt to the crystal oscillator aging process, and improve the compensation accuracy of the target crystal oscillator.

[0020] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0021] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.

[0022] Figure 1 A flowchart illustrating a frequency compensation method provided in an embodiment of this disclosure; Figure 2 A flowchart illustrating a training method for a target model provided in this embodiment of the disclosure. Figure 1 ; Figure 3 A flowchart illustrating a training method for a target model provided in this embodiment of the disclosure. Figure 2 ; Figure 4A This is a schematic diagram illustrating an application scenario of a method for long-term self-calibration of TSX temperature crystal oscillator frequency based on neural network compensation, as provided in an embodiment of this disclosure. Figure 4B A timing flowchart of a method for long-term self-calibration of TSX temperature crystal oscillator frequency based on neural network compensation provided in this disclosure embodiment; Figure 5A This is a schematic diagram of the structure of a frequency compensation device provided in an embodiment of the present disclosure; Figure 5B A schematic diagram of the structure of a training device for a target model provided in an embodiment of this disclosure; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure; Figure 7 This is a schematic diagram of the chip structure provided in an embodiment of this disclosure. Detailed Implementation

[0023] Embodiments of this disclosure are described in detail below, with examples of embodiments illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this disclosure, and should not be construed as limiting this disclosure.

[0024] In modern electronic devices and communication systems, a highly stable clock frequency is fundamental to ensuring normal operation and performance. Thermal Sensitive Crystal Oscillators (TSX) have become a potentially ideal choice for cost-sensitive applications such as consumer electronics and IoT terminals due to their significant cost advantages. However, their output frequency exhibits complex nonlinear changes with ambient temperature and undergoes long-term aging drift, which severely limits their direct application in scenarios requiring high precision.

[0025] Traditional frequency compensation techniques often rely on laboratory calibration data collected at limited temperature points and employ fixed parameter models for compensation. This method struggles to accurately fit the inherent nonlinear temperature characteristics of TSX crystal oscillators, and it cannot effectively track and compensate for the continuous aging drift of the crystal. Therefore, a dilemma often arises between cost and accuracy: either use a high-cost temperature-compensated crystal oscillator (TCXO) to meet accuracy requirements, or accept the performance compromises brought by the low-cost TSX crystal oscillator.

[0026] Therefore, in order to solve the above problems, this disclosure proposes a frequency compensation method, which can save chip area through merging, unified management and hardware scheduling of caches.

[0027] The scheme disclosed herein can be executed by an electronic device or a chip. The electronic device may be, for example, a terminal. The specific content of the method is as follows.

[0028] Figure 1 This is a flowchart illustrating a frequency compensation method provided in an embodiment of this disclosure. Figure 1 As shown, the method may include the following steps.

[0029] Step 101: Obtain the environmental parameters of the target crystal oscillator.

[0030] In some embodiments, the crystal oscillator can be a crystal oscillator in an electronic device (e.g., a terminal). The crystal oscillator can be used to generate a stable clock signal required for the operation of the electronic device. This signal is the timing basis for the coordinated operation of all digital circuits within the electronic device. It determines the processor's instruction execution cycle, the data transmission timing on the bus, the sampling time of the analog-to-digital or digital-to-analog converter, and the synchronization reference for the RF carrier frequency generation and signal demodulation of the communication module. Therefore, the frequency stability and accuracy of the crystal oscillator output are directly related to the reliability of system operation, the accuracy of data transmission, and the synchronization capability with other devices.

[0031] In some embodiments, the crystal oscillator may be a thermistor (TSX), a temperature-compensated crystal oscillator (TCXO), etc.

[0032] In some embodiments, acquiring environmental parameters of the target crystal oscillator includes at least one of the following: acquiring the temperature parameter of the target crystal oscillator; acquiring the power supply voltage supplied to the target crystal oscillator; and acquiring the cumulative operating time of the target crystal oscillator. In some possible embodiments, the real-time temperature value (T) around the crystal oscillator can be acquired using a high-precision temperature sensor to obtain the temperature parameter of the target crystal oscillator; the power supply voltage (Vcc) supplied to the crystal oscillator can be monitored to compensate for the effects of voltage fluctuations; and the cumulative operating time (t) of the crystal oscillator since its first power-on can be recorded to model aging effects.

[0033] Step 102: Based on environmental parameters, determine the compensation value of the target crystal oscillator using the target model.

[0034] In some embodiments, the compensation value is the compensation value of the output frequency of the target crystal oscillator. That is, because the target crystal oscillator may be affected by factors such as temperature and aging during operation, the actual output frequency of the target crystal oscillator may deviate from the expected output frequency. At this time, the output frequency of the target crystal oscillator can be compensated according to the compensation value so that the compensated output frequency can be close to the expected output frequency.

[0035] In some embodiments, the target model is obtained by training based on frequency information related to a first signal transmitted by a base station. In other words, the first information transmitted by the base station can be received, and the first model can be trained based on the frequency information related to the first signal to obtain the target model. Then, the target model can be used to predict the compensation value of the target crystal oscillator.

[0036] Among them, the frequency information related to the first signal can be, for example, the reference frequency of the first signal, the current operating frequency of the base station that sends the first signal, or the reference frequency of the base station that sends the first signal, i.e., the base station reference frequency. The reference frequency is the expected output frequency of the target crystal oscillator. The base station reference frequency is the "standard heartbeat" of the entire cellular mobile communication network. It is usually obtained and maintained by the base station by connecting to a high-precision timing source and has extremely high long-term stability and absolute accuracy.

[0037] Therefore, the target crystal oscillator in the terminal device needs to be aligned with this reference frequency. Precise frequency alignment ensures that the terminal can sample the downlink signal of the base station at the correct time to decode the data without errors, while ensuring that its uplink transmission signal is strictly within the radio channel frequency band specified by the base station, thereby maintaining a stable and efficient communication connection.

[0038] Therefore, the scheme disclosed herein can train the first model to obtain the target model based on the reference frequency, so that when the compensation value output by the target model is applied to the target crystal oscillator, the output frequency of the target crystal oscillator after compensation can be close to the reference frequency (desired frequency).

[0039] Step 103: Use compensation values ​​to compensate the output frequency of the target crystal oscillator.

[0040] In some embodiments, a compensation value is used to compensate the output frequency of the target crystal oscillator, including: adjusting the parameters of the frequency divider and / or phase-locked loop (PLL) corresponding to the target crystal oscillator based on the compensation value, so as to compensate the output frequency of the target crystal oscillator. In other words, the compensation value directly adjusts the parameters of the frequency divider or PLL within the chip to perform digital domain correction of the output frequency.

[0041] In summary, the above embodiments of this disclosure can train a target model based on the frequency information related to the first signal sent by the base station, and use the trained target model to predict compensation values ​​based on the environmental parameters of the target crystal oscillator. This can improve the prediction accuracy of the compensation values, make the output frequency accuracy of the compensated target crystal oscillator higher, realize the continuous optimization of the model using data from the actual operating environment, adapt to the crystal oscillator aging process, and improve the compensation accuracy of the target crystal oscillator.

[0042] Figure 2 A flowchart illustrating a training method for a target model provided in this embodiment of the disclosure. Figure 1 .like Figure 2 As shown, based on Figure 1 The illustrated embodiment shows that the method includes the following steps.

[0043] Step 201: Obtain the first training dataset.

[0044] In some embodiments, the first training dataset can be used to train the first model to obtain the target model.

[0045] In some embodiments, the first training dataset includes at least one of a first frequency difference, environmental parameters of the target crystal oscillator when receiving the first signal, multiple historical environmental parameters, and historical frequency differences corresponding to the multiple historical environmental parameters, wherein the first frequency difference is the frequency difference between the reference frequency of the first signal and the output frequency of the target crystal oscillator when receiving the first signal. In some embodiments, the method further includes: sending a request to a base station to request the establishment of a connection with the base station; receiving a first signal sent by the base station; demodulating the first signal to determine a reference frequency of the first signal.

[0046] In some embodiments, the first signal may be a synchronization signal, which can be a downlink synchronization signal received by the terminal from the base station during the network registration process. That is, the terminal may send an access request to the base station to request the establishment of a wireless connection; after receiving the request, the base station responds by sending a synchronization signal containing a specific sequence to the terminal. The core function of this synchronization signal is to provide the terminal with accurate timing and frequency references, enabling the terminal to adjust its local clock to synchronize with the base station clock, thereby establishing a reliable communication link.

[0047] In some embodiments, when a terminal initiates network access, the base station transmits a synchronization signal (i.e., a first signal) with a known format on the downlink. The terminal's baseband processor receives this signal using a local clock driven by the target crystal oscillator and directly calculates the instantaneous deviation between the current output frequency of the target crystal oscillator and the high-precision reference frequency held by the base station by performing cross-correlation or digital phase detection on the received signal and a locally generated copy of the ideal synchronization sequence. This deviation is the first frequency difference (Δf_measured). In other words, the terminal can store the frequency information of the ideal first signal. The terminal can receive the first signal transmitted by the base station, and then determine the first frequency difference based on the frequency information of the first signal transmitted by the base station and the frequency difference between the locally stored ideal first signal.

[0048] In some embodiments, during the reception of the first signal, the real-time temperature value (T) of the crystal oscillator can be read and recorded at the same time as the frequency difference calculation is completed by a digital temperature sensor integrated in or mounted close to the crystal oscillator package; the operating voltage value (Vcc) at this moment can be sampled and recorded by an analog-to-digital converter (ADC) channel connected to the crystal oscillator power supply pin; and the cumulative running time (t) of the marked crystal oscillator since its activation can be read from a non-volatile time counter maintained by an independent clock source within the device.

[0049] In some embodiments, the first training dataset may further include historical data, wherein the plurality of historical environmental parameters refer to the temperature, voltage, and cumulative operating time series recorded at multiple past network injection times, read from non-volatile memory and ordered by timestamps. Correspondingly, the plurality of historical frequency differences refer to the true sequence of frequency deviations measured and stored at the same network injection time, corresponding one-to-one with the aforementioned historical environmental parameters.

[0050] Step 202: Train the first model using the first training dataset to obtain the target model.

[0051] In some embodiments, training a first model using a first training dataset to obtain a target model includes: training the first model based on a first frequency difference and environmental parameters of the target crystal oscillator when receiving a first signal to obtain the target model.

[0052] In some embodiments, when the target crystal oscillator is in actual use and receives a first signal sent by the base station, a first training dataset can be determined based on the first signal, and then the first training dataset can be used to train the first model. The first training dataset may include a first frequency difference and environmental parameters of the target crystal oscillator when receiving the first signal. During training, the environmental parameters of the target crystal oscillator when receiving the first signal can be input into the first model, which calculates a predicted frequency deviation value. Then, the error between the predicted value and the first frequency difference is calculated. Subsequently, the system calculates the gradient of this error with respect to all trainable parameters within the model (including the weights and biases of each neural layer) using a backpropagation algorithm, and the optimizer updates these parameters based on the gradient. This process enables the model to learn to output a more accurate frequency deviation prediction under the current specific environmental conditions. This training method has low computational cost and fast response speed, enabling the model to quickly track instantaneous changes in the crystal oscillator's state.

[0053] In some embodiments, training a first model with a first training dataset to obtain a target model includes: training the first model based on a first frequency difference, environmental parameters of the target crystal oscillator when receiving a first signal, multiple historical environmental parameters, and historical frequency differences corresponding to the multiple historical environmental parameters to obtain a trained target model.

[0054] In some embodiments, during the network registration phase, the first model can be trained not only using information related to the first signal but also using historical data to obtain a more stable and generalized model. In this scheme, the training dataset includes not only the latest first frequency difference and environmental parameters of the target crystal oscillator when receiving the first signal, but also multiple historical environmental parameters and their corresponding multiple historical frequency differences. The multiple historical environmental parameters and their corresponding multiple historical frequency differences can be manually labeled training datasets, or they can be the first frequency difference during the terminal's historical network registration, the environmental parameters of the target crystal oscillator when receiving the first signal, etc., and this disclosure does not limit this.

[0055] During training, the first model can be iteratively learned in multiple rounds using a first training dataset that includes the first frequency difference, environmental parameters of the target crystal oscillator when receiving the first signal, multiple historical environmental parameters, and historical frequency differences corresponding to the multiple historical environmental parameters. In each iteration, the model sequentially processes these historical and current samples. To prevent the model from forgetting stable patterns learned from long-term historical data due to overfitting to the latest data points that may contain random noise, regularization techniques (such as weight decay) can be introduced, and a small learning rate can be used. The optimization algorithm seeks the optimal balance between fitting new data and preserving historical knowledge, thereby making a smoother and more robust adjustment to the model's weights and bias parameters. This training method has good stability and can avoid the problem of model over-adjustment leading to a decrease in model accuracy. That is, it can effectively suppress model performance fluctuations caused by single measurement anomalies, so that the generated target model can not only reflect the latest calibration information, but also deeply understand the long-term aging and temperature change trends of the crystal oscillator, thus obtaining better long-term prediction accuracy.

[0056] In some embodiments, when training the first model using the first training dataset, the network weight parameters of the first model may be updated. In this case, the updated neural network model parameters after online learning can be saved to non-volatile memory to ensure that the device can load the latest and most accurate model the next time it starts up.

[0057] In some embodiments, the target model is used to compensate the output frequency of the target crystal oscillator. For example, during actual use, the target model can collect environmental parameters in real time and determine the predicted compensation value based on the environmental parameters. The compensation value can be applied to the parameters of the frequency divider and / or phase-locked loop corresponding to the target crystal oscillator to compensate the output frequency of the target crystal oscillator.

[0058] In summary, the above embodiments of this application, by using the first signal synchronized with the base station when the device is connected to the network to train the first model and obtain the target model, can improve frequency accuracy and long-term stability. Each time the device connects to the base station, it automatically uses the standard frequency of the base station to verify its own output frequency and uses this result to optimize the parameters of the first model. This can effectively overcome the drift caused by temperature changes and device aging, and can also reduce the overall system cost.

[0059] Figure 3 A flowchart illustrating a training method for a target model provided in this embodiment of the disclosure. Figure 2 .like Figure 3 As shown, based on Figure 1 The illustrated embodiment shows that the method includes the following steps.

[0060] Step 301: Obtain the second training dataset.

[0061] In some embodiments, the second training dataset includes multiple historical environmental parameters and the historical frequency difference corresponding to each historical environmental parameter. The second training dataset can be laboratory data, i.e., data used to train the model in a laboratory setting. After the second model is trained in the laboratory, a first model is obtained, which can then be used to predict the compensation value of the target crystal oscillator.

[0062] In some embodiments, the data in the second training dataset can be obtained through simulation, such as collecting the output frequencies of crystal oscillators of the same type as the target crystal oscillator under different environmental parameters, and manually labeling the difference between the output frequency and the expected frequency to form multiple sets of historical environmental parameters and training data pairs of historical frequency differences corresponding to each historical environmental parameter. The training data pairs can then be used to train the second model.

[0063] Step 302: Train the second model using the second training dataset to obtain the first model.

[0064] In some embodiments, training data from the second training dataset is input into the model for training. In each round of training, the model predicts a frequency difference based on the input historical environmental parameters. The error between the predicted value and the historical frequency difference labeled in the dataset is calculated using a loss function (such as mean squared error). Then, the parameters and weights of the second model are adjusted according to the error. This process is repeated multiple times until the prediction accuracy of the model tends to stabilize on the validation set and meets the preset requirements. Then the training is completed, and the first model is obtained.

[0065] In some embodiments, after power-on, the device can load a pre-stored neural network model and its parameters from non-volatile memory. The pre-trained model is the first model, which is usually a Long Short-Term Memory (LSTM) network model. This network structure is good at processing and predicting time series data because its internal gating mechanism can effectively capture long-term dependencies, making it suitable for modeling the complex dynamic characteristics of crystal oscillator frequency changes over time (aging) and temperature history.

[0066] In some embodiments, after power-on, the device can read the model architecture definition and the latest weight parameters, load them into device memory, and run them, preparing for real-time inference. Simultaneously, the system initializes key hardware peripheral modules in parallel: a temperature sensor (typically configured for communication via I2C or SPI bus to prepare for periodic crystal temperature readings), a voltage monitoring circuit (configuring the analog-to-digital converter (ADC) channel to sample the crystal oscillator supply voltage), and a communication module (such as a cellular baseband, setting it to receive base station synchronization signals). This allows the first model to begin predicting compensation values ​​as quickly as possible after power-on, compensating for the target crystal oscillator's output frequency in real time.

[0067] In summary, the above embodiments of this disclosure, which use a second training dataset to pre-train the model to obtain a first model, can improve the initial accuracy and reliability of the system. The device can load a fully trained first model when it is first powered on. This model has learned common temperature characteristics and aging trends from a large amount of sample data of similar crystal oscillators, thereby providing effective compensation immediately. This avoids the problem of low accuracy in the initial operation stage of the device due to the lack of personalized data, and ensures that the device has usable frequency stability from the beginning of use.

[0068] The technical solutions of this disclosure will be further described in detail below with reference to specific application embodiments.

[0069] The following is a method for long-term self-calibration of TSX temperature crystal oscillator frequency based on neural network compensation, provided by embodiments of this disclosure. This method is mainly applied to various electronic devices and systems that require high-precision frequency sources and are cost-sensitive, and is particularly suitable for consumer electronics products such as 5G / 6G terminal devices, smartphones and tablets, as well as industrial IoT nodes that require long-term stable frequency references. The solution aims to solve problems such as the high cost of high-precision frequency sources, insufficient compensation accuracy due to limited calibration data, the inability of traditional solutions to utilize network frequency references, and the lack of effective compensation methods for long-term aging drift. One application scenario of this solution is as follows: Figure 4A As shown.

[0070] This method involves the interaction between IoT terminal devices and 5G base stations, and its timing is as follows: Figure 4B As shown, the complete process of the above method includes the following steps.

[0071] Step 401, System initialization and basic model loading.

[0072] After the device is powered on, it loads a pre-trained neural network model (such as an LSTM model) and its latest parameters from non-volatile memory. At the same time, it initializes the temperature sensor, voltage monitoring circuit, and communication module.

[0073] Step 402: Real-time acquisition of environmental parameters.

[0074] The system continuously collects the current operating environment parameters of the TSX crystal oscillator, mainly including: temperature (T), which is obtained by acquiring the real-time temperature value around the crystal oscillator through a high-precision temperature sensor; operating voltage (Vcc), which monitors the power supply voltage provided to the crystal oscillator to compensate for the impact of voltage fluctuations; and running time (t), which records the cumulative operating time of the crystal oscillator since its first power-on, for modeling the aging effect.

[0075] Step 403, real-time inference and frequency offset prediction of neural networks.

[0076] The collected environmental parameter sequence (T, Vcc, t) is input into the loaded neural network model. This model, through its internal multi-layered nonlinear calculations, predicts the total frequency deviation of the TSX crystal oscillator under the current environment. One of the core tasks of the neural network model is to fit the inherent, highly nonlinear temperature-frequency characteristics of the TSX crystal oscillator, which can be precisely described by a cubic function formula:

[0077] in, T is the frequency deviation caused solely by temperature changes (unit: ppm); T is the current measured real-time temperature (unit: °C); T0 is the reference temperature (usually 25 °C); C1-C3 are the temperature coefficients of this specific TSX crystal oscillator, which are constants whose values ​​are determined during crystal oscillator production. However, traditional methods struggle to accurately compensate for the nonlinear components C1-C3. C0 is the inherent frequency deviation, and its value also changes with aging.

[0078] Step 404: Compensation signal generation and output.

[0079] Based on the total frequency deviation predicted by the neural network in step 403 ( The compensation signal generation module calculates the corresponding compensation value. This compensation value directly adjusts the parameters of the internal frequency divider or phase-locked loop (PLL) to perform digital domain correction of the frequency.

[0080] Step 405, netting process and high-precision frequency offset data acquisition (including steps 405a-405c).

[0081] This step is activated when the device needs to connect to a network base station (network registration). The device first sends a network registration request to the base station (step 405a) to request the establishment of a connection between the device and the base station. Then, the device receives a synchronization signal from the base station (step 405b), which has extremely high frequency accuracy and stability. The system compares the current output frequency of the TSX crystal oscillator with the base station reference frequency to calculate a high-precision, true instantaneous frequency deviation value. ), and simultaneously record the environmental parameters (T, Vcc, t) at this moment (step 405c). This data is used to compare (environmental parameters, This constitutes a training sample with naturally accurate labels.

[0082] Step 406: Online learning and updating of the model.

[0083] The new data samples obtained in step 405 are added to the local training dataset. The online learning algorithm is triggered to incrementally train the neural network model using the new data, fine-tuning its network weight parameters. This allows the model to more accurately learn the unique characteristics of the current TSX crystal oscillator (i.e., its specific A, B, C coefficients) and its degradation patterns over time, achieving a more accurate learning curve with continued use.

[0084] Step 407: Update the model parameter storage.

[0085] The updated neural network model parameters after online learning are saved to non-volatile memory to ensure that the device can load the latest and most accurate model the next time it starts up.

[0086] Among them, the real-time neural network inference in step 403 and the online model learning in step 406 can solve the problems of insufficient accuracy and inability to utilize real-time data in traditional crystal oscillator output frequency compensation.

[0087] Step 403 utilizes the powerful nonlinear mapping capability of neural networks to overcome the difficulty of accurately compensating for the inherent cubic temperature characteristics of TSX crystal oscillators using traditional methods. The cubic temperature characteristics are expressed as follows.

[0088]

[0089] Step 406 utilizes the high-precision frequency offset data obtained during the net injection process as a supervision signal to achieve continuous optimization of the model in the real working environment. This solves the problems of limited calibration data and inability to adapt to aging in traditional schemes. Compared with the high-cost TCXO, it fully leverages the cost advantage of TSX.

[0090] This technical solution adopts an LSTM neural network architecture based on bead network frequency offset data enhancement, which fully leverages the cost advantage of TSX crystal oscillators and significantly increases the training dataset by utilizing the frequency reference signal provided by the communication network.

[0091] This technical solution utilizes frequency offset data from the netting process as an additional training data source: During training, this solution combines laboratory data with frequency offset data collected during actual netting, training the neural network model through supervised learning. In practical applications, real-time environmental parameters are input into the trained network model to predict frequency deviations and implement compensation. Simultaneously, new calibration data is acquired during each netting operation for model updates.

[0092] The training process is described in detail below.

[0093] The training model uses a beaded data augmentation LSTM network architecture. The LSTM module processes time-series data, capturing the effects of aging and historical temperature. Inputs include historical temperature sequences, timestamp sequences, and netting frequency offset data sequences; outputs are predicted values ​​for aging drift and temperature effects. The data augmentation module specifically processes the frequency offset calibration data acquired during netting. Inputs include netting frequency offset compensation data, the current temperature at the time of netting, and the netting timestamp; outputs calibrated frequency deviation data.

[0094] Network registration frequency offset data acquisition mechanism: During the network registration process, the device obtains a high-precision frequency reference signal from the base station, measures the deviation between the current TSX output frequency and the base station reference frequency, records environmental parameters such as temperature and voltage at this time, and adds these data as labeled data to the training dataset.

[0095] Training data characteristics: Data type: Preliminary laboratory calibration data plus network frequency offset data. Data content includes temperature value, timestamp, power supply voltage, and network frequency offset measurement value. This solution can obtain a large amount of real-time data through the network injection process, far exceeding the amount of data in traditional laboratories. This solution uses base station frequency reference as a natural annotation source, eliminating the need for manual annotation.

[0096] Usage description: The model uses a lightweight architecture suitable for resource-constrained environments. The inputs are the current temperature T, the temperature change rate Delta T, the working time t, laboratory calibration data, and historical network frequency deviation data. The output is the predicted frequency deviation (Delta freq).

[0097] The data processing flow during network registration is as follows: The device initiates a network registration request, establishes a connection with the base station, extracts frequency reference information from the base station signal, calculates the deviation between the current TSX output frequency and the reference frequency, records the current environmental parameters and frequency offset data, updates the neural network model with the new data, and applies the updated model for frequency compensation.

[0098] Specific example: Taking a TSX crystal oscillator (nominal frequency 10MHz) in a 5G IoT terminal device as an example, the following steps are included.

[0099] 1. Data acquisition during network registration: The device initiates network registration, connects to the base station, and records the network registration frequency offset compensation: +15.48Hz (+1.548ppm). It also records environmental parameters: temperature 35.2°C and voltage 3.28V.

[0100] 2. Model Update: Add new data to the training dataset, update the neural network model parameters online, and verify that the model accuracy has improved by about 12%.

[0101] Compared with existing technologies, this technical solution has the following significant advantages: Significant cost advantage: Replacing high-precision TCXOs with low-cost TSX crystal oscillators reduces material costs by 30%-40%, saving substantial costs in large-scale deployments; Significantly increased data volume: Utilizing frequency offset data obtained during the network injection process, the training dataset size can be increased by 5-10 times, significantly improving compensation accuracy; Real-time performance optimization: Through an online learning mechanism, the model is continuously optimized using data from the actual operating environment, adapting to the crystal oscillator aging process; Continuously improved accuracy: As the device's operating time increases and more calibration data is acquired, frequency accuracy will continuously improve, a stark contrast to the aging and degradation of traditional solutions; Enhanced network adaptability: The model can adapt to the frequency characteristics of different network environments, improving the stability of the device under various network conditions.

[0102] Figure 5A This is a schematic diagram of the structure of a frequency compensation device 510 provided in an embodiment of this disclosure. Figure 5A As shown, the device includes: an acquisition module 511 for acquiring environmental parameters of the target crystal oscillator; and a processing module 512 for determining the compensation value of the target crystal oscillator based on the environmental parameters and a target model, wherein the target model is obtained by training based on frequency information related to the first signal sent by the base station; and using the compensation value to compensate the output frequency of the target crystal oscillator.

[0103] In some embodiments, the acquisition module is further configured to acquire the temperature parameters of the target crystal oscillator; acquire the power supply voltage supplied to the target crystal oscillator; and acquire the cumulative operating time of the target crystal oscillator.

[0104] In some embodiments, the processing module is further configured to adjust the parameters of the frequency divider and / or phase-locked loop corresponding to the target crystal oscillator based on the compensation value, so as to compensate the output frequency of the target crystal oscillator.

[0105] In some embodiments, the target model is obtained by training a first model using a first frequency difference and environmental parameters of the target crystal oscillator when receiving the first signal, wherein the first frequency difference is the frequency difference between the reference frequency of the first signal and the output frequency of the target crystal oscillator when receiving the first signal.

[0106] In summary, the frequency compensation device 510 can use the frequency information related to the first signal sent by the base station to train the target model, predict the compensation value based on the environmental parameters of the target crystal oscillator, improve the prediction accuracy of the compensation value, improve the prediction accuracy of the target model, and make the output frequency accuracy of the compensated target crystal oscillator higher. It can realize the continuous optimization of the model using data from the actual operating environment, adapt to the crystal oscillator aging process, and improve the compensation accuracy of the target crystal oscillator.

[0107] Figure 5B This is a schematic diagram of the structure of a training device 520 for a target model provided in an embodiment of this disclosure. Figure 5B As shown, the device includes: a processing module 521, used to acquire a first training dataset, the first training dataset including at least one of a first frequency difference, environmental parameters of the target crystal oscillator when receiving a first signal, multiple historical environmental parameters, and historical frequency differences corresponding to the multiple historical environmental parameters, wherein the first frequency difference is the frequency difference between the reference frequency of the first signal and the output frequency of the target crystal oscillator when receiving the first signal, and the first signal is sent by the base station; and to train a first model using the first training dataset to obtain a target model, the target model being used to compensate for the output frequency of the target crystal oscillator.

[0108] In some embodiments, the processing module is further configured to send a request to the base station to request the establishment of a connection with the base station; receive a first signal sent by the base station; demodulate the first signal to determine a reference frequency of the first signal.

[0109] In some embodiments, the processing module is further configured to train the first model based on the first frequency difference and the environmental parameters of the target crystal oscillator when receiving the first signal, so as to obtain the target model.

[0110] In some embodiments, the processing module is further configured to train the first model based on the first frequency difference, the environmental parameters of the target crystal oscillator when receiving the first signal, multiple historical environmental parameters, and the historical frequency difference corresponding to the multiple historical environmental parameters, to obtain the trained target model.

[0111] In some embodiments, the processing module is further configured to obtain a second training dataset, which includes multiple historical environment parameters and historical frequency differences corresponding to each historical environment parameter; and to train the second model using the second training dataset to obtain the first model.

[0112] In summary, the training device 520 for the target model can train the target model based on the frequency information related to the first signal sent by the base station. The trained target model can be used to predict compensation values, which can improve the prediction accuracy of compensation values ​​and the prediction accuracy of the target model.

[0113] The methods and apparatus provided in the embodiments of this application have been described above. To implement the functions of the methods provided in the embodiments of this application, the electronic device may include a hardware structure and software modules, and may implement the above functions in the form of a hardware structure, software modules, or a hardware structure plus software modules. One of the above functions may be executed in the form of a hardware structure, software modules, or a hardware structure plus software modules.

[0114] Figure 6 This is a block diagram illustrating an electronic device 600 for implementing the above-described method according to an exemplary embodiment. For example, the electronic device 600 may be a mobile phone, computer, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.

[0115] Reference Figure 6 The electronic device 600 may include one or more of the following components: a processing component 602, a memory 604, a power supply component 606, a multimedia component 608, an audio component 610, an input / output (I / O) interface 612, a sensor component 614, and a communication component 616.

[0116] Processing component 602 typically controls the overall operation of electronic device 600, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 602 may include one or more processors 620 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 602 may include one or more modules to facilitate interaction between processing component 602 and other components. For example, processing component 602 may include a multimedia module to facilitate interaction between multimedia component 608 and processing component 602.

[0117] Memory 604 is configured to store various types of data to support the operation of electronic device 600. Examples of such data include instructions for any application or method operating on electronic device 600, contact data, phonebook data, messages, pictures, videos, etc. Memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0118] Power supply component 606 provides power to various components of electronic device 600. Power supply component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 600.

[0119] Multimedia component 608 includes a screen that provides an output interface between electronic device 600 and user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 608 includes a front-facing camera and / or a rear-facing camera. When electronic device 600 is in an operating mode, such as a shooting mode or video mode, the front-facing camera and / or rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0120] Audio component 610 is configured to output and / or input audio signals. For example, audio component 610 includes a microphone (MIC) configured to receive external audio signals when electronic device 600 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 604 or transmitted via communication component 616. In some embodiments, audio component 610 also includes a speaker for outputting audio signals.

[0121] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.

[0122] Sensor assembly 614 includes one or more sensors for providing state assessments of various aspects of electronic device 600. For example, sensor assembly 614 may detect the on / off state of electronic device 600, the relative positioning of components such as the display and keypad of electronic device 600, changes in position of electronic device 600 or a component of electronic device 600, the presence or absence of user contact with electronic device 600, orientation or acceleration / deceleration of electronic device 600, and temperature changes of electronic device 600. Sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 614 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.

[0123] Communication component 616 is configured to facilitate wired or wireless communication between electronic device 600 and other devices. Electronic device 600 can access wireless networks based on communication standards, such as WiFi, 2G or 3G, 4G LTE, 5G NR (NewRadio), or combinations thereof. In one exemplary embodiment, communication component 616 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 616 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0124] In an exemplary embodiment, the electronic device 600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.

[0125] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, which can be executed by a processor 620 of an electronic device 600 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0126] Embodiments of this disclosure also provide a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to perform the methods described in the above embodiments of this disclosure.

[0127] Figure 7 This is a schematic diagram illustrating the structure of a chip 700 for implementing the above method according to an exemplary embodiment. (Refer to...) Figure 7 The chip 700 includes a communication interface 701 and at least one processor 702. The communication interface 701 is used to receive signals input to the chip 700 or signals output from the chip 700. The processor 702 communicates with the communication interface 701 and implements the methods described in the above embodiments of this disclosure through logic circuits or executing code instructions.

[0128] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0129] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with an embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in at least one embodiment or example.

[0130] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of the invention pertain.

[0131] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processing module, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having at least one wiring (control method), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0132] It should be understood that various parts of the embodiments of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0133] Those skilled in the art will understand that all or part of the steps of the methods described in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.

[0134] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc.

[0135] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A frequency compensation method, characterized in that, The method includes: Obtain the environmental parameters of the target crystal oscillator; Based on the environmental parameters, the compensation value of the target crystal oscillator is determined by a target model, which is obtained by training based on the frequency information related to the first signal sent by the base station. The compensation value is used to compensate the output frequency of the target crystal oscillator.

2. The method according to claim 1, characterized in that, The environmental parameters for obtaining the target crystal oscillator include at least one of the following: Collect the temperature parameters of the target crystal oscillator; The power supply voltage supplied to the target crystal oscillator is collected; Obtain the cumulative operating time of the target crystal oscillator.

3. The method according to claim 1, characterized in that, The step of compensating the output frequency of the target crystal oscillator using the compensation value includes: Based on the compensation value, the parameters of the frequency divider and / or phase-locked loop corresponding to the target crystal oscillator are adjusted to compensate for the output frequency of the target crystal oscillator.

4. The method according to any one of claims 1 to 3, characterized in that, The target model is obtained by training a first model using a first frequency difference and environmental parameters of the target crystal oscillator when receiving the first signal. The first frequency difference is the frequency difference between the reference frequency of the first signal and the output frequency of the target crystal oscillator when receiving the first signal.

5. A method for training a target model, characterized in that, include: Obtain a first training dataset, which includes at least one of the following: a first frequency difference, environmental parameters of the target crystal oscillator when receiving the first signal, multiple historical environmental parameters, and historical frequency differences corresponding to the multiple historical environmental parameters. The first frequency difference is the frequency difference between the reference frequency of the first signal and the output frequency of the target crystal oscillator when receiving the first signal. The first signal is sent by the base station. The first model is trained using the first training dataset to obtain the target model, which is used to compensate for the output frequency of the target crystal oscillator.

6. The method according to claim 5, characterized in that, The method further includes: Send a request to the base station to request the establishment of a connection with the base station; Receive the first signal sent by the base station; The first signal is demodulated to determine its reference frequency.

7. The method according to claim 5, characterized in that, The step of training the first model using the first training dataset to obtain the target model includes: The first model is trained based on the first frequency difference and the environmental parameters of the target crystal oscillator when receiving the first signal to obtain the target model.

8. The method according to claim 5, characterized in that, The step of training the first model using the first training dataset to obtain the target model includes: The first model is trained based on the first frequency difference, the environmental parameters of the target crystal oscillator when receiving the first signal, the plurality of historical environmental parameters, and the historical frequency differences corresponding to the plurality of historical environmental parameters, to obtain the trained target model.

9. The method according to claim 5, characterized in that, The method further includes: Obtain a second training dataset, which includes multiple historical environment parameters and the historical frequency difference corresponding to each historical environment parameter; The second model is trained using the second training dataset to obtain the first model.

10. A frequency compensation device, characterized in that, include: The acquisition module is used to acquire the environmental parameters of the target crystal oscillator; The processing module is used to determine the compensation value of the target crystal oscillator based on the environmental parameters and through a target model, wherein the target model is obtained by training based on frequency information related to the first signal sent by the base station; The compensation value is used to compensate the output frequency of the target crystal oscillator.

11. The apparatus according to claim 10, characterized in that, The target model is obtained by training a first model using a first frequency difference and environmental parameters of the target crystal oscillator when receiving the first signal. The first frequency difference is the frequency difference between the reference frequency of the first signal and the output frequency of the target crystal oscillator when receiving the first signal.

12. A training device for a target model, characterized in that, include: The processing module is used to acquire a first training dataset, which includes at least one of a first frequency difference, environmental parameters of the target crystal oscillator when receiving a first signal, multiple historical environmental parameters, and historical frequency differences corresponding to the multiple historical environmental parameters. The first frequency difference is the frequency difference between the reference frequency of the first signal and the output frequency of the target crystal oscillator when receiving the first signal. The first signal is sent by the base station. The first model is trained using the first training dataset to obtain the target model, which is used to compensate for the output frequency of the target crystal oscillator.

13. The apparatus according to claim 12, characterized in that, The processing module is also used for: The first model is trained based on the first frequency difference and the environmental parameters of the target crystal oscillator when receiving the first signal to obtain the target model.

14. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-4 or 5-9.

15. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-4 or 5-9.

16. A chip, characterized in that, It includes at least one processor and a communication interface; the communication interface is used to receive signals input to the chip or signals output from the chip, and the processor communicates with the communication interface and implements the method as described in any one of claims 1-4 or 5-9 through logic circuits or executing code instructions.