Real-time temperature compensation and adjustment method of on-chip oscillator based on temperature sensor

Through the collaborative work of the temperature sensor and the CPU, the output value of the on-chip oscillator is captured and calculated in real time, and temperature compensation and adjustment are performed, which solves the stability problem of the on-chip oscillator under temperature changes in the existing technology and realizes the stability of the on-chip oscillator under different conditions. Stable output under temperature and simplified trimming process.

CN113934598BActive Publication Date: 2024-10-22HUNAN ADVANCECHIP ELECTRONICS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111217155.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-19
Publication Date
2024-10-22
Estimated Expiration
2041-10-19

AI Technical Summary

Technical Problem

In the existing technology, the on-chip oscillator needs to be manually measured and adjusted when the temperature changes. The process is cumbersome and complicated and is not suitable for application scenarios with large temperature changes.

Method used

Measure the temperature value in real time through the temperature sensor, set the threshold value, use the CPU and computing module to capture and calculate the actual output value of the on-chip oscillator, and perform real-time temperature compensation adjustment, including coarse adjustment and fine adjustment, to ensure that the on-chip oscillator operates at different times. The output is stable under temperature.

Benefits of technology

It achieves stable output of the on-chip oscillator at various temperatures, improves availability and stability, simplifies the trimming process, and reduces costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113934598B_ABST
    Figure CN113934598B_ABST
Patent Text Reader

Abstract

The present invention provides a real-time temperature compensation adjustment method for an on-chip oscillator based on a temperature sensor, comprising: step 1, setting the expected output value of the on-chip oscillator of the chip before the chip leaves the factory and storing it in the memory space of the chip; step 2, capturing the actual output value of the on-chip oscillator of the chip through a capture module of the chip, obtaining the actual output value of the on-chip oscillator and storing it in the memory space of the chip, reading the expected output value of the on-chip oscillator and the actual output value of the on-chip oscillator stored in the memory space by a CPU, and the calculation module of the chip performs pre-factory adjustment on the on-chip oscillator according to the expected output value of the on-chip oscillator and the actual output value of the on-chip oscillator read by the CPU. The present invention enables the on-chip oscillator to obtain stable output at various temperatures, improves the availability and stability of the on-chip oscillator, enables the on-chip oscillator to be better applied to more scenarios, and reduces costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of on-chip oscillator adjustment, and in particular to a real-time temperature compensation adjustment method for an on-chip oscillator based on a temperature sensor. Background Art

[0002] With the rapid development of science and technology, DSP has a wider range of applications in various scenarios. However, under the existing technology, DSP still has some problems. One of the problems with the internal on-chip oscillator is that it will change with the change of temperature. At certain temperatures, it will even exceed the designed range, which will bring great uncertainty during use. However, the internal on-chip oscillator can not only improve the stability of the entire chip compared to the external crystal oscillator, but also reduce the area of ​​PCB to reduce costs in the actual application process. However, due to various reasons such as different processes, the internal on-chip oscillator is not as accurate as the external crystal oscillator. Some DSPs have temperature sensors that can reflect the real-time temperature. For such DSPs, the internal on-chip oscillator can be adjusted in real time at different temperatures through the internal temperature sensor. Summary of the invention

[0003] The present invention provides a real-time temperature compensation and adjustment method for an on-chip oscillator based on a temperature sensor, the purpose of which is to solve the problem that the traditional adjustment method requires manual measurement of the on-chip oscillator output value before adjustment at different temperatures. The adjustment method is cumbersome and complicated and is not suitable for application scenarios with large temperature changes.

[0004] In order to achieve the above object, an embodiment of the present invention provides a real-time temperature compensation and adjustment method for an on-chip oscillator based on a temperature sensor, comprising:

[0005] Step 1: before the chip leaves the factory, the expected output value of the chip's on-chip oscillator is set and stored in the chip's memory space;

