Radio frequency signal frequency calibration method, device, medium, and product
Patent Information
- Application Number
- CN202610563826.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-27
- Publication Date
- 2026-08-07
AI Technical Summary
[0005]本申请提供了一种射频信号频率校准方法、设备、介质及产品,以解决现有技术中射频信号频率误差成分复杂,导致校准精度不足的技术问题
1、通过采用上述技术方案,利用分段采样的校准周期时间窗口获取连续的子时间窗口数据,将频率域的离散计数转换为反映相位累积特性的累积误差序列。通过对该序列进行二阶多项式拟合,在数学上将混合的频率误差解耦:一阶系数能够定量表征恒定的静态固定频偏,而二阶系数能够识别并量化频率随时间变化的动态漂移速率。这种误差分离机制打破了传统均值计算无法区分固定偏差与线性漂移的局限,使得系统能够根据不同的误差物理特性,分别计算并应用静态补偿量和动态漂移补偿量,从而在频率存在时变特性的场景下实现精准的频率修正与跟踪。
Smart Images

Figure CN122533670A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of radio frequency signal processing technology, specifically to a radio frequency signal frequency calibration method, device, medium, and product. Background Technology
[0002] In radio frequency transceiver systems, the accuracy of the output frequency of the frequency generation circuit directly affects the system's communication performance. Affected by factors such as semiconductor manufacturing processes, supply voltage, and operating temperature, the output frequency often deviates from the design target value. Therefore, it is usually necessary to activate an automatic frequency calibration mechanism during system initialization or operational breaks to adjust the internal circuit parameters and pull and lock the output frequency to the target frequency.
[0003] Existing technologies often employ successive approximation calibration strategies based on binary search or linear search. The workflow is as follows: the system control circuit outputs a signal, which is then counted or frequency-discriminated using a reference clock. The count value is compared with the target theoretical value. If the count value is too high, the system decreases the frequency control word according to a preset rule; conversely, it increases it. The system repeatedly executes the above "comparison-adjustment" steps until all control bit widths have been searched or the error meets the requirements, thus completing frequency locking.
[0004] However, the aforementioned techniques primarily rely on logical judgments based on the current frequency value, implicitly assuming that the frequency deviation is static during calibration. In practical applications, oscillator startup is often accompanied by self-heating effects, causing the frequency to exhibit a dynamic characteristic of unidirectional drift over time. In this case, the successive approximation strategy will confuse this time-induced dynamic drift with a fixed deviation, causing the algorithm to continuously chase the changing frequency during the search process. The parameters obtained from calibration can only correct the deviation at a certain instant and cannot cope with the continuous drift trend, causing the output frequency to continue to slip out of the locked range after calibration, making it difficult to maintain long-term stability. Summary of the Invention
[0005] This application provides a radio frequency signal frequency calibration method, device, medium, and product to solve the technical problem that the complex components of radio frequency signal frequency error lead to insufficient calibration accuracy in the prior art.
[0006] In a first aspect, this application provides a radio frequency signal frequency calibration method, including: The frequency generation circuit controls the output of the radio frequency signal to be calibrated, and the sampling circuit controls the sampling of the radio frequency signal to be calibrated according to the calibration period time window, which includes several consecutive sub-time windows. The theoretical number of pulses within the sub-time window is calculated based on the duration of the sub-time window and the ideal frequency of the RF signal to be calibrated. Obtain the actual number of pulses within each sub-time window, and calculate the difference between the actual number of pulses and the theoretical number of pulses to obtain the deviation pulse count; The number of all deviation pulses is summed in chronological order, and a cumulative error sequence is constructed. The cumulative error sequence is fitted with a second-order polynomial, and the first-order and second-order coefficients of the fitted curve are extracted. The first-order coefficients represent the static fixed frequency offset of the radio frequency signal, and the second-order coefficients represent the dynamic drift rate of the radio frequency signal as the frequency changes over time. When the absolute value of the first-order coefficient is greater than the first-order coefficient threshold and the absolute value of the second-order coefficient is less than or equal to the second-order coefficient threshold, the static compensation amount is calculated based on the first-order coefficient, and the frequency of the RF signal to be calibrated is corrected according to the static compensation amount. When the absolute value of the second-order coefficient is greater than the second-order coefficient threshold and the absolute value of the first-order coefficient is less than or equal to the first-order coefficient threshold, the dynamic drift compensation amount is calculated based on the second-order coefficient, and the frequency of the RF signal to be calibrated is corrected according to the dynamic drift compensation amount. When the absolute value of the first-order coefficient is greater than the first-order coefficient threshold and the absolute value of the second-order coefficient is greater than the second-order coefficient threshold, the dynamic drift compensation and the final static compensation are calculated based on the first-order coefficient and the second-order coefficient, and the frequency of the RF signal to be calibrated is corrected according to the dynamic drift compensation and the final static compensation.
[0007] Optionally, when the absolute value of the first-order coefficient is greater than the first-order coefficient threshold and the absolute value of the second-order coefficient is greater than the second-order coefficient threshold, the dynamic drift compensation and the final static compensation are calculated based on the first-order and second-order coefficients. The frequency of the RF signal to be calibrated is then corrected based on the dynamic drift compensation and the final static compensation, specifically including: When the absolute value of the first-order coefficient is greater than the first-order coefficient threshold and the absolute value of the second-order coefficient is greater than the second-order coefficient threshold, the dynamic drift compensation amount is calculated based on the second-order coefficient. Calculate the frequency change caused by correcting the frequency of the RF signal to be calibrated using dynamic drift compensation. The static compensation amount is calculated based on the first-order coefficients, and then corrected according to the frequency change value to obtain the final static compensation amount. The frequency of the RF signal to be calibrated is corrected based on the dynamic drift compensation and the final static compensation.
[0008] Optionally, a static compensation amount is calculated based on first-order coefficients, and the frequency of the RF signal to be calibrated is corrected according to the static compensation amount, specifically including: The current frequency resolution of the frequency generation circuit is obtained. The frequency resolution is determined by the reference clock frequency and the bit width of the phase-locked loop divider. The frequency deviation value of the RF signal to be calibrated is determined based on the first-order coefficients, and the frequency deviation value is divided by the frequency resolution to obtain the quantization adjustment step value. The quantization adjustment step value is used as the static compensation amount to adjust the frequency adjustment parameters of the frequency generation circuit in order to eliminate the static fixed frequency deviation.
[0009] Optionally, after performing second-order polynomial fitting on the cumulative error sequence and extracting the first-order and second-order coefficients of the fitted curve, the method further includes: Calculate the vertical distance between each data point in the cumulative error sequence and the corresponding point in the fitted curve to obtain the residual sequence; Calculate the statistical variance of the residual sequence and determine the statistical variance as the fitting noise index; Determine whether the fitted noise index is less than the preset noise threshold; If the fitted noise index is less than the noise threshold, then the first-order and second-order coefficients are considered valid. If the fitted noise index is not less than the noise threshold, the first-order and second-order coefficients are invalid, and the calibration cycle time window for the next round of sampling is adjusted.
[0010] Optionally, the calibration cycle time window for the next round of sampling can be adjusted, specifically including: Keeping the frequency adjustment parameters of the frequency generation circuit unchanged, the output is the same RF signal to be calibrated as the previous round of sampling; Increase the calibration cycle time window for the next round of sampling to a preset duration, and increase the number of sub-time windows for the next round of sampling to a preset number.
[0011] Optionally, if the fitted noise exponent is less than the noise threshold, after determining that the first-order coefficients and the second-order coefficients are valid, the method further includes: Obtain a preset number of historical fitting noise indices before the current sampling, and combine the current sampling fitting noise index with the historical fitting noise index in chronological order to construct a noise trend monitoring sequence; A first-order linear regression analysis was performed on the noise trend monitoring sequence, and the slope of the regression line was extracted as the noise change rate. The dynamic correction coefficient is calculated based on the noise change rate, and the dynamic correction coefficient is positively correlated with the noise change rate. When the noise change rate is positive and greater than the rate threshold, a dynamic correction coefficient is used to adjust the static compensation amount and the dynamic drift compensation amount.
[0012] Optionally, a dynamic correction coefficient is calculated based on the noise change rate, specifically including: Obtain the preset rate sensitivity coefficient and maximum saturation coefficient; The threshold increment ratio is obtained by multiplying the noise change rate with the rate sensitivity coefficient. Add the threshold increment ratio to the baseline constant 1 to obtain the preliminary correction coefficient; Determine whether the initial correction factor is greater than the maximum saturation factor; If it is not greater than the maximum saturation coefficient, then the preliminary correction coefficient is determined as the dynamic correction coefficient; If it is greater than the maximum saturation coefficient, then the maximum saturation coefficient is determined as the dynamic correction coefficient.
[0013] In a second aspect, embodiments of this application provide a radio frequency signal calibration device, which includes: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used to store computer program code, which includes computer instructions, and the one or more processors call the computer instructions to cause the radio frequency signal calibration device to perform the method described in the first aspect and any possible implementation thereof.
[0014] Thirdly, embodiments of this application provide a computer program product containing instructions that, when the computer program product is run on a radio frequency signal calibration device, cause the radio frequency signal calibration device to perform the method described in the first aspect and any possible implementation thereof.
[0015] Fourthly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a radio frequency signal frequency calibration device, cause the radio frequency signal frequency calibration device to perform the method described in the first aspect and any possible implementation thereof.
[0016] In summary, one or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages: 1. By adopting the above technical solution, continuous sub-time window data is obtained using a segmented sampling calibration period time window, converting the discrete counts in the frequency domain into a cumulative error sequence reflecting the phase accumulation characteristics. By fitting this sequence with a second-order polynomial, the mixed frequency errors are mathematically decoupled: the first-order coefficients can quantitatively characterize the constant static fixed frequency deviation, while the second-order coefficients can identify and quantify the dynamic drift rate of the frequency over time. This error separation mechanism overcomes the limitation of traditional mean calculations in distinguishing between fixed deviations and linear drift, enabling the system to calculate and apply static compensation and dynamic drift compensation separately based on different error physical characteristics, thereby achieving accurate frequency correction and tracking in scenarios where the frequency exhibits time-varying characteristics.
[0017] 2. By adopting the above technical solution, a coupled correction mechanism is established for situations where both static fixed frequency offset and dynamic drift exist simultaneously in the system. After calculating the dynamic drift compensation amount based on second-order coefficients, the frequency change value caused by applying this compensation amount to the circuit is further calculated, quantifying the impact of dynamic adjustment on the static operating point. By using this frequency change value to correct the initially calculated static compensation amount, the final static compensation amount after eliminating mutual interference is obtained. This process eliminates the secondary static error introduced by dynamic parameter adjustment, ensuring the linearity and accuracy of the superposition of the two compensation amounts, enabling the frequency of the RF signal to be calibrated to converge to the ideal frequency quickly and without overshoot.
[0018] 3. By adopting the above technical solution, a fitting quality evaluation mechanism based on residual sequence and statistical variance is introduced. By calculating the difference between the cumulative error sequence and the fitted curve, the statistical variance is quantified as a fitting noise index, thereby objectively evaluating the reliability of measurement data under the current environment. Comparing this index with a noise threshold can effectively identify and eliminate invalid first-order and second-order coefficients caused by sudden interference or measurement jitter, preventing incorrect calibration parameters from being applied to the frequency generation circuit. Simultaneously, triggering an adjustment to the time window of the next sampling calibration cycle when data is unreliable proactively optimizes sampling conditions, improving the robustness and stability of the frequency calibration algorithm in complex noise environments.
[0019] 4. By adopting the above technical solution, a trend prediction and adaptive adjustment mechanism for changes in environmental interference was established. By constructing a noise trend monitoring sequence and performing first-order linear regression analysis, the extracted noise change rate reflects the evolution trend of the current system noise level. Based on this rate, a dynamic correction coefficient positively correlated with noise is generated, which automatically adjusts the correction magnitude of the static compensation and dynamic drift compensation when the noise level shows a deteriorating trend and exceeds the rate threshold. This dynamic gain control strategy enables the calibration loop to automatically adjust the control intensity according to environmental stability, avoiding system oscillations caused by over-compensation when noise increases rapidly, and maintaining the long-term reliability of frequency locking. Attached Figure Description
[0020] Figure 1 This is a flowchart illustrating a radio frequency signal calibration method in an embodiment of this application; Figure 2 This is another schematic flowchart of the radio frequency signal frequency calibration method in the embodiments of this application; Figure 3 This is a schematic diagram of the physical device structure of a radio frequency signal calibration device in the embodiments of this application. Detailed Implementation
[0021] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0022] In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.
[0023] In the description of the embodiments of this application, the term "multiple" means two or more. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined as "first," "second," or "third" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0024] This application provides a radio frequency signal calibration method, referencing... Figure 1 , Figure 1 This is a flowchart of a radio frequency signal frequency calibration method provided in an embodiment of this application. The method includes: Step S101: Control the frequency generation circuit to output the radio frequency signal to be calibrated, and control the sampling circuit to sample the radio frequency signal to be calibrated according to the calibration period time window, which includes several consecutive sub-time windows. In this context, the frequency generation circuit refers to the hardware module in an RF transceiver system used to generate a specific frequency oscillation signal, such as a voltage-controlled oscillator (VCO) or a digitally controlled oscillator (DCO). The RF signal to be calibrated refers to the periodic voltage waveform output by the frequency generation circuit, which has not yet undergone final frequency locking and may contain frequency deviations. The sampling circuit refers to the circuit unit used to count and measure the edges or periods of the RF signal to be calibrated, such as a high-frequency counter or a time-to-digital converter. The calibration cycle time window represents the total physical duration of executing one complete frequency calibration algorithm. A sub-time window refers to an independent time segment after the calibration cycle time window is uniformly or non-uniformly divided on the time axis, used to independently perform counting operations within that segment.
[0025] Specifically, this step is typically triggered during chip power-on initialization, system reset, or during idle time slots specified in the communication protocol. When the system enters calibration mode, the digital baseband processor sends an enable signal to the frequency generation circuit, controlling the circuit to oscillate with a preset coarse-tuning control word and output the RF signal to be calibrated. Simultaneously, the sampling circuit starts operating, but unlike the traditional method of performing only one long-gate count, this step divides the entire calibration cycle time window into several consecutive sub-time windows in the time domain. For example, if the total duration of the calibration cycle time window is set to 100 microseconds, the system divides it into 10 consecutive sub-time windows, each 10 microseconds long. Within each sub-time window, the sampling circuit independently captures and counts the rising or falling edge of the RF signal to be calibrated, and sequentially stores the counting results of each sub-time window into a register or memory, forming a set of raw sampling data with time-series characteristics, thus preserving the transient characteristics of frequency changes over time.
[0026] Step S102: Calculate the theoretical number of pulses within the sub-time window based on the duration of the sub-time window and the ideal frequency of the RF signal to be calibrated; The duration of the sub-time window refers to the duration for which the sampling circuit keeps the counting gate open within each independent time segment. This value is typically determined by a high-precision system reference clock. The ideal frequency of the RF signal to be calibrated refers to the target frequency value that the frequency generation circuit should output, as required by the system design, such as 2.402 GHz in a Bluetooth system or 5.18 GHz in a Wi-Fi system. The theoretical pulse count represents the number of signal cycles that the frequency generation circuit should generate within the duration of the sub-time window under ideal conditions where there are no frequency errors or noise interference.
[0027] Specifically, this step involves calculating the calibration baseline. Since the duration of the sub-time window is a pre-set known quantity by the system, and the ideal frequency of the RF signal to be calibrated is also a known quantity determined by the communication channel requirements, the system can obtain the theoretical pulse count through multiplication. The calculation formula is: The theoretical pulse count equals the ideal frequency multiplied by the duration of the sub-time window. For example, if the ideal frequency of the RF signal to be calibrated is 2.4 GHz (i.e., 2.4 × 10⁻⁶ pulses per second)... 9 (1 cycle), and the duration of the sub-time window is set to 10 microseconds (i.e., 10). -5 If the time interval is 1 second, the theoretical pulse count calculated by the system is 24,000. This theoretical pulse count will serve as the standard reference value for measuring the actual frequency deviation in subsequent steps. For all sub-time windows of equal duration, this theoretical pulse count is a fixed constant.
[0028] Step S103: Obtain the actual number of pulses within each sub-time window, and calculate the difference between the actual number of pulses and the theoretical number of pulses to obtain the deviation pulse count; The actual pulse count refers to the number of complete cycles or edges of the RF signal to be calibrated that the sampling circuit actually monitors within a specific sub-time window. The deviation pulse count refers to the degree of deviation of the actual number of pulses measured within the same sub-time window from the ideal reference value, and is used to quantify the average frequency error within the current time segment.
[0029] Specifically, this step performs preliminary processing on the raw data acquired by the sampling circuit. The system reads the actual pulse count corresponding to each sub-time window from the memory and subtracts it from the theoretical pulse count calculated in step S102. For example, in the first sub-time window, the theoretical pulse count should be 24000, but the actual pulse count recorded by the sampling circuit is 24005, so the deviation pulse count corresponding to this sub-time window is +5; in the second sub-time window, the actual pulse count is 23998, so the corresponding deviation pulse count is -2. The system performs the above sub-sub-process for each sub-time window within the calibration cycle time window, thereby generating a set of deviation pulse count sequences corresponding to the time sequence. Each value in this sequence directly reflects whether the frequency in the corresponding time segment is too high (positive value) or too low (negative value), and the magnitude of the deviation.
[0030] Step S104: Sum the number of all deviation pulses in chronological order and construct a cumulative error sequence; Here, "arranged in chronological order" refers to arranging the data according to the order in which the sub-time windows occur within the calibration cycle time window. "Accumulated summation" refers to the mathematical operation of integrating the number of deviation pulses, meaning the accumulated value at the current moment equals the accumulated value at the previous moment plus the deviation value at the current moment. The accumulated error sequence is an ordered set of data composed of the accumulated summations at each time point. Physically, this sequence converts the error in the frequency domain (frequency deviation) into an error in the phase domain (phase accumulation).
[0031] Specifically, this step aims to reveal the evolution trend of frequency error through mathematical transformation. The system initializes an accumulator to zero, and then sequentially reads and accumulates the deviation pulse counts generated in step S103. For example, if the deviation pulse count sequence is [+2,+2,+2,+3,+3], the constructed cumulative error sequence is [2,4,6,9,12]. In this process, if the frequency deviation is constant (i.e., the deviation is the same for each sub-window), the cumulative error sequence will exhibit a linear growth characteristic; if the frequency deviation changes with time (e.g., the frequency is drifting), the deviation pulse count itself will increase or decrease with time, causing the cumulative error sequence to exhibit a parabolic or other non-linear growth characteristic. By constructing the cumulative error sequence, the tiny frequency drift trend that was originally submerged in the single-count noise will be amplified and displayed as the curvature of the curve, thus facilitating subsequent feature extraction.
[0032] Step S105: Perform second-order polynomial fitting on the cumulative error sequence, and extract the first-order and second-order coefficients of the fitting curve. The first-order coefficients represent the static fixed frequency offset of the radio frequency signal, and the second-order coefficients represent the dynamic drift rate of the radio frequency signal frequency over time. Among them, second-order polynomial fitting refers to using mathematical algorithms (such as the least squares method) to find a polynomial of the form y = at. 2 The parabolic curve of +bt+c is designed to approximate the data points in the cumulative error sequence as closely as possible. The cumulative error sequence is physically equivalent to the phase error sequence. Since phase is the integral of frequency, the linear frequency drift manifests as a parabola in the phase domain, allowing the second-order fitting to effectively separate the error components. First-order coefficients (b in the formula above) represent the coefficients of the first-order term in the fitting polynomial, indicating the slope of the tangent line at time zero. Second-order coefficients (a in the formula above) represent the coefficients of the second-order term in the fitting polynomial, indicating the opening direction and curvature of the fitting curve. Static fixed frequency offset represents the constant frequency error component in the RF signal to be calibrated that does not change with time. Dynamic drift rate represents the rate at which the frequency of the RF signal to be calibrated increases or decreases unidirectionally with time.
[0033] Specifically, this step utilizes the calculus relationship between phase (cumulative error), frequency, and the rate of change of frequency for parameter separation. At the physical level, frequency is the derivative of phase, and the frequency drift rate is the derivative of frequency (i.e., the second derivative of phase). Therefore, after performing a second-order fitting on the cumulative error sequence, the extracted first-order coefficient *b* directly reflects the average frequency error at the initial calibration moment, i.e., the static fixed frequency deviation; the extracted second-order coefficient *a* directly reflects the acceleration of the frequency error over time, i.e., the dynamic drift rate. For example, if the fitted first-order coefficient is large while the second-order coefficient is close to zero, it indicates that the cumulative error sequence is a straight line, with a fixed frequency deviation but no drift; if the second-order coefficient is significantly non-zero, such as being positive, it indicates that the cumulative error sequence is bending upwards, and the frequency is rapidly drifting towards higher frequencies over time (e.g., due to self-heating effects). Through this fitting method, the system can decouple the "quasi-static" process error and the "dynamic" temperature drift error from a single sampled data set.
[0034] Step S106: When the absolute value of the first-order coefficient is greater than the first-order coefficient threshold and the absolute value of the second-order coefficient is less than or equal to the second-order coefficient threshold, calculate the static compensation amount based on the first-order coefficient, and correct the frequency of the RF signal to be calibrated according to the static compensation amount. The first-order coefficient threshold refers to the maximum allowable static frequency error tolerance of the system, which is usually determined by the accuracy requirements of the center frequency in the communication protocol. The second-order coefficient threshold is the critical value for the system to determine whether the frequency is in a stable state, used to distinguish whether the frequency has a constant deviation or drifts over time. The static compensation amount refers to the constant correction value that needs to be applied to the frequency generation circuit to eliminate fixed frequency deviations. This value corresponds to a fixed switching state of the capacitor array or a fixed position of the current source.
[0035] Specifically, this step handles frequency calibration scenarios where the RF system is in thermal equilibrium or stable operating conditions. In this scenario, the system first performs a logical decision based on the coefficients extracted in step S105: if the absolute value of the second-order coefficient is less than or equal to the second-order coefficient threshold, it indicates that the cumulative error sequence exhibits good linearity and the frequency has not drifted significantly over time; however, if the absolute value of the first-order coefficient is greater than the first-order coefficient threshold, it indicates that the slope of the straight line deviates from the ideal zero value, and there is a significant fixed frequency offset. After confirming this state, the system uses the first-order coefficient as an input variable, substitutes it into the preset frequency-control word transfer function, and calculates the static compensation amount required to pull the frequency back to the target point. This process is essentially a one-time static operating point reset. For example, if the first-order coefficient indicates that the current frequency is 50kHz higher than the target frequency and there is no drift, the system calculates that an additional 2 units of capacitor array load value is needed as static compensation, and writes this value into the frequency control register at once. In response to the update of this static parameter, the frequency generation circuit will cause its output frequency to change in a step and lock at the new frequency point, thereby completing the correction of fixed process error or voltage error without considering the time variable.
[0036] Step S107: When the absolute value of the second-order coefficient is greater than the second-order coefficient threshold and the absolute value of the first-order coefficient is less than or equal to the first-order coefficient threshold, calculate the dynamic drift compensation amount based on the second-order coefficient, and correct the frequency of the RF signal to be calibrated according to the dynamic drift compensation amount. Among them, dynamic drift compensation refers to a set of control quantities that need to be artificially introduced to counteract the autonomous slippage of frequency over time, which exhibits a reverse trend over time.
[0037] Specifically, this step addresses non-steady-state frequency calibration scenarios caused by oscillator self-heating or drastic changes in ambient temperature during startup. The logic judgment unit first calculates and verifies whether the absolute value of the second-order coefficients exceeds the second-order coefficient threshold, indicating whether the frequency is changing too rapidly. In this scenario, the system first determines the rate and direction of frequency drift based on the second-order coefficients. Subsequently, the system generates a frequency adjustment numerical sequence that dynamically changes over time, with the trend of this sequence strictly opposite to the detected direction of frequency drift. For example, assuming that the frequency is drifting positively at a rate of 10 kHz per millisecond (i.e., +10 kHz / ms) calculated using the second-order coefficients, the system will generate a frequency adjustment numerical sequence that produces a frequency deviation effect of -10 kHz per millisecond. If the control precision of the frequency generation circuit is 1 kHz / Code, the numerical representation of this sequence on the time axis is [-10, -20, -30, -40...], meaning that the values in the sequence continuously decrease over time. Conversely, if a negative frequency drift is detected at a rate of -5 kHz / ms, the system generates a numerically increasing sequence [+5, +10, +15, +20...], with a positive increasing trend.
[0038] Finally, the system activates the dynamic compensation execution engine, writing the values in the frequency adjustment sequence one by one into the frequency control interface of the frequency generation circuit in chronological order. This process forces the frequency output of the frequency generation circuit to produce a reverse dynamic offset. For example, in the first time slice, the system writes the value -10, forcing the frequency to drop by 10kHz; in the second time slice, the system writes the value -20, forcing the frequency to drop by 20kHz. Since the original physical drift would cause the frequency to naturally rise by 20kHz in the second time slice, the -20kHz offset written by the system precisely cancels out the physical drift. Through this continuous, dynamic writing operation, the system constructs a "negative frequency slope" in the time domain that is completely complementary to the environmental drift, thereby firmly locking the frequency of the RF signal to be calibrated onto the ideal frequency line, achieving real-time tracking and elimination of rapidly changing frequency errors.
[0039] Step S108: When the absolute value of the first-order coefficient is greater than the first-order coefficient threshold and the absolute value of the second-order coefficient is greater than the second-order coefficient threshold, calculate the dynamic drift compensation amount and the final static compensation amount based on the first-order coefficient and the second-order coefficient, and correct the frequency of the RF signal to be calibrated according to the dynamic drift compensation amount and the final static compensation amount. Specifically, this step is performed when the system identifies a scenario where the RF signal to be calibrated is in a high-order composite error state, meaning the signal not only has an inherent frequency offset but also exhibits a significant time-varying drift trend. When the absolute value of the first-order coefficient exceeds the first-order coefficient threshold and the absolute value of the second-order coefficient exceeds the second-order coefficient threshold, it indicates that single-dimensional calibration cannot meet the accuracy requirements, necessitating a multi-parameter joint decoupling correction. In this process, the system first constructs a dynamic drift compensation amount to compensate for frequency slippage in real time based on the drift rate represented by the second-order coefficient. Considering that the introduction of dynamic compensation changes the signal's frequency reference at the initial moment, the system further calculates the equivalent bias effect of this dynamic drift compensation amount on the frequency and uses this effect value to correct the original static compensation amount calculated based on the first-order coefficient, thus obtaining the final static compensation amount after eliminating coupling errors. Finally, the frequency synthesis unit of the RF signal to be calibrated is synchronously adjusted using the dynamic drift compensation amount and the final static compensation amount, accurately locking the center frequency while eliminating time-varying drift.
[0040] The following is a more detailed description of the process of the method provided in this implementation.
[0041] Optionally, this solution may also execute steps S10801-S10804; Step S10801: When the absolute value of the first-order coefficient is greater than the first-order coefficient threshold and the absolute value of the second-order coefficient is greater than the second-order coefficient threshold, calculate the dynamic drift compensation amount based on the second-order coefficient. Specifically, this step is performed in a complex unlock scenario where the RF signal to be calibrated exhibits both significant fixed frequency offset and significant frequency drift. In this scenario, the system first identifies that the frequency error has composite characteristics and cannot be resolved solely through static adjustment or dynamic tracking. For the frequency drift component, the system uses second-order coefficients for independent dynamic modeling. This calculation process is consistent with the processing logic in step S107: the system first resolves the rate and direction of frequency drift based on the magnitude and sign of the second-order coefficients; subsequently, it generates a frequency adjustment numerical sequence that dynamically changes over time, with the trend of this sequence opposite to the resolved direction of frequency drift. For example, if the second-order coefficients indicate that the frequency is linearly drifting towards higher frequencies at a rate of +10 kHz / s, the dynamic drift compensation calculated by the system based on these coefficients is a numerical sequence decreasing at a rate of -10 kHz / s; if the second-order coefficients indicate that the frequency drift exhibits a parabolic acceleration trend, the system calculates a parabolic compensation sequence with the opposite opening direction.
[0042] Step S10802: Calculate the frequency change value caused by correcting the frequency of the RF signal to be calibrated using dynamic drift compensation. The frequency change value refers to the change in frequency caused by the single factor of dynamic drift compensation acting on the frequency generation circuit at the initial moment of calibration (i.e., time axis t=0). The RF signal to be calibrated refers to the original RF waveform output by the frequency synthesizer or oscillator.
[0043] This step is performed after the system has determined the mathematical expression or data sequence of the dynamic drift compensation amount based on the second-order coefficients, and before calculating the static compensation amount. Specifically, the system first extracts the mathematical model or discrete sequence used to characterize the dynamic drift compensation amount. Then, the system sets the time variable to the initial moment (i.e., t=0) and calculates the compensation value corresponding to that moment. Finally, based on the correspondence between this compensation value and the frequency adjustment sensitivity, the system calculates the frequency offset generated when this compensation value is applied to the RF signal to be calibrated, and determines this offset as the frequency change value.
[0044] For example, if the dynamic drift compensation amount determined by the system is the mathematical model F(t) = -10t + 50 (where t is the running time in seconds; F(t) is the frequency adjustment amount in Hz), the system substitutes t = 0 into the model and calculates F(0) = 50. At this time, the system determines that the frequency change caused by the frequency of the RF signal to be calibrated is corrected by the dynamic drift compensation amount to be 50Hz.
[0045] For example, if the dynamic drift compensation determined by the system is a discrete voltage sequence [0.5V, 0.51V, 0.52V, ...], and the voltage control sensitivity is known to be 1000Hz / V, the system reads the first data point in the sequence, which is 0.5V (corresponding to time t=0). The system calculates that the frequency change caused by this voltage is 0.5 × 1000 = 500Hz. At this point, the system determines that the frequency change caused by using the dynamic drift compensation to correct the frequency of the RF signal to be calibrated is 500Hz.
[0046] Step S10803: Calculate the static compensation amount based on the first-order coefficients, and correct the static compensation amount according to the frequency change value to obtain the final static compensation amount. The static compensation amount refers to the theoretical correction value calculated based solely on the fixed frequency error represented by the first-order coefficients, according to the transfer function of the frequency generation circuit. The final static compensation amount refers to the correction value actually used to set the static operating point of the circuit after deducting the interference of dynamic compensation on the initial frequency.
[0047] Specifically, this step performs error decoupling and parameter correction. The system first calculates the original static compensation amount under drift-free conditions based on the first-order coefficients. For example, if the first-order coefficients show that the current frequency is 100kHz higher than the target frequency, the system calculates the corresponding static compensation amount as -100kHz. However, the system must incorporate the frequency change value calculated in step S10802 for correction to avoid deviation in the initial total correction amount due to the intervention of dynamic compensation. The correction logic is to subtract the frequency change value from the original static compensation amount.
[0048] For example, if the initial static compensation is -100kHz (aiming to reduce frequency by 100kHz), and the dynamic drift compensation introduces a frequency change of -5kHz at the start (i.e., the frequency change is -5kHz), the system calculates the final static compensation as: -100 - (-5) = -95kHz. This means that the system only needs to write the corresponding -95kHz control word into the static register, plus the -5kHz at the start of the dynamic sequence, and the total effect is exactly -100kHz. Conversely, if the frequency change is a positive value of +10kHz, the final static compensation is adjusted to -110kHz. Through this calculation, the system ensures precise coordination between the static and dynamic compensation mechanisms at the time origin.
[0049] Step S10804: Correct the frequency of the RF signal to be calibrated based on the dynamic drift compensation amount and the final static compensation amount; The dynamic drift compensation amount refers to the frequency control sequence that changes continuously over time. The final static compensation amount refers to the corrected fixed frequency control word. Correcting the frequency of the RF signal to be calibrated refers to the process of converting the digital control signal into physical voltage or current to drive the frequency generation circuit to change the output frequency.
[0050] Specifically, this step is the execution phase of the composite calibration scheme. The system applies both static and dynamic control signals collaboratively through a hardware interface. First, the system writes the final static compensation amount calculated in step S10803 into the static control interface (such as the coarse adjustment capacitor array) of the frequency generation circuit to establish the correct initial frequency reference point; simultaneously, the system starts the dynamic compensation engine and writes the dynamic drift compensation sequence generated in step S108 into the fine adjustment interface (such as the varactor diode control terminal) one by one according to a predetermined time step.
[0051] For example, in the first microsecond of calibration, the system writes the final static compensation value "1000" and simultaneously writes the first value of the dynamic sequence "-1", pulling the frequency output back to the target value. In the second microsecond, the static value remains "1000", while the dynamic value is updated to "-2". In the third microsecond, the dynamic value is updated to "-3". As time progresses, the static compensation value consistently restrains the fixed process error, while the dynamic drift continuously cancels out the frequency drift components caused by temperature increases or voltage fluctuations. The combined effect of these two factors ensures that the frequency of the RF signal to be calibrated remains locked to the target frequency throughout the entire time domain.
[0052] Optionally, steps S10601-S10603 are a more specific version of step S106 in this solution; Step S10601: Obtain the current frequency resolution of the frequency generation circuit. The frequency resolution is determined by the reference clock frequency and the bit width of the phase-locked loop divider. Frequency resolution refers to the smallest frequency change step that the frequency generation circuit can achieve under digital control; that is, the change in output frequency when the least significant bit (LSB) of the control word is changed. For example, if the frequency resolution is 10Hz, the frequency generation circuit can only adjust the frequency in 10Hz increments and cannot accurately output a 10.5Hz change. The reference clock frequency refers to the oscillation frequency of the crystal oscillator or external clock source that serves as the reference for the frequency generation circuit. For example, a clock signal provided by a temperature-compensated crystal oscillator (TCXO) with a nominal frequency of 26MHz. The bit width of the phase-locked loop (PLL) divider refers to the number of bits of data in the register of the fractional divider used to control the division ratio in the PLL feedback loop; this number of bits determines the accuracy of the division ratio.
[0053] This step is performed before the system needs to calculate the specific static compensation control word. Specifically, the system first reads the hardware configuration register of the frequency generation circuit or a preset system parameter file to obtain the reference clock frequency and the bit width of the phase-locked loop (PLL) divider. Then, based on the working principle of the PLL, the system calculates the frequency resolution using a formula typically expressed as: frequency resolution equals the reference clock frequency divided by 2 raised to the power of the bit width. The system stores the calculated frequency resolution value as the conversion reference for subsequently converting the analog frequency deviation into digital control step values.
[0054] For example, if the system reads a reference clock frequency of 26,000,000 Hz, the bit width of the phase-locked loop divider is 20 bits (i.e., 2... 20 =1048576). The system calculates the frequency resolution to be approximately 24.8 Hz.
[0055] For example, if the system reads a reference clock frequency of 40,000,000 Hz, the bit width of the phase-locked loop divider is 24 bits (i.e., 2... 24=16777216). The system calculates the frequency resolution to be approximately 2.38 Hz.
[0056] Step S10602: Determine the frequency deviation value of the RF signal to be calibrated based on the first-order coefficient, and divide the frequency deviation value by the frequency resolution to obtain the quantization adjustment step value. The frequency deviation value refers to the physical difference between the actual frequency of the RF signal to be calibrated and the ideal target frequency, typically measured in Hertz (Hz). For example, if the actual frequency is 5 kHz higher than the target frequency, the frequency deviation value is +5000 Hz. Frequency resolution refers to the smallest frequency unit that the frequency generation circuit can change under digital control. The quantization adjustment step value is the integer code, in units of minimum resolution, that needs to be written into the frequency control register to compensate for analog frequency errors. For example, if a 10-resolution step is required, the quantization adjustment step value is 10.
[0057] This step is executed after the system has completed fitting the accumulated error sequence, extracted the first-order coefficients, and calculated the hardware frequency resolution. Specifically, the system first performs a conversion based on the physical principles of integration and differentiation: since the accumulated error sequence is constructed by accumulating the number of deviation pulses over time, its physical meaning is equivalent to the accumulation of phase error over time (i.e., the change in phase); and in physics, the rate of change of phase over time (i.e., the derivative of the phase) is defined as frequency. Therefore, the system directly interprets the first-order coefficients obtained by fitting the accumulated error sequence (i.e., the slope of the fitted curve) as the frequency deviation value of the RF signal to be calibrated relative to the ideal frequency. If the time axis of the fitting is in seconds, the value of the first-order coefficient is directly equal to the frequency deviation value in Hertz (Hz); if the time axis of the fitting is the sampling point number, the system converts the coefficient into a frequency deviation value in Hertz units according to the duration of the sub-time window. Subsequently, the system performs digital quantization calculations, dividing the determined frequency deviation value (Hz) by the frequency resolution (Hz / Step). Since the hardware registers cannot receive decimals, the system performs integer operations on the result of the division calculation (such as rounding or truncating) to obtain an integer quantization adjustment step value. This value precisely quantizes how many steps need to be adjusted in the digital control domain to eliminate the measured frequency deviation in the physical domain.
[0058] For example, the system fits the cumulative error sequence to a function y = 200t (ignoring second-order terms), where t is in seconds. Based on the physical definition, the system identifies the slope of the cumulative phase error as 200, directly determining the frequency deviation of the RF signal to be calibrated to be 200Hz. Given a frequency resolution of 10Hz, the system calculates 200 / 10 = 20. Therefore, the system obtains a quantization adjustment step value of 20.
[0059] For example, the first-order coefficients obtained from the system fitting are -4500 (representing a frequency deviation of 4500Hz), with a frequency resolution of 24.8Hz. The system determines the frequency deviation to be -4500Hz. The system calculates -4500 / 24.8≈-181.45. After rounding, the system obtains a quantization adjustment step value of -181.
[0060] Step S10603: Use the quantization adjustment step value as the static compensation amount to adjust the frequency adjustment parameters of the frequency generation circuit in order to eliminate the static fixed frequency deviation. This step is executed after the system has calculated the quantization adjustment step value, and belongs to the final execution and hardware activation stage of the static calibration process. Specifically, the system first directly confirms the quantization adjustment step value calculated in the previous steps as the static compensation amount. Subsequently, the system reads the currently effective frequency adjustment parameters of the frequency generation circuit through the control bus (such as SPI or I2C). Based on the negative feedback adjustment principle, the system adds the static compensation amount to the frequency adjustment parameters. If the frequency adjustment parameters defined by the system are positively correlated with the output frequency, and the quantization adjustment step value represents a positive frequency deviation (i.e., the frequency is too high), the system subtracts the static compensation amount from the current frequency adjustment parameters; conversely, if the quantization adjustment step value represents a negative frequency deviation (i.e., the frequency is too low), the system adds the static compensation amount to the current frequency adjustment parameters (the specific addition and subtraction logic depends on the frequency deviation sign and control word polarity defined by the hardware). The system writes the calculated and corrected frequency adjustment parameters into the hardware control register of the frequency generation circuit. After receiving the updated frequency adjustment parameters, the frequency generation circuit drives the voltage-controlled oscillator to adjust the oscillation frequency through its internal phase-locked loop, causing a physical shift in the center frequency of the output signal. This physically cancels out the original static fixed frequency deviation, achieving precise frequency locking to the target value.
[0061] For example, if the current frequency adjustment parameter (decimal division control word) of the frequency generation circuit is 500000, and the calculated quantization adjustment step value is 200 (representing a frequency deviation of 200 resolution units), the system performs a subtraction operation: 500000 - 200 = 499800. The system writes 499800 to the register, causing the output frequency to decrease, thereby eliminating the positive static fixed frequency deviation.
[0062] For example, if the current frequency adjustment parameter is 0x1A000 (hexadecimal), and the quantization adjustment step value is -50 (representing a frequency that is 50 resolution units too low), the system performs an addition operation (assuming the negative sign indicates that the frequency is too low and needs compensation): 0x1A000 + 50 (decimal). The system writes the calculation result to the register, causing the output frequency to increase, thereby eliminating the negative static fixed frequency offset.
[0063] Optionally, after step S105, this scheme may also execute steps S109-S113; Step S109: Calculate the longitudinal distance between each data point in the cumulative error sequence and the corresponding point in the fitted curve to obtain the residual sequence; This step is performed after the polynomial fitting is completed. Specifically, the system iterates through the time points corresponding to each sub-time window, substituting that time into the fitted curve equation to calculate the theoretical cumulative error value. Then, the system subtracts this theoretical value (or takes the absolute value) from the actually observed cumulative error value to obtain the residual at that point. The system records the residuals of all time points sequentially, generating a residual sequence. This sequence visually reflects the "jitter" or "noise" components in the measurement data.
[0064] Step S110: Calculate the statistical variance of the residual sequence and determine the statistical variance as the fitting noise index; The fitting noise index is a quantization parameter defined by the system to represent the physical strength of random noise or phase jitter present in the current radio frequency signal. For example, this index is a floating-point value, and a larger value indicates greater noise power in the signal.
[0065] This step aims to numerically quantify the signal-to-noise ratio (SNR) characteristics of the measured signal. Specifically, the system reads the residual sequence generated in step S109 and calculates all values in the sequence according to the variance calculation formula. Since the residual sequence represents the random signal components after removing frequency offset and drift trends, calculating its variance is equivalent to calculating the power or intensity of noise. The system directly assigns the calculated variance value to the fitted noise index variable. This index objectively reflects the quality of the measured signal under the current physical environment: the lower the fitted noise index, the purer the signal, and the more closely the measured data are distributed around the fitted curve; the higher the fitted noise index, the more severely the signal is affected by external interference or internal thermal noise, and the measured data has greater random fluctuations.
[0066] Step S111: Determine whether the fitted noise index is less than the preset noise threshold. The preset noise threshold is a numerical constant pre-set and stored by system designers based on the measurement accuracy limits of the hardware circuit, the error tolerance of the application scenario, and the stability requirements of the control algorithm. It represents the maximum allowable noise intensity for which the system considers the measurement data reliable. For example, setting this threshold to 0.005 means that signals with a variance exceeding this value are considered unusable.
[0067] This step is a logic branch decision based on numerical comparison. Specifically, the system reads the fitted noise index calculated in step S110 and compares it with a preset noise threshold in the memory. This step is used to screen whether the current measurement environment meets the conditions for high-precision frequency calibration. If the fitted noise index is less than the preset noise threshold, the system determines that the signal-to-noise ratio of the current signal meets the requirements, and the logical judgment result is true; if the fitted noise index is greater than or equal to the preset noise threshold, the system determines that the current signal noise is too high, which may cause a large deviation in the calculated frequency parameters, and the logical judgment result is false.
[0068] Step S112: If the fitted noise index is less than the noise threshold, then the first-order and second-order coefficients are determined to be valid. This step is executed when the result of step S111 is true. Specifically, the system confirms that the current fitting noise index is within the allowable range, indicating that the variance of the residual sequence is small, the multinomial regression model can well explain the changing trend of the measurement data, and the impact of random noise on the coefficient calculation is negligible. Therefore, the system marks the calculated first-order and second-order coefficients as usable and triggers the subsequent frequency correction process, passing these two coefficients as input parameters to the frequency compensation algorithm to calculate the specific frequency adjustment step and update the hardware registers.
[0069] Step S113: If the fitted noise index is not less than the noise threshold, the first-order coefficients and second-order coefficients are invalid, and the calibration cycle time window for the next round of sampling is adjusted. This step is executed when the result of step S111 is false, i.e., the system is in a high-noise environment or under abnormal disturbance. Specifically, when the system detects that the fitted noise index exceeds the limit, it first triggers a protection mechanism, directly discarding the currently calculated coefficients to maintain the stability of the frequency output and avoid introducing erroneous control quantities due to transient interference. Subsequently, the system starts an adaptive measurement control strategy to reconstruct the observation model for the next round based on the current noise level. Adjusting the calibration cycle time window is essentially a signal processing strategy that trades time for accuracy: the system dynamically adjusts the equivalent noise bandwidth of the measurement by changing the observation time scale (usually an extended window). This adjustment aims to optimize the system's ability to suppress random noise, enabling the system to automatically find the optimal balance between "measurement real-time performance" and "data stability" based on the severity of the external environment, thereby ensuring that the algorithm maintains the robustness and convergence of the measurement under different noise environments.
[0070] Optionally, steps S11301-S11302 are a more specific embodiment of step S113; Step S11301: Keep the frequency adjustment parameters of the frequency generation circuit unchanged, and output the same RF signal to be calibrated as the previous round of sampling; In this context, the frequency generation circuit refers to the hardware module in a chip or system responsible for generating periodic radio frequency signals, representing the source of the physical signal. Examples include a voltage-controlled oscillator (VCO) or a digitally controlled oscillator (DCO). Frequency adjustment parameters are digital control words or analog voltage values input to the frequency generation circuit, representing the command variables controlling the output frequency. Examples include digital codes controlling the switching state of a capacitor array or the bias voltage controlling a varactor diode. The previous sampling cycle refers to a complete calibration cycle immediately preceding the current measurement cycle, representing the most recently determined and applied control state by the system. The radio frequency signal to be calibrated refers to the physical waveform output by the frequency generation circuit, undergoing frequency error monitoring, representing the controlled object.
[0071] This step represents the system's immediate steady-state control response in high-noise environments. Specifically, when the system determines that the currently calculated error coefficient is invalid, the control logic immediately executes a state-locking strategy. The system blocks any frequency update instructions derived from the current calculation and prohibits writing parameters that may contain large random errors into hardware registers. The system forces the frequency generation circuit to continue using the frequency adjustment parameters determined at the end of the previous sampling cycle, thereby maintaining the frequency characteristics of the output signal unchanged. This "zero-order hold" or "state freeze" mechanism aims to prevent erroneous compensation caused by noise from interfering with the normal operation of the circuit, ensuring that the system output does not experience drastic frequency jumps or oscillations even when the signal-to-noise ratio deteriorates, thus guaranteeing system stability.
[0072] Step S11302: Increase the calibration cycle time window of the next round of sampling to a preset duration, and increase the number of sub-time windows of the next round of sampling to a preset number; The preset duration refers to a fixed time increment value stored in the system configuration, used to represent the step size for expanding the observation scale. For example, an increase of 0.5 milliseconds. A sub-time window refers to several smaller, independent sampling intervals into which the total calibration period is divided, used to represent the temporal granularity or integration unit of data acquisition. The preset number refers to the target value for the number of sub-windows re-planned to accommodate longer measurement times, used to represent the target for expanding the sample capacity. For example, increasing the number of sub-windows from 10 to 20.
[0073] This step involves the system's measurement model reconstruction and adaptive optimization process for high-noise environments. Specifically, after freezing the current frequency state, the system immediately reconfigures the parameters of the timer and counter responsible for acquisition control, preparing for the next round of sampling. The system first extends the total length of the calibration cycle time window by superimposing a preset duration. This operation physically increases the signal observation integration time, utilizing the characteristic that white noise has a zero mean under long-time integration to reduce the interference energy of random noise on the measurement results. Simultaneously, the system increases the number of sub-time windows to a preset number, meaning that within the extended total observation time, the system will acquire more independent data samples or maintain sufficient data sampling density. Through this strategy combining "time-domain extension" and "sample expansion," the system effectively compresses the equivalent noise bandwidth of the measurement, improves the statistical confidence of the next round of measurement data, and thus gains the ability to obtain accurate frequency errors in harsh noise environments while sacrificing some measurement real-time performance.
[0074] Optionally, after step S112, this scheme may also execute steps S114-S117; Step S114: Obtain a preset number of historical fitting noise indices before the current sampling, and combine the current sampling fitting noise index with the historical fitting noise index in chronological order to construct a noise trend monitoring sequence. The preset quantity refers to the data depth or queue length allocated in the system memory for storing past states, representing the time span for reviewing historical data. For example, it can be set to 5 or 10 historical data points. The historical fitting noise index refers to the fitted noise index value calculated and stored over several sampling periods prior to the current moment, representing the signal quality record over a past period. For example, a set of floating-point numbers [0.002, 0.003, 0.002] stored in a first-in-first-out queue. The noise trend monitoring sequence refers to a time series array formed by merging historical data and current data, representing the complete trajectory of noise intensity evolution over time. For example, an array [0.002, 0.003, 0.002, 0.004].
[0075] This step, executed after step S112, aims to establish the foundation for time-domain analysis of noise changes. Specifically, the system first accesses internal storage or register files to read the fitted noise index saved in previous calibration loops. Then, the system appends the fitted noise index calculated in this sampling to the end of the read data, arranging it chronologically to form a new noise trend monitoring sequence containing information over a specific time span. This sequence not only includes the current noise level but also contains dynamic characteristics indicating whether the noise is stable, increasing, or decreasing, providing data support for subsequent trend prediction.
[0076] Step S115: Perform first-order linear regression analysis on the noise trend monitoring sequence and extract the slope of the regression line as the noise change rate. First-order linear regression analysis is a statistical method used to find the linear equation that best fits the distribution of data points using algorithms such as least squares, representing the linear dependence between variables. For example, the equation y = kx + b is established. The regression line is the ideal straight line trajectory calculated using the above analysis method, representing the overall trend of the data. The slope refers to the inclination of the regression line relative to the time axis, indicating the rate of increase or decrease of data over time. For example, the value of k in the equation. The rate of change of noise refers to the slope value extracted by the system, used to represent the dynamic speed of environmental noise deterioration or improvement.
[0077] This step aims to transform discrete noise data into quantifiable dynamic trend indicators. Specifically, the system uses data points from the noise trend monitoring sequence as the ordinate and the corresponding sampling order or timestamp as the abscissa, inputting them into the linear regression algorithm module. The algorithm calculates an optimally fitted straight line reflecting the noise change trend by minimizing the sum of squared errors. Subsequently, the system extracts the slope parameter of this line and defines it as the noise change rate. This rate quantifies the direction of change in the stability of the current measurement environment: a positive value indicates that the noise is increasing and the environment is deteriorating; a negative value indicates that the noise is decreasing and the environment is stabilizing; the magnitude of the absolute value reflects the drasticness of the change.
[0078] Step S116: Calculate the dynamic correction coefficient based on the noise change rate. The dynamic correction coefficient is positively correlated with the noise change rate. Among them, the dynamic correction coefficient refers to the weighting factor or proportional parameter generated by the system based on the trend of environmental changes, used to adjust the final control quantity, and is used to represent the degree of correction to the confidence level of the calculation results. For example, a floating-point coefficient ranging from 0 to 1. Positive correlation refers to a functional relationship that means that when the independent variable increases, the dependent variable also increases, used to represent the synchronicity of the changes between the two.
[0079] This step transforms trend indicators into specific control weights. Specifically, the system reads the noise change rate calculated in step S115 and calculates the dynamic correction coefficient using a preset mapping function or lookup table method. Due to the established positive correlation, when the noise change rate is large (i.e., noise increases rapidly), the dynamic correction coefficient calculated by the system also increases; conversely, when the noise change rate is small or close to zero, the dynamic correction coefficient is also small. This mechanism establishes a feedforward adjustment logic: the system adjusts the strength of the control strategy in advance not only based on the current noise level, but also on the trend of noise growth, to cope with upcoming more severe environments or data jitter.
[0080] Step S117: When the noise change rate is positive and greater than the rate threshold, use the dynamic correction coefficient to adjust the static compensation amount and the dynamic drift compensation amount. The rate threshold is a threshold value set by the system to represent the minimum rate of change required to determine that the noise environment has significantly deteriorated. For example, it can be set to 0.0005.
[0081] This step performs the final parameter correction and application. Specifically, the system first performs a conditional judgment on the noise change rate. Only when the rate is positive (indicating that the noise is increasing) and its value exceeds a preset rate threshold (indicating that the increase is rapid and cannot be ignored), does the system trigger the correction mechanism. At this time, the system calls the dynamic correction coefficients generated in step S116 to perform mathematical operations (such as weighted attenuation or gain adjustment) on the static compensation and dynamic drift compensation amounts originally converted from first-order and second-order coefficients. The adjusted compensation amounts are written to the hardware register. When a sharp deterioration in environmental noise is detected, this process reduces the confidence in the current measurement results or performs preventative compensation by using dynamic correction coefficients, thereby preventing frequency calibration overshoot or instability caused by a rapid increase in noise, and ensuring the robustness of the system in dynamic environments.
[0082] For example, if the static compensation amount calculated in step S112 is +50Hz, the system determines that the noise change rate is positive and greater than the rate threshold, and the dynamic correction coefficient calculated in step S116 is 0.6. The system performs the correction operation: 50 × 0.6 = 30Hz. At this point, the system determines that the final static compensation amount written to the hardware register is 30Hz, not the original 50Hz.
[0083] For example, if the dynamic drift compensation model determined in step S112 is F(t) = 10t (i.e., the frequency drifts by 10Hz per second), and the system determines that the environmental noise is rapidly deteriorating, the calculated dynamic correction coefficient is 0.5. At this point, the system determines that the corrected dynamic drift compensation model has changed to F'(t) = 5t, meaning the system will reduce the subsequent frequency adjustment rate to 5Hz per second.
[0084] Optional, see reference Figure 2 Steps S11601-S11606 are more specific implementations of step S116 in this scheme; Step S11601: Obtain the preset rate sensitivity coefficient and maximum saturation coefficient; The rate sensitivity coefficient is a scaling constant stored in the system's non-volatile memory, used to represent the weighted influence of the noise change rate on the final correction magnitude. The maximum saturation coefficient is the upper limit boundary value of the dynamic correction coefficient allowed by the system, used to represent the safety threshold to prevent system oscillation or overshoot due to excessive correction magnitude.
[0085] Specifically, this step is the initialization and reading phase of the dynamic correction algorithm, which is typically executed immediately after the system confirms that the noise change rate meets the triggering conditions. The system accesses the configuration register through a memory address index to read the pre-programmed rate sensitivity coefficient and maximum saturation coefficient. Specific engineering implementation details regarding the determination of these two parameters are provided here: Typically, this is determined during the system development phase through a "noise injection and response fitting" experiment. Engineers inject a series of noise signals with different linear slopes (e.g., interference with slopes of 10Hz / s, 20Hz / s, and 50Hz / s) into the system, recording the frequency drift error of the system in the uncorrected state. Subsequently, a linear regression analysis is performed on the "noise slope" and "frequency error" using the least squares method. The slope of this regression equation is extracted and normalized to serve as the rate sensitivity coefficient. For example, if experimental data shows that an increase of 1 unit in the noise slope leads to 100 units of frequency error, then this coefficient is set to 100.0.
[0086] The stability of the system is determined based on closed-loop control analysis. Engineers construct the system's transfer function model, plot Bode plots or root locus plots, and analyze the phase margin of the system under different gains. The critical gain value that causes the system to enter a critical stable state (i.e., begin to produce constant-amplitude oscillations) is identified, and 80% to 90% of this critical value is selected as the safety boundary, which is established as the maximum saturation coefficient. For example, if the system begins to oscillate when the gain reaches 2.0, the maximum saturation coefficient is set between 1.6 and 1.8 to ensure that the system converges under any extreme noise environment. After reading these two parameters, the system loads them into the registers of the arithmetic unit, providing reference data for subsequent multiplication and comparison operations.
[0087] Step S11602: Multiply the noise change rate with the rate sensitivity coefficient to obtain the threshold increment ratio; The threshold increment ratio refers to the intermediate result data of the multiplication operation, which is used to represent the relative correction increment caused by the single physical dimension of the rate of change of the current noise.
[0088] Specifically, this step is executed after successfully acquiring the basic configuration parameters, aiming to map the rate of change at the physical level to a proportional increment at the mathematical level. The system calls the floating-point unit (FPU), taking the noise change rate output in step S115 and the rate sensitivity coefficient read in step S11601 as two operands input to the multiplier. This operation is essentially a dimensional conversion and amplification process, converting a tiny rate value (usually a decimal) into a proportional value that has a significant impact on the control quantity.
[0089] For example, if the current noise change rate is 0.005 (meaning the noise index increases by 0.005 per second), and the preset rate sensitivity coefficient is 100.0 (meaning the system is very sensitive to noise changes), the system performs the calculation 0.005 × 100.0 = 0.5. The resulting 0.5 is the threshold increment ratio.
[0090] For example, if the noise change rate is 0.002 and the rate sensitivity coefficient is 50.0, the system performs the calculation 0.002 × 50.0 = 0.1. The resulting 0.1 is the threshold increment ratio. This value directly reflects the additional correction weight required by the system based on the original requirements due to the current rate of environmental degradation.
[0091] Step S11603: Add the threshold increment ratio to the reference constant 1 to obtain the preliminary correction coefficient; Here, the reference constant 1 refers to a dimensionless unit value representing 100% weight of the original control quantity, used to indicate the basic correction state (i.e., unity gain without amplification or reduction) under the influence of no additional noise trends. The preliminary correction factor refers to the theoretical correction factor without boundary constraint processing, used to indicate the total adjustment gain that should be applied to the compensation quantity under ideal conditions according to the current noise trend.
[0092] Specifically, this step performs a proportional superposition operation to construct an incremental model based on the original value. The system adds the threshold increment ratio calculated in step S11602 to the reference constant 1. Since this scheme aims to address the situation of increasing noise (positive rate), this step generates a coefficient greater than 1 by superimposing the increment on the reference value 1. The physical meaning of this coefficient is: how many times the original compensation force needs to be amplified in order to counteract rapidly rising noise interference.
[0093] For example, if the threshold increment ratio calculated in step S11602 is 0.5, the system performs the operation 0.5 + 1 = 1.5. The initial correction coefficient of 1.5 obtained at this time means that the system believes, through calculation, that the current compensation amount should be amplified to 1.5 times the original value in order to effectively suppress the current noise drift.
[0094] Step S11604: Determine whether the preliminary correction coefficient is greater than the maximum saturation coefficient; Specifically, this step is a critical decision point for the safety limiting logic, located after the theoretical calculations are completed and before the final parameter output. The system comparator receives the preliminary correction coefficient as the comparison number and the maximum saturation coefficient as the comparison number, and performs calculations according to floating-point comparison rules. This judgment process aims to identify whether the current noise change rate is too drastic, causing the calculated correction factor to exceed the system's stable tolerance range.
[0095] Step S11605: If it is not greater than the maximum saturation coefficient, then the preliminary correction coefficient is determined as the dynamic correction coefficient. Specifically, this step corresponds to the "No" branch of the comparison logic, meaning the system is operating in a non-saturated linear adjustment range. When the judgment result of step S11604 indicates that the preliminary correction coefficient has not exceeded the safety threshold, the system determines that the theoretically calculated value is safe and valid. At this time, the system executes a direct assignment instruction, writing the preliminary correction coefficient temporarily stored in the accumulator register to the target storage address of the dynamic correction coefficient unchanged.
[0096] Step S11606: If it is greater than the maximum saturation coefficient, then the maximum saturation coefficient is determined as the dynamic correction coefficient. Specifically, this step corresponds to the "yes" branch of the comparison logic, meaning the system has triggered the saturation protection mechanism. When the judgment result of step S11604 indicates that the initial correction coefficient is too large (which may lead to system oscillation, overshoot, or hardware overload), the system refuses to use the higher-risk initial correction coefficient in order to ensure robustness. At this time, the system performs a limiting operation, directly reads the value of the maximum saturation coefficient, and writes it to the target storage address of the dynamic correction coefficient.
[0097] The radio frequency signal calibration device in the embodiments of this invention is described below from the perspective of hardware processing. Please refer to [link / reference needed]. Figure 3 This is a schematic diagram of the physical device structure of a radio frequency signal calibration device in the embodiments of this application.
[0098] It should be noted that, Figure 3 The structure of the radio frequency signal calibration device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0099] like Figure 3 As shown, the radio frequency signal calibration device includes a CPU 301, which can perform various appropriate actions and processes according to a program stored in the read-only memory ROM 302 or a program loaded from the storage section 308 into the random access memory RAM 303, such as performing the methods described in the above embodiments. The RAM 303 also stores various programs and data required for system operation. The CPU 301, ROM 302, and RAM 303 are interconnected via a bus 304. An I / O interface 305 is also connected to the bus 304.
[0100] The following components are connected to I / O interface 305: input section 306 including audio input devices, push-button switches, etc.; output section 307 including a liquid crystal display (LCD) and audio output devices, indicator lights, etc.; storage section 308 including a hard disk, etc.; and communication section 309 including a network interface card such as a LAN (Local Area Network) card, modem, etc. Communication section 309 performs communication processing via a network such as the Internet. Drive 310 is also connected to I / O interface 305 as needed. Removable media 311, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 310 as needed so that computer programs read from them can be installed into storage section 308 as needed.
[0101] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing computer programs for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 309, and / or installed from removable medium 311. When the computer program is executed by CPU 301, it performs the various functions defined in the present invention.
[0102] It should be noted that specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0103] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. Each block in a flowchart or block diagram may represent a module, program segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those shown in the drawings.
[0104] Specifically, the radio frequency signal calibration device in this embodiment includes a processor and a memory. The memory stores a computer program, and when the computer program is executed by the processor, it implements the radio frequency signal calibration method provided in the above embodiment.
[0105] In another aspect, the present invention also provides a computer-readable storage medium, which may be included in the radio frequency signal frequency calibration device described in the above embodiments; or it may exist independently and not assembled into the radio frequency signal frequency calibration device. The storage medium carries one or more computer programs that, when executed by a processor of the radio frequency signal frequency calibration device, cause the radio frequency signal frequency calibration device to implement the radio frequency signal frequency calibration method provided in the above embodiments.
[0106] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.
Claims
1. A method for calibrating radio frequency signals, characterized in that, The method includes: The frequency generation circuit controls the output of the radio frequency signal to be calibrated, and the sampling circuit controls the sampling of the radio frequency signal to be calibrated according to the calibration period time window, which includes several consecutive sub-time windows. The theoretical number of pulses within the sub-time window is calculated based on the duration of the sub-time window and the ideal frequency of the radio frequency signal to be calibrated; Obtain the actual number of pulses within each sub-time window, and calculate the difference between the actual number of pulses and the theoretical number of pulses to obtain the deviation pulse count; In chronological order, the number of all the aforementioned deviation pulses is summed to construct a cumulative error sequence; The cumulative error sequence is fitted with a second-order polynomial, and the first-order and second-order coefficients of the fitted curve are extracted. The first-order coefficients represent the static fixed frequency offset of the radio frequency signal, and the second-order coefficients represent the dynamic drift rate of the radio frequency signal as the frequency changes over time. When the absolute value of the first-order coefficient is greater than the first-order coefficient threshold and the absolute value of the second-order coefficient is less than or equal to the second-order coefficient threshold, a static compensation amount is calculated based on the first-order coefficient, and the frequency of the radio frequency signal to be calibrated is corrected according to the static compensation amount. When the absolute value of the second-order coefficient is greater than the second-order coefficient threshold and the absolute value of the first-order coefficient is less than or equal to the first-order coefficient threshold, the dynamic drift compensation amount is calculated based on the second-order coefficient, and the frequency of the radio frequency signal to be calibrated is corrected according to the dynamic drift compensation amount. When the absolute value of the first-order coefficient is greater than the first-order coefficient threshold and the absolute value of the second-order coefficient is greater than the second-order coefficient threshold, the dynamic drift compensation amount and the final static compensation amount are calculated based on the first-order coefficient and the second-order coefficient, and the frequency of the radio frequency signal to be calibrated is corrected according to the dynamic drift compensation amount and the final static compensation amount.
2. The method according to claim 1, characterized in that, When the absolute value of the first-order coefficient is greater than the first-order coefficient threshold and the absolute value of the second-order coefficient is greater than the second-order coefficient threshold, the dynamic drift compensation amount and the final static compensation amount are calculated based on the first-order coefficient and the second-order coefficient, and the frequency of the RF signal to be calibrated is corrected according to the dynamic drift compensation amount and the final static compensation amount, specifically including: When the absolute value of the first-order coefficient is greater than the first-order coefficient threshold and the absolute value of the second-order coefficient is greater than the second-order coefficient threshold, the dynamic drift compensation amount is calculated based on the second-order coefficient. Calculate the frequency change caused by correcting the frequency of the radio frequency signal to be calibrated using the dynamic drift compensation amount; The static compensation amount is calculated based on the first-order coefficients, and the static compensation amount is corrected according to the frequency change value to obtain the final static compensation amount. The frequency of the radio frequency signal to be calibrated is corrected based on the dynamic drift compensation amount and the final static compensation amount.
3. The method according to claim 1, characterized in that, The step of calculating the static compensation amount based on the first-order coefficient and correcting the frequency of the RF signal to be calibrated according to the static compensation amount specifically includes: Obtain the current frequency resolution of the frequency generation circuit, which is determined by the reference clock frequency and the bit width of the phase-locked loop divider. The frequency deviation value of the RF signal to be calibrated is determined based on the first-order coefficient, and the frequency deviation value is divided by the frequency resolution to obtain the quantization adjustment step value. The quantization adjustment step value is used as the static compensation amount to adjust the frequency adjustment parameters of the frequency generation circuit in order to eliminate the static fixed frequency deviation.
4. The method according to claim 1, characterized in that, After the steps of performing second-order polynomial fitting on the cumulative error sequence and extracting the first-order and second-order coefficients of the fitted curve, the method further includes: Calculate the longitudinal distance between each data point in the cumulative error sequence and the corresponding point in the fitted curve to obtain the residual sequence; Calculate the statistical variance of the residual sequence, and determine the statistical variance as the fitting noise index; Determine whether the fitted noise index is less than a preset noise threshold; If the fitted noise index is less than the noise threshold, then the first-order coefficients and the second-order coefficients are determined to be valid; If the fitted noise index is not less than the noise threshold, then the first-order coefficients and the second-order coefficients are invalid, and the calibration cycle time window for the next round of sampling is adjusted.
5. The method according to claim 4, characterized in that, The adjustment of the calibration cycle time window for the next round of sampling specifically includes: Keeping the frequency adjustment parameters of the frequency generation circuit unchanged, the output is the same radio frequency signal to be calibrated as in the previous round of sampling; Increase the calibration cycle time window of the next round of sampling to a preset duration, and increase the number of sub-time windows of the next round of sampling to a preset number.
6. The method according to claim 4, characterized in that, If the fitted noise index is less than the noise threshold, and the first-order coefficients and the second-order coefficients are determined to be valid, the method further includes: Obtain a preset number of historical fitting noise indices prior to the current sampling, and combine the currently sampled fitting noise index with the historical fitting noise index in chronological order to construct a noise trend monitoring sequence; A first-order linear regression analysis was performed on the noise trend monitoring sequence, and the slope of the regression line was extracted as the noise change rate. A dynamic correction coefficient is calculated based on the noise change rate, and the dynamic correction coefficient is positively correlated with the noise change rate. When the noise change rate is positive and greater than the rate threshold, the dynamic correction coefficient is used to adjust the static compensation amount and the dynamic drift compensation amount.
7. The method according to claim 6, characterized in that, The calculation of the dynamic correction coefficient based on the noise change rate specifically includes: Obtain the preset rate sensitivity coefficient and maximum saturation coefficient; The threshold increment ratio is obtained by multiplying the noise change rate with the rate sensitivity coefficient. The threshold increment ratio is added to the reference constant 1 to obtain the preliminary correction coefficient; Determine whether the preliminary correction coefficient is greater than the maximum saturation coefficient; If it is not greater than the maximum saturation coefficient, then the preliminary correction coefficient is determined as the dynamic correction coefficient; If it is greater than the maximum saturation coefficient, then the maximum saturation coefficient is determined as the dynamic correction coefficient.
8. A radio frequency signal calibration device, characterized in that, The radio frequency signal calibration device includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the radio frequency signal calibration device to perform the method as described in any one of claims 1-7.
9. A computer-readable storage medium comprising instructions, characterized in that, When the instruction is executed on the radio frequency calibration device, the radio frequency calibration device performs the method as described in any one of claims 1-7.
10. A computer program product, characterized in that, When the computer program product is run on the radio frequency calibration device, the radio frequency calibration device performs the method as described in any one of claims 1-7.
