CN116501131B - Method for determining frequency deviation, method for compensating real-time clock and system thereof - Google Patents

Method for determining frequency deviation, method for compensating real-time clock and system thereof Download PDF

Info

Publication number
CN116501131B
CN116501131B CN202310762998.8A CN202310762998A CN116501131B CN 116501131 B CN116501131 B CN 116501131B CN 202310762998 A CN202310762998 A CN 202310762998A CN 116501131 B CN116501131 B CN 116501131B
Authority
CN
China
Prior art keywords
determining
interpolation
temperature sampling
sampling points
frequency deviation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310762998.8A
Other languages
Chinese (zh)
Other versions
CN116501131A (en
Inventor
边孝成
李德建
冯曦
杨立新
谭浪
沈冲飞
杨小坤
刘畅
李胜芳
黎金旺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Smartchip Microelectronics Technology Co Ltd
Original Assignee
Beijing Smartchip Microelectronics Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Smartchip Microelectronics Technology Co Ltd filed Critical Beijing Smartchip Microelectronics Technology Co Ltd
Priority to CN202310762998.8A priority Critical patent/CN116501131B/en
Publication of CN116501131A publication Critical patent/CN116501131A/en
Application granted granted Critical
Publication of CN116501131B publication Critical patent/CN116501131B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/04Generating or distributing clock signals or signals derived directly therefrom
    • G06F1/14Time supervision arrangements, e.g. real time clock

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Oscillators With Electromechanical Resonators (AREA)
  • Electric Clocks (AREA)

Abstract

The application relates to the technical field of chips and discloses a method for determining frequency deviation, a method for compensating a real-time clock and a system thereof. The determining method comprises the following steps: determining corresponding coefficients of preset interpolation according to a plurality of temperature sampling points of a crystal oscillator of a chip, a plurality of frequency deviations under the temperature sampling points and a target interpolation order, wherein the number of the temperature sampling points is related to the target interpolation order and the preset interpolation; determining the subentry data of the preset interpolation according to the real-time temperature of the crystal oscillator of the chip and the plurality of temperature sampling points; and determining the frequency deviation of the crystal oscillator of the chip along with the temperature change according to the corresponding coefficient and the subentry data of the preset interpolation. According to the method, the order of the preset interpolation can be flexibly set according to the precision requirements of different application scenes of the chip on the real-time clock, so that the calculation is greatly optimized, the calculation efficiency and speed are improved, and the power consumption and the area of the chip are saved.

Description

Method for determining frequency deviation, method for compensating real-time clock and system thereof
Technical Field
The application relates to the technical field of chips, in particular to a method for determining frequency deviation, a method for compensating a real-time clock and a system thereof.
Background
With the development of national economy and the progress of digital signal processing and chip design and manufacturing technologies, a main control chip or an electric energy metering chip with a real-time clock is widely used.
The Real-time Clock (RTC) is a core component of a main control chip or a high-precision metering chip. The basic function of the real-time clock is to provide time information such as time, minute, second, calendar and the like, timing, alarming and the like for the system. The system is powered by a standby battery after power failure, and the real-time clock can continue to keep the normal and accurate operation of the on-chip clock. To perform accurate timing functions, a stable clock source is necessary for generating accurate real-time timing unit "seconds" pulses. In chip applications with RTC functionality, the use of external crystals and resonant circuits to generate a clock source or the use of active crystals and the use of integrated crystals inside the chip are several common ways. The crystal oscillator is an active crystal oscillator or a passive crystal oscillator, and the crystal oscillator is an external crystal oscillator or an internal crystal oscillator, which has the characteristic of frequency change along with temperature change, and the frequency change has strong nonlinear characteristic. In order to realize the function of outputting accurate second pulse, a corresponding effective compensation method needs to be designed to accurately compensate the crystal oscillator output frequency.
The compensation function of the real-time clock is used as a necessary function of a main control chip or a metering chip, and the research on the compensation method of the high-precision real-time clock has great practical significance. In the prior art, the real-time clock can be compensated by adopting an analog compensation mode and a digital compensation mode, wherein the analog compensation is composed of a temperature compensation network and a voltage control crystal oscillator, the compensation network needs a large number of high-precision thermistors, so that the chip area is large, the power consumption is high, and in addition, the high-precision frequency compensation cannot be realized due to the nonlinearity of a resistor process. The digital mode adopts a lookup table mode, a larger memory is needed in the mode, the chip area is increased, and in addition, the temperature frequency characteristic of the crystal is difficult to approach due to the lookup table, so that the method has lower precision. The existing technical proposal can not effectively compensate the frequency characteristic of the crystal oscillator which changes along with the change of temperature.
Disclosure of Invention
The application aims to provide a frequency deviation determining method, a real-time clock compensating method and a system thereof, which can flexibly set the order of preset interpolation according to the precision requirements of different application scenes of a chip on the real-time clock, greatly optimize calculation, improve the calculation efficiency and speed and save the power consumption and the area of the chip.
In order to achieve the above object, an aspect of the present application provides a method for determining a frequency deviation, the method comprising: determining corresponding coefficients of preset interpolation according to a plurality of temperature sampling points of a crystal oscillator of a chip, a plurality of frequency deviations under the temperature sampling points and a target interpolation order, wherein the number of the temperature sampling points is related to the target interpolation order and the preset interpolation; determining the subentry data of the preset interpolation according to the real-time temperature of the crystal oscillator of the chip and the plurality of temperature sampling points; and determining the frequency deviation of the crystal oscillator of the chip along with the temperature change according to the corresponding coefficient and the subentry data of the preset interpolation.
Preferably, in the case that the preset interpolation is newton interpolation, the number of the plurality of temperature sampling points is equal to the target interpolation order plus 1, and accordingly, the determining the corresponding coefficient of the preset interpolation includes: determining each step difference quotient of the Newton interpolation according to the plurality of temperature sampling points, the plurality of frequency deviations and the target interpolation order; and determining the corresponding coefficient of the Newton interpolation according to the difference quotient of each step of the Newton interpolation.
Preferably, the determining the preset interpolated sub-term data includes: according to the real-time temperature of the chiptThe plurality of temperature sampling pointsT 0T 1 、……、T n-1 Determining the subentry data of the Newton interpolation:
wherein n is the target interpolation order.
Preferably, said determining the respective step difference quotient value of said newton interpolation comprises: according to temperatureSampling pointT 0 Corresponding frequency deviationDetermining a zero-order difference quotient of the Newton interpolation; based on the plurality of temperature sampling pointsT 0T 1 、……、T n And the frequency deviation corresponding thereto +.>、/>、……/>Determining a first order difference quotient of the Newton interpolation; and according to the plurality of temperature sampling pointsT 0T 1 、……、T n And determining an i+1 order difference quotient of the Newton interpolation, wherein i is more than or equal to 1 and less than or equal to n, i is an integer, and n is the target interpolation order.
Preferably, the sampling points are sampled according to temperatureT 0 Corresponding frequency deviationDetermining a zero-order difference quotient of the newton interpolation:
based on the plurality of temperature sampling pointsT 0T 1 、……、T n Frequency deviation corresponding thereto、……/>Determining the NewtonFirst order difference quotient value of interpolation:
based on the plurality of temperature sampling pointsT 0T 1 、……、T n And determining a second order difference quotient of the Newton interpolation based on the first order difference quotient of the Newton interpolation:
based on the plurality of temperature sampling pointsT 0T 1 、……、T n And determining a third-order difference quotient of the Newton interpolation by using the second-order difference quotient of the Newton interpolation:
according to the temperature sampling pointT 0T n And determining the n-1 order difference quotient of the Newton interpolation:
preferably, said determining the corresponding coefficients of said newton interpolation comprises: will beDetermining the corresponding coefficient of the Newton interpolation, and correspondingly, determining the frequency deviation of the crystal oscillator of the chip along with the change of temperature comprises the following steps: corresponding coefficients according to said Newton interpolation>And item data->Determining the frequency deviation of the crystal oscillator of the chip along with the temperature change:
preferably, in the case where the preset interpolation is a hermite interpolation, the number of the plurality of temperature sampling points is equal to 1/2 of the subtraction result of the target interpolation order minus 1, and the determining the corresponding coefficient of the preset interpolation includes: determining an approximation function and a derivative of the approximation function according to the plurality of temperature sampling points, the plurality of frequency deviations and the target interpolation order; determining a corresponding first coefficient of the hermite interpolation according to the approximation function; and determining a corresponding second coefficient of the hermite interpolation from the derivative of the approximation function.
Preferably, the determining the approximation function includes: according to the temperature sampling pointFrequency deviation +.>Target interpolation order 2 #n+1) +1, determining the approximation function:
wherein,the method comprises the steps of carrying out a first treatment on the surface of the The determining the respective first coefficients of the hermite interpolation includes: will->Determining a respective first coefficient that is the hermite interpolation; and said determining a respective second coefficient of said hermite interpolation comprises: will->A corresponding second coefficient is determined for the hermite interpolation.
Preferably, the determining the preset interpolated sub-term data includes: according to the real-time temperature of the chiptTemperature sampling pointDetermining a difference function->And a derivative of the difference function; according to the temperature sampling pointSaid difference function->And the derivative of the difference function +.>Determining the first sub-term data of said hermite interpolation +.>The method comprises the steps of carrying out a first treatment on the surface of the Based on real-time temperature of the chiptSaid temperature sampling point->Said difference function->Determining second polynomial data of said hermite interpolation +.>
Preferably, the determining the frequency deviation of the crystal oscillator of the chip along with the change of temperature includes: corresponding first coefficients of the hermite interpolationCorresponding second coefficient->First item data->Second item data +.>Determining the frequency deviation of the crystal oscillator of the chip along with the temperature change:
through the technical scheme, the method and the device for determining the preset interpolation corresponding coefficient creatively determine the preset interpolation corresponding coefficient according to the plurality of temperature sampling points of the crystal oscillator of the chip, the plurality of frequency deviations under the plurality of temperature sampling points and the target interpolation order; then, determining the subentry data of the preset interpolation according to the real-time temperature of the crystal oscillator of the chip and the temperature sampling points; finally, according to the corresponding coefficient and the subentry data of the preset interpolation, the frequency deviation of the crystal oscillator of the chip along with the temperature change is determined, so that the application can flexibly set the order of the preset interpolation according to the precision requirement of different application scenes of the chip on the real-time clock, greatly optimize the calculation, improve the calculation efficiency and speed and save the power consumption and area of the chip.
A second aspect of the present application provides a method for compensating a real-time clock, the method comprising: according to the method for determining the frequency deviation, determining the frequency deviation of the crystal oscillator of the chip along with the temperature change; and compensating the real-time clock according to the frequency deviation.
Through the technical scheme, the method for determining the frequency deviation creatively determines the frequency deviation of the crystal oscillator of the chip along with the temperature change according to the method for determining the frequency deviation; and then, compensating the real-time clock according to the frequency deviation, thereby greatly compensating the deviation value of the crystal oscillator frequency caused by the change of the ambient temperature, improving the output precision of the second pulse and greatly improving the precision and the accuracy of the real-time clock compensation of a chip (such as a main control chip or an electric energy metering chip).
A third aspect of the present application provides a system for determining a frequency deviation, the system comprising: coefficient determining means for determining a corresponding coefficient of a preset interpolation according to a plurality of temperature sampling points, a plurality of frequency deviations at the plurality of temperature sampling points, and a target interpolation order, wherein the number of the plurality of temperature sampling points is associated with the target interpolation order and the preset interpolation; the subentry determining device is used for determining subentry data of the preset interpolation according to the real-time temperature of the chip and the plurality of temperature sampling points; and the frequency deviation determining device is used for determining the frequency deviation of the crystal oscillator of the chip along with the temperature change according to the corresponding coefficient and the subentry data of the preset interpolation.
Preferably, in the case where the preset interpolation is newton interpolation, the number of the plurality of temperature sampling points is equal to the target interpolation order plus 1, and accordingly, the coefficient determining means includes: the difference quotient determining module is used for determining each step difference quotient value of the Newton interpolation according to the plurality of temperature sampling points, the plurality of frequency deviations and the target interpolation order; and the first coefficient determining module is used for determining the corresponding coefficient of the Newton interpolation according to the difference quotient value of each order of the Newton interpolation.
Preferably, in the case where the preset interpolation is a hermite interpolation, the number of the plurality of temperature sampling points is equal to 1/2 of the subtraction result of the target interpolation order minus 1, and the coefficient determination means includes: the function determining module is used for determining an approximation function and a derivative of the approximation function according to the plurality of temperature sampling points, the plurality of frequency deviations and the target interpolation order; the second coefficient determining module is used for determining a corresponding first coefficient of the Hermite interpolation according to the approximation function; and a third coefficient determining module for determining a corresponding second coefficient of the hermite interpolation based on the derivative of the approximation function.
Specific details and benefits of the frequency deviation determining system provided in the embodiments of the present application can be found in the above description of the determining method applicable to frequency deviation, and are not repeated here.
A fourth aspect of the present application provides a compensation system for a real-time clock, the compensation system comprising: the system is used for determining the frequency deviation of the crystal oscillator of the chip along with the temperature change according to the frequency deviation determination system; and the compensation device is used for compensating the real-time clock according to the frequency deviation.
Specific details and benefits of the real-time clock compensation system provided by the embodiments of the present application can be found in the above description of the compensation method applicable to the real-time clock, and are not repeated here.
A fifth aspect of the present application provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of determining a frequency deviation and/or the method of compensating for a real-time clock.
A sixth aspect of the application provides a chip for executing a computer program which, when executed by the chip, implements the method of determining the frequency deviation and/or the method of compensating the real time clock.
Additional features and advantages of the application will be set forth in the detailed description which follows.
Drawings
The accompanying drawings are included to provide a further understanding of embodiments of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain, without limitation, the embodiments of the application. In the drawings:
FIG. 1 is a flow chart of a method for determining frequency deviation according to an embodiment of the present application;
FIG. 2 is a flow chart of a method for high precision real time clock RTC compensation provided by an embodiment of the present application; and
fig. 3 is a flowchart of a method for compensating for the RTC of the high-precision real-time clock according to an embodiment of the present application.
Detailed Description
The following describes specific embodiments of the present application in detail with reference to the drawings. It should be understood that the detailed description and specific examples, while indicating and illustrating the application, are not intended to limit the application.
Fig. 1 is a flowchart of a method for determining a frequency deviation according to an embodiment of the present application. As shown in fig. 1, the determining method may include: step S101, determining corresponding coefficients of preset interpolation according to a plurality of temperature sampling points of a crystal oscillator of a chip, a plurality of frequency deviations under the temperature sampling points and a target interpolation order, wherein the number of the temperature sampling points is related to the target interpolation order and the preset interpolation; step S102, determining the subentry data of the preset interpolation according to the real-time temperature of the crystal oscillator of the chip and the plurality of temperature sampling points; and step S103, determining the frequency deviation of the crystal oscillator of the chip along with the temperature change according to the corresponding coefficient and the subentry data of the preset interpolation.
The preset interpolation may be newton interpolation, hermite interpolation, or other interpolation.
In an embodiment, in a case where the preset interpolation is newton interpolation, the number of the plurality of temperature sampling points is equal to the target interpolation order plus 1.
Wherein the coverage of the plurality of temperature sampling points occupies a preset proportion of the ambient temperature range, wherein the preset proportion is greater than a preset threshold (e.g., 0.6, 0.7, 0.8, or 0.9, etc.).
Specifically, the order of newton interpolation (i.e., the target interpolation order) is determined according to the accuracy requirement of the chip application scene. Assuming that the environment temperature range of the crystal oscillator of the chip is-40-85 ℃, 5-order Newton interpolation is needed to meet the design accuracy requirement. If the target interpolation order n is 5, the number of the plurality of temperature sampling points is 6. For example, the plurality of temperature sampling points are respectively arranged in the order of gradually increasing temperatureT 0T 1T 2T 3T 4T 5 WhereinT 0 -T 5 Is 80% of the ambient temperature range.
According to the embodiment, the Newton interpolation characteristic is flexibly utilized, the Newton interpolation order is flexibly set according to the accuracy requirements of different application scenes of the chip on the real-time clock, the calculation is greatly optimized, the calculation efficiency and speed are improved, and the power consumption and the area of the chip are saved.
The intervals of the plurality of temperature sampling points can be fixed intervals or non-fixed intervals (namely, the intervals of the sampling points can be arbitrarily valued, and the mode does not need to limit the intervals of the sampling points, so that the application is wider).
Specifically, the determining the corresponding coefficient of the preset interpolation includes: determining each step difference quotient of the Newton interpolation according to the plurality of temperature sampling points, the plurality of frequency deviations and the target interpolation order; and determining the corresponding coefficient of the Newton interpolation according to the difference quotient of each step of the Newton interpolation.
The frequency deviation of the crystal oscillator of the chip under the plurality of temperature sampling points can be obtained in a measuring mode, for example, the frequency deviation of the same temperature sampling point can be measured for a plurality of times, and then the average frequency deviation of the same temperature sampling point can be obtained in an averaging mode.
Wherein said determining the difference-of-steps quotient of the newton interpolation comprises: according to the temperature sampling pointT 0 Corresponding frequency deviationDetermining a zero-order difference quotient of the Newton interpolation; based on the plurality of temperature sampling pointsT 0T 1 、……、T n And the frequency deviation corresponding thereto +.>、/>、……/>Determining a first order difference quotient of the Newton interpolation; and according to the plurality of temperature sampling pointsT 0T 1 、……、T n The saidAnd determining an i-order difference quotient of Newton interpolation, wherein i is more than or equal to 1 and less than or equal to n, i is an integer, and n is the target interpolation order.
More specifically, according to the temperature sampling pointT 0 Corresponding frequency deviationDetermining a zero-order difference quotient of the newton interpolation: />
Based on the plurality of temperature sampling pointsT 0T 1 、……、T n Frequency deviation corresponding thereto、……/>Determining a first order difference quotient of the newton interpolation:
based on the plurality of temperature sampling pointsT 0T 1 、……、T n And determining a second order difference quotient of the Newton interpolation based on the first order difference quotient of the Newton interpolation:
based on the plurality of temperature sampling pointsT 0T 1 、……、T n And determining a third-order difference quotient of the Newton interpolation by using the second-order difference quotient of the Newton interpolation:
similarly, fourth order or higher order difference quotient values for the Newton interpolation may be determined.
According to the temperature sampling pointT 0T n And determining the n-1 order difference quotient of the Newton interpolation:
when n=5, the 5 th order difference quotient of the newton interpolation:
specifically, the determining the preset interpolated sub-term data includes: according to the real-time temperature of the chiptThe plurality of temperature sampling pointsT 0T 1 、……、T n-1 Determining the subentry data of the Newton interpolation:
wherein n is the target interpolation order.
In a specific example, a temperature sampling analog-to-digital converter (ADC) may be utilized to collect a real-time temperature t of the environment in which the chip is located (i.e., a real-time temperature of a crystal oscillator of the chip). When n=5, the number of the n-type groups,
specifically, the determining the corresponding coefficients of the newton interpolation includes: will beAnd determining the corresponding coefficient of the Newton interpolation.
Correspondingly, the determining the frequency deviation of the crystal oscillator of the chip along with the temperature change comprises the following steps: corresponding coefficients based on the Newton interpolationAnd item data->Determining the frequency deviation of the crystal oscillator of the chip along with the temperature change:
when n=5, the number of the n-type groups,
in another embodiment, in the case where the preset interpolation is hermite interpolation, the number of the plurality of temperature sampling points is equal to 1/2 of the subtraction result of the target interpolation order minus 1.
Wherein the coverage of the plurality of temperature sampling points occupies a preset proportion of the ambient temperature range, wherein the preset proportion is greater than a preset threshold (e.g., 0.6, 0.7, 0.8, or 0.9, etc.).
Specifically, the order of the hermite interpolation (i.e., the target interpolation order) is determined according to the accuracy requirement of the chip application scene. Assuming that the environmental temperature range of the crystal oscillator of the chip is-40-85 ℃, the design accuracy requirement can be met by 7-order Hermite interpolation. If the target interpolation order s=2 #n+1) +1 is 7, the number of the plurality of temperature sampling points is [ (s=7) -1]2=3. For example, the plurality of temperature sampling points are respectively arranged in the order of gradually increasing temperatureT 0T 1T 2 WhereinT 0 -T 3 Is 80% of the ambient temperature range.
According to the embodiment, the characteristic of the Hermite interpolation is flexibly utilized, the order of the Hermite interpolation is flexibly set according to the precision requirements of different application scenes of the chip on the real-time clock, the calculation is greatly optimized, the calculation efficiency and speed are improved, and the power consumption and area of the chip are saved.
The intervals of the plurality of temperature sampling points may be fixed intervals or non-fixed intervals (that is, may take any value).
Specifically, the determining the corresponding coefficient of the preset interpolation includes: determining an approximation function and a derivative of the approximation function according to the plurality of temperature sampling points, the plurality of frequency deviations and the target interpolation order; determining a corresponding first coefficient of the hermite interpolation according to the approximation function; and determining a corresponding second coefficient of the hermite interpolation from the derivative of the approximation function.
Wherein said determining an approximation function comprises: according to the temperature sampling pointFrequency deviation +.>Target interpolation order s=2 #n+1) +1, determining the approximation function:
wherein,
when s=2%nWhen +1) +1=7,
wherein said determining the respective first coefficients of the hermite interpolation comprises: will beA corresponding first coefficient is determined for the hermite interpolation.
Wherein said determining the respective second coefficients of the hermite interpolation comprises: will beA corresponding second coefficient is determined for the hermite interpolation.
Specifically, the determining the preset interpolated sub-term data includes: according to the real-time temperature of the chiptTemperature sampling pointDetermining a difference function->And the derivative of the difference function, wherein +.>The method comprises the steps of carrying out a first treatment on the surface of the Sampling points according to the temperature>Said difference function->And the derivative of the difference function +.>Determining the first sub-term data of said hermite interpolation +.>The method comprises the steps of carrying out a first treatment on the surface of the Based on real-time temperature of the chiptSaid temperature sampling point->Said difference function->Determining second polynomial data of said hermite interpolation +.>
Specifically, the determining the frequency deviation of the crystal oscillator of the chip along with the temperature change comprises the following steps: corresponding first coefficients of the hermite interpolationCorresponding second coefficient->First item data->Second item data +.>Determining the frequency deviation of the crystal oscillator of the chip along with the temperature change:
for example, when s=2 #nWhen +1) +1=7,
compared with Newton interpolation, the method has the advantages that the frequency deviation of the crystal oscillator of the chip along with the temperature change is determined by utilizing the Hermite interpolation, the same-order interpolation result can be realized by adopting fewer temperature sampling points, that is, the frequency deviation of the crystal oscillator of the chip along with the temperature change is determined by utilizing the Hermite interpolation, so that more effective compensation of a real-time clock can be realized.
In summary, the application creatively determines the corresponding coefficient of the preset interpolation according to the plurality of temperature sampling points of the crystal oscillator of the chip, the plurality of frequency deviations under the plurality of temperature sampling points and the target interpolation order; then, determining the subentry data of the preset interpolation according to the real-time temperature of the crystal oscillator of the chip and the temperature sampling points; finally, according to the corresponding coefficient and the subentry data of the preset interpolation, the frequency deviation of the crystal oscillator of the chip along with the temperature change is determined, so that the application can flexibly set the order of the preset interpolation according to the precision requirement of different application scenes of the chip on the real-time clock, greatly optimize the calculation, improve the calculation efficiency and speed and save the power consumption and area of the chip.
An embodiment of the present application provides a method for compensating a real-time clock, including: according to the method for determining the frequency deviation, determining the frequency deviation of the crystal oscillator of the chip along with the temperature change; and compensating the real-time clock according to the frequency deviation.
Specifically, after the frequency deviation of the crystal oscillator with the temperature change is determined by the above-described frequency deviation determining method, the frequency deviation of the crystal oscillator with the temperature change is determined to a frequency error, and then the real-time clock is compensated according to the frequency error to output accurate second pulses.
According to the embodiment, the deviation of the real-time clock can be compensated by adopting the preset interpolation (such as Newton interpolation or Hermite interpolation), the deviation value of the crystal oscillator frequency caused by the change of the ambient temperature can be greatly compensated by the preset interpolation (such as Newton interpolation or Hermite interpolation), and the output precision of second pulse is improved, so that the precision and the accuracy of the real-time clock compensation of a chip (such as a main control chip or an electric energy metering chip) are greatly improved.
Fig. 2 is a diagram of a method for compensating a high-precision real-time clock RTC of a chip (e.g., a main control chip or an electric energy measurement chip) according to an embodiment of the application, which includes the following steps.
Step 201, setting Newton interpolation order according to the accuracy requirement of the application scene.
Step 202, determining the number of a plurality of temperature points according to the Newton interpolation order, and measuring the crystal oscillator frequency deviation values of the plurality of temperature points.
And 203, calculating corresponding coefficients of Newton interpolation in real time according to the set Newton interpolation order, the temperature points and the corresponding frequency deviation values.
In step 204, the ambient temperature is acquired using a temperature sampling ADC.
And 205, calculating the subentry data of Newton interpolation in real time according to the set Newton interpolation order, the temperature point and the ambient temperature of the current crystal oscillator.
At step 206, newton's interpolation polynomials are synthesized and the frequency deviation as a function of chip temperature is calculated in real time.
Step 207, compensating the frequency error generated by the crystal oscillator according to the frequency deviation.
Step 208, outputting the compensated accurate second pulse.
Fig. 3 is a diagram of a method for compensating a high-precision real-time clock RTC of a chip (e.g., a main control chip or an electric energy measurement chip) according to an embodiment of the application, which includes the following steps.
Step 301, setting the hermite interpolation order according to the accuracy requirement of the application scene.
Step 302, determining the number of a plurality of temperature points according to the Hermite interpolation order, and measuring the crystal oscillator frequency deviation values of the plurality of temperature points.
Step 303, calculating a frequency deviation approximation function according to the set Hermite interpolation order, the temperature point and the frequency deviation corresponding to the temperature point.
Step 304, a derivative operation is performed on the frequency deviation approximation function.
Step 305, synthesizing the hermite interpolation polynomial and calculating the frequency deviation as a function of the chip temperature in real time.
The hermite interpolation polynomial is the frequency deviation that varies with chip temperature:
step 306, compensating the frequency error generated by the crystal oscillator according to the frequency deviation.
Step 307, outputting the compensated accurate second pulse.
In the two embodiments described above, it is proposed for the first time to compensate the real-time clock of a chip (e.g., a main control chip or an electric energy meter chip) with high accuracy using newton/hermite interpolation.
In summary, the application creatively determines the frequency deviation of the crystal oscillator of the chip along with the temperature change according to the method for determining the frequency deviation; and then, compensating the real-time clock according to the frequency deviation, thereby greatly compensating the deviation value of the crystal oscillator frequency caused by the change of the ambient temperature, improving the output precision of the second pulse and greatly improving the precision and the accuracy of the real-time clock compensation of a chip (such as a main control chip or an electric energy metering chip).
An embodiment of the present application provides a system for determining a frequency deviation, including: the coefficient determining device is used for determining corresponding coefficients of preset interpolation according to a plurality of temperature sampling points of the crystal oscillator of the chip, a plurality of frequency deviations under the temperature sampling points and a target interpolation order, wherein the number of the temperature sampling points is related to the target interpolation order and the preset interpolation; the subentry determining device is used for determining subentry data of the preset interpolation according to the real-time temperature of the crystal oscillator of the chip and the plurality of temperature sampling points; and the frequency deviation determining device is used for determining the frequency deviation of the crystal oscillator of the chip along with the temperature change according to the corresponding coefficient and the subentry data of the preset interpolation.
Preferably, in the case where the preset interpolation is newton interpolation, the number of the plurality of temperature sampling points is equal to the target interpolation order plus 1, and accordingly, the coefficient determining means includes: the difference quotient determining module is used for determining each step difference quotient value of the Newton interpolation according to the plurality of temperature sampling points, the plurality of frequency deviations and the target interpolation order; and the first coefficient determining module is used for determining the corresponding coefficient of the Newton interpolation according to the difference quotient value of each order of the Newton interpolation.
Preferably, in the case where the preset interpolation is a hermite interpolation, the number of the plurality of temperature sampling points is equal to 1/2 of the subtraction result of the target interpolation order minus 1, and the coefficient determination means includes: the function determining module is used for determining an approximation function and a derivative of the approximation function according to the plurality of temperature sampling points, the plurality of frequency deviations and the target interpolation order; the second coefficient determining module is used for determining a corresponding first coefficient of the Hermite interpolation according to the approximation function; and a third coefficient determining module for determining a corresponding second coefficient of the hermite interpolation based on the derivative of the approximation function.
Specific details and benefits of the frequency deviation determining system provided in the embodiments of the present application can be found in the above description of the determining method applicable to frequency deviation, and are not repeated here.
An embodiment of the present application provides a compensation system for a real-time clock, the compensation system including: the system is used for determining the frequency deviation of the crystal oscillator of the chip along with the temperature change according to the frequency deviation determination system; and the compensation device is used for compensating the real-time clock according to the frequency deviation.
Specific details and benefits of the real-time clock compensation system provided by the embodiments of the present application can be found in the above description of the compensation method applicable to the real-time clock, and are not repeated here.
An embodiment of the present application provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method for determining a frequency deviation and/or the method for compensating a real-time clock.
An embodiment of the present application provides a chip for executing a computer program, where the computer program when executed by the chip implements the method for determining a frequency deviation and/or the method for compensating a real-time clock.
The chip can be a main control chip or an electric energy metering chip.
Specifically, the present embodiment provides a chip including: a processor; a memory for storing a computer program for execution by the processor; the processor is configured to read the computer program from the memory and execute the computer program to implement the method for determining a frequency deviation.
The preferred embodiments of the present application have been described in detail above with reference to the accompanying drawings, but the present application is not limited to the specific details of the above embodiments, and various simple modifications can be made to the technical solution of the present application within the scope of the technical concept of the present application, and all the simple modifications belong to the protection scope of the present application.
In addition, the specific features described in the above embodiments may be combined in any suitable manner, and in order to avoid unnecessary repetition, various possible combinations are not described further.
Those skilled in the art will appreciate that all or part of the steps in implementing the methods of the embodiments described above may be implemented by a program stored in a storage medium, including instructions for causing a single-chip microcomputer, chip or processor (processor) to perform all or part of the steps of the methods of the embodiments described herein. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Moreover, any combination of the various embodiments of the application can be made without departing from the spirit of the application, which should also be considered as disclosed herein.