[0006] Step 2, capturing the actual output value of the on-chip oscillator of the chip through the capture module of the chip, obtaining the actual output value of the on-chip oscillator and storing it in the memory space of the chip, reading the expected output value of the on-chip oscillator and the actual output value of the on-chip oscillator stored in the memory space through the CPU, and the calculation module of the chip performs pre-delivery adjustment on the on-chip oscillator according to the expected output value of the on-chip oscillator and the actual output value of the on-chip oscillator read by the CPU;

[0007] Step 3, after factory adjustment and when the chip is actually running, set the threshold value for real-time temperature compensation adjustment and store it in the chip's memory space, obtain the linear relationship between the chip's temperature during actual operation and the actual output value of the chip's on-chip oscillator and store it in the chip's memory space, and measure the temperature value of the surrounding environment in real time through the chip's temperature sensor and store it in the chip's memory space;

[0008] Step 4, reading, by the CPU, the temperature value previously measured by the temperature sensor, the temperature value currently measured by the temperature sensor, and the threshold value stored in the memory space;

[0009] Step 5, the calculation module compares the difference between the temperature value previously measured by the temperature sensor and the temperature value currently measured by the temperature sensor read by the CPU with the threshold value;

[0010] Step 6, when the difference between the temperature value previously measured by the temperature sensor and the temperature value currently measured by the temperature sensor is greater than the threshold value, the operation module performs real-time temperature compensation adjustment on the on-chip oscillator;

[0011] Step 7: When the difference between the temperature value previously measured by the temperature sensor and the temperature value currently measured by the temperature sensor is less than the threshold value, the chip operates normally.

[0012] Wherein, the step 2 specifically includes:

[0013] Step 21, capturing the actual output value of the on-chip oscillator of the chip multiple times through the capture module of the chip, and averaging the multiple captured output values ​​to obtain the actual output value of the on-chip oscillator captured finally and store it in the memory space of the chip;

[0014] Step 22, reading the expected output value of the on-chip oscillator and the actual output value of the on-chip oscillator stored in the memory space by the CPU, and calculating the difference between the expected output value of the on-chip oscillator and the actual output value of the on-chip oscillator according to the expected output value of the on-chip oscillator and the actual output value of the on-chip oscillator read by the CPU by the operation module;

[0015] Step 23, determining whether the difference is greater than a set coarse adjustment threshold;

[0016] Step 24, when the difference is greater than the set coarse adjustment threshold value, the CPU reads the coarse adjustment value of the chip's trimming register stored in the memory space, the calculation module changes the coarse adjustment value of the chip's trimming register according to the difference and stores the changed coarse adjustment value of the chip's trimming register in the chip's memory space, and then jumps to step 21;

[0017] Step 25, when the difference is less than the set coarse adjustment threshold value, determine whether the difference is greater than the set fine adjustment threshold value. When the difference is greater than the set fine adjustment threshold value, read the fine adjustment value of the chip's trimming register stored in the memory space through the CPU, and the calculation module changes the fine adjustment value of the chip's trimming register according to the difference and stores the changed fine adjustment value of the chip's trimming register in the chip's memory space, and jump to step 21;

[0018] Step 26: When the difference is less than the set fine-tuning threshold, the factory adjustment of the on-chip oscillator is completed.

[0019] Wherein, the step 24 specifically includes:

[0020] The operation module changes the coarse adjustment value of the chip's trim register according to the difference, and the steps are as follows:

[0021] Step 241, determine whether the difference is positive or negative. When the difference is positive, increase the coarse adjustment value of the chip's trim register by a coarse adjustment count value; when the difference is negative, decrease the coarse adjustment value of the chip's trim register by a coarse adjustment count value.

[0022] Wherein, the step 25 specifically includes:

[0023] The operation module changes the fine adjustment value of the chip's trim register according to the difference, and the steps are as follows:

[0024] Step 251, determine whether the difference is positive or negative. When the difference is positive, increase the fine-tuning value of the chip's trim register by a fine-tuning count value; when the difference is negative, decrease the fine-tuning value of the chip's trim register by a fine-tuning count value.

[0025] Wherein, the step 3 specifically includes:

[0026] Step 31, measure the temperature value of the surrounding environment in real time through the temperature sensor of the chip, filter the currently measured temperature value to obtain a stable temperature value and store it in the memory space of the chip.

[0027] Wherein, the step 6 specifically includes:

[0028] The calculation module performs real-time temperature compensation adjustment on the on-chip oscillator. The steps are as follows:

[0029] Step 61, the CPU reads the linear relationship between the temperature of the chip during actual operation and the actual output value of the chip's on-chip oscillator, the current stable temperature value, and the fine-tuning value of the trimming register after factory adjustment stored in the memory space of the chip, and the operation module calculates a new fine-tuning value of the trimming register according to the linear relationship between the temperature of the chip during actual operation and the actual output value of the chip's on-chip oscillator, the current stable temperature value, and the fine-tuning value of the trimming register after factory adjustment read by the CPU;

[0030] Step 62: The calculation module writes the calculated new fine adjustment value of the trimming register into the trimming register to complete the real-time temperature compensation trimming of the on-chip oscillator.

[0031] The above scheme of the present invention has the following beneficial effects:

[0032] The real-time temperature compensation and adjustment method of the on-chip oscillator based on the temperature sensor described in the above embodiment of the present invention enables the on-chip oscillator to obtain stable output at various temperatures, improves the availability and stability of the on-chip oscillator, enables the on-chip oscillator to be better applied to more scenarios, reduces costs, and simplifies the adjustment method. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 is a flow chart of the present invention;

[0034] Figure 2 is a curve diagram of the correlation between the on-chip oscillator of the present invention and temperature;

[0035] Figure 3 It is a schematic diagram of the output frequency of the on-chip oscillator of the present invention at room temperature;

[0036] Figure 4 It is a schematic diagram of the output frequency of the on-chip oscillator of the present invention after factory adjustment;

[0037] Figure 5 It is a schematic diagram of the output frequency of the on-chip oscillator of the present invention at 50°C;

[0038] Figure 6 It is a schematic diagram of the output frequency of the on-chip oscillator of the present invention after real-time temperature compensation adjustment. DETAILED DESCRIPTION

[0039] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.

[0040] The present invention provides a real-time temperature compensation and adjustment method for an on-chip oscillator based on a temperature sensor, in view of the fact that the existing adjustment method requires manual measurement of the on-chip oscillator output value before adjustment at different temperatures. The adjustment method is cumbersome and complicated and is not suitable for application scenarios with large temperature changes.

[0041] like Figures 1 to 6 As shown, an embodiment of the present invention provides a method for real-time temperature compensation and adjustment of an on-chip oscillator based on a temperature sensor, comprising: step 1, setting an expected output value of the on-chip oscillator of the chip before the chip leaves the factory and storing it in the memory space of the chip; step 2, capturing the actual output value of the on-chip oscillator of the chip through a capture module of the chip, obtaining the actual output value of the on-chip oscillator and storing it in the memory space of the chip, reading the expected output value of the on-chip oscillator and the actual output value of the on-chip oscillator stored in the memory space by a CPU, and performing pre-factory adjustment on the on-chip oscillator according to the expected output value of the on-chip oscillator and the actual output value of the on-chip oscillator read by the CPU; step 3, after the pre-factory adjustment and when the chip is actually running, setting a threshold value for real-time temperature compensation and adjustment and storing it in the memory space of the chip, obtaining the temperature of the chip during actual operation and the actual output value of the on-chip oscillator of the chip The linear relationship between the actual output value and the actual output value is stored in the memory space of the chip, and the temperature value of the surrounding environment is measured in real time by the temperature sensor of the chip and stored in the memory space of the chip; Step 4, the temperature value measured by the temperature sensor before, the temperature value currently measured by the temperature sensor and the threshold value stored in the memory space are read by the CPU; Step 5, the operation module compares the difference between the temperature value measured by the temperature sensor before and the temperature value currently measured by the temperature sensor read by the CPU with the threshold value; Step 6, when the difference between the temperature value measured by the temperature sensor before and the temperature value currently measured by the temperature sensor is greater than the threshold value, the operation module performs real-time temperature compensation adjustment on the on-chip oscillator; Step 7, when the difference between the temperature value measured by the temperature sensor before and the temperature value currently measured by the temperature sensor is less than the threshold value, the chip operates normally.

[0042] Wherein, the step 2 specifically includes: step 21, capturing the actual output value of the on-chip oscillator of the chip multiple times through the capture module of the chip, and averaging the multiple captured output values ​​to obtain the actual output value of the on-chip oscillator finally captured and store it in the memory space of the chip; step 22, reading the expected output value of the on-chip oscillator and the actual output value of the on-chip oscillator stored in the memory space through the CPU, and the operation module calculates the difference between the expected output value of the on-chip oscillator and the actual output value of the on-chip oscillator according to the expected output value of the on-chip oscillator and the actual output value of the on-chip oscillator read by the CPU; step 23, judging whether the difference is greater than the set coarse adjustment threshold value; step 24, when the difference is greater than the set coarse adjustment threshold value, reading the expected output value of the on-chip oscillator stored in the memory space through the CPU The coarse adjustment value of the chip's trim register is stored in the memory space, the operation module changes the coarse adjustment value of the chip's trim register according to the difference and stores the changed coarse adjustment value of the chip's trim register in the chip's memory space, and jumps to step 21; step 25, when the difference is less than the set coarse adjustment threshold value, determine whether the difference is greater than the set fine adjustment threshold value, when the difference is greater than the set fine adjustment threshold value, read the fine adjustment value of the chip's trim register stored in the memory space through the CPU, the operation module changes the fine adjustment value of the chip's trim register according to the difference and stores the changed fine adjustment value of the chip's trim register in the chip's memory space, and jumps to step 21; step 26, when the difference is less than the set fine adjustment threshold value, complete the factory trimming of the on-chip oscillator.

[0043] In the real-time temperature compensation and adjustment method for an on-chip oscillator based on a temperature sensor described in the above-mentioned embodiment of the present invention, the capture module will perform multiple captures, and then average the results of the multiple captures to obtain the actual output value of the on-chip oscillator that is finally captured. The calculation module calculates the difference between the actual output value of the on-chip oscillator and the expected output value of the on-chip oscillator of the chip set before leaving the factory. The difference can be positive or negative. Whether the difference is greater than the set coarse adjustment threshold value determines whether to perform coarse adjustment or fine adjustment. During coarse adjustment, the coarse adjustment of the current coarse adjustment value of a trimming register is increased or decreased according to the positive or negative difference. Count value, until the difference between the actual output value of the on-chip oscillator and the expected output value of the on-chip oscillator of the chip before leaving the factory is less than the coarse adjustment threshold value. When the difference is less than the coarse adjustment threshold, determine whether the difference is greater than the set fine adjustment threshold value. When the difference is greater than the set fine adjustment threshold value, determine whether to increase or decrease the fine adjustment count value of the current coarse adjustment value of a trimming register according to the positive or negative value of the difference, until the difference between the actual output value of the on-chip oscillator and the expected output value of the on-chip oscillator of the chip before leaving the factory is less than the fine adjustment threshold value, thereby completing the pre-factory trimming of the on-chip oscillator.

[0044] In the on-chip oscillator real-time temperature compensation trimming method based on a temperature sensor described in the above embodiment of the present invention, the trimming register of the on-chip oscillator is INTOSCnTRIM, wherein bits 0 to 7 of the trimming register are coarse adjustment values, and bits 9 to 14 are fine adjustment values.

[0045] Among them, the step 24 specifically includes: the calculation module changes the coarse adjustment value of the chip's trim register according to the difference, the steps are as follows: step 241, judge the positive or negative of the difference, when the difference is positive, increase the coarse adjustment value of the chip's trim register by a coarse adjustment count value; when the difference is negative, reduce the coarse adjustment value of the chip's trim register by a coarse adjustment count value.

[0046] Among them, the step 25 specifically includes: the calculation module changes the fine-tuning value of the chip's trim register according to the difference, the steps are as follows: Step 251, judge the positive or negative of the difference, when the difference is positive, increase the fine-tuning value of the chip's trim register by a fine-tuning count value; when the difference is negative, reduce the fine-tuning value of the chip's trim register by a fine-tuning count value.

[0047] Wherein, the step 3 specifically includes: step 31, measuring the temperature value of the surrounding environment in real time through the temperature sensor of the chip, filtering the currently measured temperature value to obtain a stable temperature value and storing it in the memory space of the chip.

[0048] Among them, the step 6 specifically includes: the operation module performs real-time temperature compensation and adjustment of the on-chip oscillator, the steps are as follows: step 61, the CPU reads the linear relationship between the temperature of the chip during actual operation and the actual output value of the on-chip oscillator of the chip, the current stable temperature value and the fine-tuning value of the adjustment register after factory adjustment stored in the memory space of the chip, and the operation module calculates the fine-tuning value of the new adjustment register according to the linear relationship between the temperature of the chip during actual operation and the actual output value of the on-chip oscillator of the chip, the current stable temperature value and the fine-tuning value of the adjustment register after factory adjustment read by the CPU; step 62, the operation module writes the calculated new fine-tuning value of the adjustment register into the adjustment register to complete the real-time temperature compensation and adjustment of the on-chip oscillator.

[0049] The real-time temperature compensation and adjustment method of the on-chip oscillator based on the temperature sensor described in the above embodiment of the present invention obtains the current temperature value of the chip through the temperature sensor of the chip, filters the obtained current temperature value to obtain a stable temperature value and stores it in the memory space. The temperature sensor provides a stable temperature value and will not cause erroneous adjustment of the on-chip oscillator. The fine-tuning value suitable for the current temperature is calculated based on the current stable temperature value, the fine-tuning value of the adjustment register after factory adjustment, and the linear relationship between the temperature of the chip and the output value of the on-chip oscillator of the chip during actual operation. The chip has its own temperature sensor and does not require external devices to adjust the on-chip oscillator when in use.

[0050] In the above-mentioned embodiment of the present invention, the real-time temperature compensation and adjustment method of the on-chip oscillator based on the temperature sensor is described. The real-time temperature compensation and adjustment is only a linear transformation based on the current adjustment value to obtain an adjustment value that is more suitable for the current temperature. The real-time temperature compensation and adjustment can be determined according to the temperature change. For example, if the chip is always running in a room temperature environment, temperature adjustment may not be required; if the frequency of the ambient temperature change of the chip is relatively slow, the temperature adjustment frequency may be correspondingly slowed down; if the ambient temperature of the chip rarely changes, the trigger condition of the real-time temperature compensation and adjustment can be changed to run after the temperature changes by a certain value; the real-time temperature compensation and adjustment can be flexibly adjusted according to the usage scenario. When the influence of the temperature on the output value of the on-chip oscillator does not exceed the coarse adjustment threshold value, only fine adjustment is required. After the fine adjustment value is calculated, it is written into the adjustment register to complete the real-time temperature compensation and adjustment.

[0051] The real-time temperature compensation and adjustment method of the on-chip oscillator based on the temperature sensor described in the above embodiment of the present invention includes adjusting the on-chip oscillator before the chip leaves the factory and performing real-time temperature compensation and adjustment on the on-chip oscillator according to the temperature change during the actual operation of the chip. The on-chip oscillator adjustment before leaving the factory is implemented as follows: the capture module is responsible for capturing a square wave of known frequency to obtain an actual value of the current chip frequency; the operation module compares the actual value with the set expected value in the capture module. When the actual value differs greatly from the expected value and the adjustment step length needs to be longer, coarse adjustment is performed by changing the coarse adjustment value of the adjustment register; when the actual value differs less from the expected value and the adjustment step length needs to be shorter, fine adjustment is performed by changing the fine adjustment value of the adjustment register. This process is repeated many times to finally obtain an ideal coarse adjustment value and fine adjustment value, which are written into the adjustment register and stored in the memory space ; The main reason why the on-chip oscillator needs to be adjusted based on temperature when the chip is actually running is that the on-chip oscillator will produce deviations according to temperature changes. After testing, it was found that the deviation value is linearly related to the temperature. The linear relationship between the temperature of the chip during actual operation and the output value of the on-chip oscillator of the chip is stored in the memory space, and the on-chip oscillator is adjusted for real-time temperature compensation according to the temperature change: the real-time temperature is obtained through the temperature sensor and stored in the memory space; the real-time temperature stored in the memory space, the linear relationship between the temperature of the chip during actual operation and the output value of the on-chip oscillator of the chip, and the fine-tuning value of the trimming register after factory adjustment are read by the CPU. The calculation module calculates the fine-tuning value of the new trimming register according to the real-time temperature read by the CPU, the linear relationship between the temperature of the chip during actual operation and the output value of the on-chip oscillator of the chip, and the fine-tuning value of the trimming register after factory adjustment, and writes it into the trimming register to complete the real-time temperature compensation trimming of the on-chip oscillator.

[0052] The real-time temperature compensation and adjustment method of the on-chip oscillator based on the temperature sensor described in the above embodiment of the present invention takes the ADP32F035 chip as an example. The ADP32F035 has two on-chip oscillators and a temperature sensor. Taking the first on-chip oscillator as an example, the ideal output of the first on-chip oscillator is set to 10MHz, and the actual output of the first on-chip oscillator measured at room temperature is 9.923MHz. Figure 3 After the first on-chip oscillator is trimmed before shipment, the actual output of the first on-chip oscillator is measured to be 10MHz. Figure 4 At a temperature of 50°C, the actual output of the first on-chip oscillator is measured to be 9.957MHz. Figure 5, and the actual output of the first on-chip oscillator measured at room temperature is 9.923MHz, indicating that the output of the on-chip oscillator changes with the change of temperature. In actual application scenarios, the ideal output value of the on-chip oscillator should be 10MHz. Therefore, the first on-chip oscillator at a temperature of 50℃ is adjusted for real-time temperature compensation. After the real-time temperature compensation adjustment, the output of the first on-chip oscillator is measured to be 10.01MHz. Figure 6 The real-time temperature compensation and adjustment method of the on-chip oscillator based on the temperature sensor enables the on-chip oscillator to obtain stable output at various temperatures, thereby improving the stability of the entire system in practical applications. At the same time, the availability of the on-chip oscillator is improved, so that the on-chip oscillator can be better applied to more scenarios. In practical applications, the use of the on-chip oscillator can save PCB area to a certain extent, thereby reducing costs. Moreover, the on-chip oscillator improves the stability of the chip when used compared to the external crystal.