Claims (12)

1. A method for determining a frequency deviation, the method comprising:
determining corresponding coefficients of preset interpolation according to a plurality of temperature sampling points of a crystal oscillator of a chip, a plurality of frequency deviations under the temperature sampling points and a target interpolation order, wherein the number of the temperature sampling points is related to the target interpolation order and the preset interpolation;
determining the subentry data of the preset interpolation according to the real-time temperature of the crystal oscillator of the chip and the plurality of temperature sampling points; and
determining the frequency deviation of the crystal oscillator of the chip along with the temperature change according to the corresponding coefficient of the preset interpolation and the subentry data,
in the case where the preset interpolation is newton interpolation, the number of the plurality of temperature sampling points is equal to the target interpolation order plus 1,
accordingly, the determining the corresponding coefficient of the preset interpolation includes:
determining each step difference quotient of the Newton interpolation according to the plurality of temperature sampling points, the plurality of frequency deviations and the target interpolation order; and
determining the corresponding coefficient of the Newton interpolation according to the difference quotient value of each step of the Newton interpolation,
wherein said determining the difference-of-steps quotient of the newton interpolation comprises:
according to the temperature sampling pointT 0 Corresponding frequency deviationDetermining a zero-order difference quotient of the newton interpolation:
based on the plurality of temperature sampling pointsT 0T 1 、……、T n Frequency deviation corresponding thereto、/>、……/>Determining a first order difference quotient of the newton interpolation:
based on the plurality of temperature sampling pointsT 0T 1 、……、T n A first order difference quotient of the Newton interpolationA value, a second order difference quotient of the newton interpolation is determined:
based on the plurality of temperature sampling pointsT 0T 1 、……、T n And determining a third-order difference quotient of the Newton interpolation by using the second-order difference quotient of the Newton interpolation:
the method comprises the steps of carrying out a first treatment on the surface of the And
according to the temperature sampling pointT 0T n And determining the n-1 order difference quotient of the Newton interpolation:
wherein said determining the corresponding coefficients of the newton interpolation comprises: will beAnd determining the corresponding coefficient of the Newton interpolation.
2. The method according to claim 1, wherein the determining the preset interpolated sub-term data includes:
according to the real-time temperature of the chiptThe plurality of temperature sampling pointsT 0T 1 、……、T n-1 Determining the subentry data of the Newton interpolation:
wherein n is the target interpolation order.
3. The method according to claim 2, wherein determining the frequency deviation of the crystal oscillator of the chip with temperature change comprises:
corresponding coefficients based on the Newton interpolationAnd item data->Determining the frequency deviation of the crystal oscillator of the chip along with the temperature change:
4. a method for determining a frequency deviation, the method comprising:
determining corresponding coefficients of preset interpolation according to a plurality of temperature sampling points of a crystal oscillator of a chip, a plurality of frequency deviations under the temperature sampling points and a target interpolation order, wherein the number of the temperature sampling points is related to the target interpolation order and the preset interpolation;
determining the subentry data of the preset interpolation according to the real-time temperature of the crystal oscillator of the chip and the plurality of temperature sampling points; and
determining the frequency deviation of the crystal oscillator of the chip along with the temperature change according to the corresponding coefficient of the preset interpolation and the subentry data,
in the case where the preset interpolation is a hermite interpolation, the number of the plurality of temperature sampling points is equal to 1/2 of the subtraction result of the target interpolation order minus 1,
accordingly, the determining the corresponding coefficient of the preset interpolation includes:
determining an approximation function and a derivative of the approximation function according to a plurality of temperature sampling points, the plurality of frequency deviations and the target interpolation order;
determining a corresponding first coefficient of the hermite interpolation according to the approximation function; and
and determining a corresponding second coefficient of the Hermite interpolation according to the derivative of the approximation function.
Wherein said determining an approximation function comprises:
according to the temperature sampling pointFrequency deviation +.>Target interpolation order 2 #n+1) +1, determining the approximation function:
wherein,
the determining the respective first coefficients of the hermite interpolation includes: will beDetermining a respective first coefficient that is the hermite interpolation; and
the determining the respective second coefficients of the hermite interpolation includes: will beA corresponding second coefficient is determined for the hermite interpolation.
5. The method according to claim 4, wherein determining the preset interpolated sub-term data includes:
according to the real-time temperature of the chiptTemperature sampling pointDetermining a difference function->And a derivative of the difference function;
according to the temperature sampling pointSaid difference function->And the derivative of the difference function +.>Determining the first sub-term data of said hermite interpolation +.>The method comprises the steps of carrying out a first treatment on the surface of the And
according to the real-time temperature of the chiptSaid temperature sampling pointSaid difference function->Determining second polynomial data of said hermite interpolation +.>
6. The method according to claim 5, wherein determining the frequency deviation of the crystal oscillator of the chip with temperature change comprises:
corresponding first coefficients of the hermite interpolationCorresponding second coefficient->First sub-item dataSecond item data +.>Determining the frequency deviation of the crystal oscillator of the chip along with the temperature change:
7. a method of compensating a real-time clock, the method comprising:
the method for determining a frequency deviation according to any one of claims 1 to 6, wherein the frequency deviation of the crystal oscillator of the chip with temperature change is determined; and
and compensating the real-time clock according to the frequency deviation.
8. A system for determining a frequency deviation, the system comprising:
the coefficient determining device is used for determining corresponding coefficients of preset interpolation according to a plurality of temperature sampling points of the crystal oscillator of the chip, a plurality of frequency deviations under the temperature sampling points and a target interpolation order, wherein the number of the temperature sampling points is related to the target interpolation order and the preset interpolation;
the subentry determining device is used for determining subentry data of the preset interpolation according to the real-time temperature of the crystal oscillator of the chip and the plurality of temperature sampling points; and
a frequency deviation determining device, configured to determine a frequency deviation of the crystal oscillator of the chip along with a temperature change according to the corresponding coefficient and the subentry data of the preset interpolation,
in the case where the preset interpolation is newton interpolation, the number of the plurality of temperature sampling points is equal to the target interpolation order plus 1,
accordingly, the coefficient determination means includes:
the difference quotient determining module is used for determining each step difference quotient value of the Newton interpolation according to the plurality of temperature sampling points, the plurality of frequency deviations and the target interpolation order; and
a first coefficient determining module, configured to determine a corresponding coefficient of the newton interpolation according to the difference quotient of each order of the newton interpolation,
wherein said determining the difference-of-steps quotient of the newton interpolation comprises:
according to the temperature sampling pointT 0 Corresponding frequency deviationDetermining a zero-order difference quotient of the newton interpolation:
based on the plurality of temperature sampling pointsT 0T 1 、……、T n Frequency deviation corresponding thereto、/>、……/>Determining a first order difference quotient of the newton interpolation:
based on the plurality of temperature sampling pointsT 0T 1 、……、T n And determining a second order difference quotient of the Newton interpolation based on the first order difference quotient of the Newton interpolation:
based on the plurality of temperature sampling pointsT 0T 1 、……、T n And determining a third-order difference quotient of the Newton interpolation by using the second-order difference quotient of the Newton interpolation:
the method comprises the steps of carrying out a first treatment on the surface of the And
according to the temperature sampling pointT 0T n And determining the n-1 order difference quotient of the Newton interpolation:
wherein said determining the corresponding coefficients of the newton interpolation comprises: will beAnd determining the corresponding coefficient of the Newton interpolation.
9. A system for determining a frequency deviation, the system comprising:
the coefficient determining device is used for determining corresponding coefficients of preset interpolation according to a plurality of temperature sampling points of the crystal oscillator of the chip, a plurality of frequency deviations under the temperature sampling points and a target interpolation order, wherein the number of the temperature sampling points is related to the target interpolation order and the preset interpolation;
the subentry determining device is used for determining subentry data of the preset interpolation according to the real-time temperature of the crystal oscillator of the chip and the plurality of temperature sampling points; and
a frequency deviation determining device, configured to determine a frequency deviation of the crystal oscillator of the chip along with a temperature change according to the corresponding coefficient and the subentry data of the preset interpolation,
in the case where the preset interpolation is a hermite interpolation, the number of the plurality of temperature sampling points is equal to 1/2 of the subtraction result of the target interpolation order minus 1,
accordingly, the coefficient determination means includes:
the function determining module is used for determining an approximation function and a derivative of the approximation function according to the plurality of temperature sampling points, the plurality of frequency deviations and the target interpolation order;
the second coefficient determining module is used for determining a corresponding first coefficient of the Hermite interpolation according to the approximation function; and
a third coefficient determination module for determining a corresponding second coefficient of the hermite interpolation based on the derivative of the approximation function,
wherein said determining an approximation function comprises:
according to the temperature sampling pointFrequency deviation +.>Target interpolation order 2 #n+1) +1, determining the approximation function:
wherein,
the determining the respective first coefficients of the hermite interpolation includes: will beDetermining a respective first coefficient that is the hermite interpolation; and
said determining a corresponding second series of said hermite interpolationThe number includes: will beA corresponding second coefficient is determined for the hermite interpolation.
10. A compensation system for a real-time clock, the compensation system comprising:
the frequency deviation determining system according to claim 8 or 9, configured to determine a frequency deviation of a crystal oscillator of a chip with a change in temperature; and
and the compensation device is used for compensating the real-time clock according to the frequency deviation.
11. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements the method of determining a frequency deviation according to any of claims 1-6 and/or the method of compensating a real time clock according to claim 7.
12. A chip for executing a computer program which, when executed by the chip, implements the method of determining a frequency deviation according to any one of claims 1-6 and/or the method of compensating for a real time clock according to claim 7.
CN202310762998.8A 2023-06-27 2023-06-27 Method for determining frequency deviation, method for compensating real-time clock and system thereof Active CN116501131B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310762998.8A CN116501131B (en) 2023-06-27 2023-06-27 Method for determining frequency deviation, method for compensating real-time clock and system thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310762998.8A CN116501131B (en) 2023-06-27 2023-06-27 Method for determining frequency deviation, method for compensating real-time clock and system thereof

Publications (2)

Publication Number Publication Date
CN116501131A CN116501131A (en) 2023-07-28
CN116501131B true CN116501131B (en) 2023-12-05

Family

ID=87328716

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310762998.8A Active CN116501131B (en) 2023-06-27 2023-06-27 Method for determining frequency deviation, method for compensating real-time clock and system thereof

Country Status (1)

Country Link
CN (1) CN116501131B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103090954A (en) * 2011-10-28 2013-05-08 台衡精密测控(昆山)股份有限公司 Nonlinear calibration method based on electronic weighing instrument
CN108449791A (en) * 2018-03-19 2018-08-24 重庆邮电大学 A kind of auto-adaptive time synchronous method based on temperature-compensating
CN109921760A (en) * 2019-03-05 2019-06-21 广东合微集成电路技术有限公司 The temperature-compensation method and device of MEMS resonator, MEMS oscillator
CN112731790A (en) * 2020-12-07 2021-04-30 江阴长仪集团有限公司 Method for improving RTC (real time clock) calibration precision based on time domain segmented interpolation compensation
CN113985340A (en) * 2021-10-11 2022-01-28 北京智芯微电子科技有限公司 Electric energy metering chip and phase compensation method and phase compensation device thereof
CN115508618A (en) * 2022-10-13 2022-12-23 四川大学 Quasi-synchronous harmonic analysis device and method based on time domain Hermite interpolation

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107465393B (en) * 2017-07-05 2020-12-01 广州昂宝电子有限公司 System and method for frequency compensation of real time clock system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103090954A (en) * 2011-10-28 2013-05-08 台衡精密测控(昆山)股份有限公司 Nonlinear calibration method based on electronic weighing instrument
CN108449791A (en) * 2018-03-19 2018-08-24 重庆邮电大学 A kind of auto-adaptive time synchronous method based on temperature-compensating
CN109921760A (en) * 2019-03-05 2019-06-21 广东合微集成电路技术有限公司 The temperature-compensation method and device of MEMS resonator, MEMS oscillator
CN112731790A (en) * 2020-12-07 2021-04-30 江阴长仪集团有限公司 Method for improving RTC (real time clock) calibration precision based on time domain segmented interpolation compensation
CN113985340A (en) * 2021-10-11 2022-01-28 北京智芯微电子科技有限公司 Electric energy metering chip and phase compensation method and phase compensation device thereof
CN115508618A (en) * 2022-10-13 2022-12-23 四川大学 Quasi-synchronous harmonic analysis device and method based on time domain Hermite interpolation