[0053] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A real-time temperature compensation and adjustment method for an on-chip oscillator based on a temperature sensor, characterized in that: include: Step 1: before the chip leaves the factory, the expected output value of the chip's on-chip oscillator is set and stored in the chip's memory space; Step 2, capturing the actual output value of the on-chip oscillator of the chip through the capture module of the chip, obtaining the actual output value of the on-chip oscillator and storing it in the memory space of the chip, reading the expected output value of the on-chip oscillator and the actual output value of the on-chip oscillator stored in the memory space through the CPU, and the calculation module of the chip performs pre-delivery adjustment on the on-chip oscillator according to the expected output value of the on-chip oscillator and the actual output value of the on-chip oscillator read by the CPU; The step 2 specifically includes: Step 21, capturing the actual output value of the on-chip oscillator of the chip multiple times through the capture module of the chip, and averaging the multiple captured output values ​​to obtain the actual output value of the on-chip oscillator captured finally and store it in the memory space of the chip; Step 22, reading the expected output value of the on-chip oscillator and the actual output value of the on-chip oscillator stored in the memory space by the CPU, and calculating the difference between the expected output value of the on-chip oscillator and the actual output value of the on-chip oscillator according to the expected output value of the on-chip oscillator and the actual output value of the on-chip oscillator read by the CPU by the operation module; Step 23, determining whether the difference is greater than a set coarse adjustment threshold; Step 24, when the difference is greater than the set coarse adjustment threshold value, the CPU reads the coarse adjustment value of the chip's trimming register stored in the memory space, the calculation module changes the coarse adjustment value of the chip's trimming register according to the difference and stores the changed coarse adjustment value of the chip's trimming register in the chip's memory space, and then jumps to step 21; Step 25, when the difference is less than the set coarse adjustment threshold value, determine whether the difference is greater than the set fine adjustment threshold value. When the difference is greater than the set fine adjustment threshold value, read the fine adjustment value of the chip's trimming register stored in the memory space through the CPU, and the calculation module changes the fine adjustment value of the chip's trimming register according to the difference and stores the changed fine adjustment value of the chip's trimming register in the chip's memory space, and jump to step 21; Step 26, when the difference is less than the set fine adjustment threshold value, the factory adjustment of the on-chip oscillator is completed; Step 3, after factory adjustment and when the chip is actually running, set the threshold value for real-time temperature compensation adjustment and store it in the chip's memory space, obtain the linear relationship between the chip's temperature during actual operation and the actual output value of the chip's on-chip oscillator and store it in the chip's memory space, and measure the temperature value of the surrounding environment in real time through the chip's temperature sensor and store it in the chip's memory space; Step 4, reading, by the CPU, the temperature value previously measured by the temperature sensor, the temperature value currently measured by the temperature sensor, and the threshold value stored in the memory space; Step 5, the calculation module compares the difference between the temperature value previously measured by the temperature sensor and the temperature value currently measured by the temperature sensor read by the CPU with the threshold value; Step 6, when the difference between the temperature value previously measured by the temperature sensor and the temperature value currently measured by the temperature sensor is greater than the threshold value, the operation module performs real-time temperature compensation adjustment on the on-chip oscillator; Step 7: When the difference between the temperature value previously measured by the temperature sensor and the temperature value currently measured by the temperature sensor is less than the threshold value, the chip operates normally.

2. The method for real-time temperature compensation and adjustment of an on-chip oscillator based on a temperature sensor according to claim 1, characterized in that: The step 24 specifically includes: The operation module changes the coarse adjustment value of the chip's trim register according to the difference, and the steps are as follows: Step 241, determine whether the difference is positive or negative. When the difference is positive, increase the coarse adjustment value of the chip's trim register by a coarse adjustment count value; when the difference is negative, decrease the coarse adjustment value of the chip's trim register by a coarse adjustment count value.

3. The method for real-time temperature compensation and adjustment of an on-chip oscillator based on a temperature sensor according to claim 2, characterized in that: The step 25 specifically includes: The operation module changes the fine adjustment value of the chip's trim register according to the difference, and the steps are as follows: Step 251, determine whether the difference is positive or negative. When the difference is positive, increase the fine-tuning value of the chip's trim register by a fine-tuning count value; when the difference is negative, decrease the fine-tuning value of the chip's trim register by a fine-tuning count value.

4. The method for real-time temperature compensation and adjustment of an on-chip oscillator based on a temperature sensor according to claim 3, characterized in that: The step 3 specifically includes: Step 31, measure the temperature value of the surrounding environment in real time through the temperature sensor of the chip, filter the currently measured temperature value to obtain a stable temperature value and store it in the memory space of the chip.

5. The method for real-time temperature compensation and adjustment of an on-chip oscillator based on a temperature sensor according to claim 4, characterized in that: The step 6 specifically includes: The calculation module performs real-time temperature compensation adjustment on the on-chip oscillator. The steps are as follows: Step 61, the CPU reads the linear relationship between the temperature of the chip during actual operation and the actual output value of the chip's on-chip oscillator, the current stable temperature value, and the fine-tuning value of the trimming register after factory adjustment stored in the memory space of the chip, and the operation module calculates a new fine-tuning value of the trimming register according to the linear relationship between the temperature of the chip during actual operation and the actual output value of the chip's on-chip oscillator, the current stable temperature value, and the fine-tuning value of the trimming register after factory adjustment read by the CPU; Step 62: The calculation module writes the calculated new fine adjustment value of the trimming register into the trimming register to complete the real-time temperature compensation trimming of the on-chip oscillator.