Also Published As

Publication number Publication date
CN116501131A (en) 2023-07-28

Similar Documents

Publication Publication Date Title
Ngo A new approach for the design of wideband digital integrator and differentiator
EP1847003B1 (en) Current sensing analog to digital converter and method of use
CN104300987B (en) Method for Δ ∑ ADC integrated circuit and generation digital controlled signal
TW201250213A (en) Temperature sensing system for supporting single-point calibration
CN104052477A (en) System, method and recording medium for analog to digital converter calibration
US10788376B2 (en) Apparatus for sensing temperature in electronic circuitry and associated methods
WO2016039858A1 (en) Low power small area oscillator-based adc
JP2011044920A (en) A/d converting device
JP5000441B2 (en) Power measuring method and power measuring apparatus
CN115979324A (en) Nonlinear calibration method and device for magnetic encoder
CN101210847A (en) Portable temperature measuring equipment with soft turn-off function
CN116106605A (en) Electric energy meter parameter compensation method, medium and system considering temperature change
CN116501131B (en) Method for determining frequency deviation, method for compensating real-time clock and system thereof
Hanta et al. Rational approximation of time delay
CN103715984A (en) Received signal strength indicator temperature compensation method and device
JP4340467B2 (en) Rotation angle sensor
CN106970328B (en) SOC estimation method and device
JP6793770B2 (en) Temperature-based reference gain correction for analog-to-digital converters
US11035902B2 (en) Advanced fuel gauge
CN115904000A (en) Real-time clock crystal oscillator compensation method and system based on orthogonal least square method curve fitting
JP4054652B2 (en) Storage battery internal impedance measurement method and storage battery internal impedance measurement device
CN112731790B (en) Method for improving RTC (real time clock) calibration precision based on time domain segmented interpolation compensation
CN111399581B (en) High-precision temperature sensor with related double sampling functions
CN109408910B (en) Equivalent circuit of floating type fractional order memristor and using method thereof
Baschirotto et al. Frequency references, power management for SoC, and smart wireless interfaces

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant