Method for automatic calibration of an internal crystal oscillator frequency, controller chip, household appliance, storage medium

By using AC voltage signals from the mains to calibrate the frequency of the internal crystal oscillator, the problem of insufficient accuracy of the internal oscillator of household appliances when the temperature changes is solved, thereby improving accuracy and saving resources, and reducing costs and resource consumption.

CN115800922BActive Publication Date: 2026-05-08GREE ELECTRIC APPLIANCE INC OF ZHUHAI
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GREE ELECTRIC APPLIANCE INC OF ZHUHAI
Filing Date
2022-11-10
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

The internal oscillators of household appliances are not accurate enough when the temperature changes, which leads to inaccurate chip operation and serious problems, such as compressor frequency deviation and communication abnormalities. Existing technologies that solve this problem by adding external crystal oscillator circuits increase costs and consume resources.

Method used

By acquiring the AC mains voltage signal as a reference, the frequency of the internal crystal oscillator is sampled. The stability of the AC mains voltage signal is used to calibrate the frequency of the internal crystal oscillator, reducing the influence of temperature. The accuracy is improved by sampling times and averaging, and the frequency is adjusted to reduce the dependence on chip port resources.

Benefits of technology

While reducing the impact of temperature, it also reduces the dependence on chip port resources, improves the frequency accuracy of the internal crystal oscillator, avoids the increase of external circuits, and reduces costs and resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115800922B_ABST
    Figure CN115800922B_ABST
Patent Text Reader

Abstract

The application provides a method for automatically calibrating the frequency of an internal crystal oscillator, a controller chip, a household appliance and a storage medium, and the method comprises the following steps: obtaining a commercial alternating voltage signal; sampling the commercial alternating voltage signal at a current frequency of the internal crystal oscillator to obtain a sampling number within a preset sampling period; and obtaining a correction value of the current frequency according to a preset standard number corresponding to the sampling number and the current frequency, and adjusting the current frequency. The application can reduce the dependence on chip port resources while reducing the temperature influence when using the built-in oscillator of the chip.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of controller chip technology, specifically to a method for automatically calibrating the frequency of an internal crystal oscillator, a controller chip using the method for automatically calibrating the frequency of an internal crystal oscillator, a household appliance using the controller chip, and a computer-readable storage medium using the method for automatically calibrating the frequency of an internal crystal oscillator. Background Technology

[0002] In home appliance controller chips, timers, PWM time bases, and communication signal pulse widths all operate based on an internal oscillator time base. Therefore, the accuracy of the internal oscillator time base determines the accuracy of the controller's running time. However, the internal oscillator circuits in current home appliance chips are generally RC circuits. When the operating environment temperature changes—for example, the operating temperature range of an air conditioner outdoor unit can vary from -30°C to 100°C—the oscillator circuit will experience temperature drift, compromising the accuracy of the internal oscillator. Under harsh local conditions, the internal oscillator deviation can exceed 3%, leading to inaccurate time bases and serious problems such as compressor and fan frequency deviations affecting comfort, and serial communication abnormalities causing the indoor and outdoor units to fail to communicate properly, resulting in fault reports. To meet normal technical requirements, the internal oscillator accuracy is generally required to be around ±1%.

[0003] In existing technology, when the built-in oscillator of a chip deviates too much within the normal operating range of the electrical appliance, making it impossible to guarantee accuracy, an external crystal oscillator circuit or standard frequency circuit is typically added to provide a time reference for the chip's operation. This increases device cost, PCB area, and chip I / O port resources. Summary of the Invention

[0004] The first objective of this invention is to provide a method for automatically calibrating the frequency of an internal crystal oscillator that reduces the impact of temperature and the dependence on chip port resources when using a chip-built-in oscillator.

[0005] A second objective of this invention is to provide a controller chip that can reduce the impact of temperature while reducing reliance on chip port resources when using a chip-built-in oscillator.

[0006] A third objective of this invention is to provide a household appliance that can reduce the impact of temperature and reduce reliance on chip port resources when using a chip-built-in oscillator.

[0007] A fourth objective of this invention is to provide a computer-readable storage medium that reduces the impact of temperature while reducing reliance on chip port resources when using a chip-embedded oscillator.

[0008] To achieve the aforementioned first objective, the method for automatically calibrating the frequency of an internal crystal oscillator provided by the present invention includes: acquiring an AC mains voltage signal; sampling the AC mains voltage signal at the current frequency of the internal crystal oscillator to acquire the number of samplings within a preset sampling period; acquiring a correction value for the current frequency based on the number of samplings and a preset standard number corresponding to the current frequency, and adjusting the current frequency.

[0009] As can be seen from the above scheme, the method for automatically calibrating the internal crystal oscillator frequency of the present invention obtains the AC mains voltage signal as the reference frequency signal, and determines the correction value of the current frequency by sampling the AC mains voltage signal with the current frequency of the internal crystal oscillator, and adjusts the current frequency. The AC mains voltage signal has high frequency accuracy and is less affected by ambient temperature, thereby reducing the temperature influence when using the chip's built-in oscillator. At the same time, using the AC mains voltage signal for detection eliminates the need for additional detection circuits, reducing dependence on chip port resources.

[0010] In a further scheme, the preset sampling period is one-quarter of the AC voltage signal period; the steps to obtain the number of samples within the preset sampling period include: obtaining the voltage values ​​of three consecutive sampling points, confirming whether the middle sampling point is an extreme point, and if so, starting to accumulate the number of samples; when the next extreme point is obtained, stopping the accumulation of the number of samples and obtaining the number of samples in the current sampling period.

[0011] Therefore, when sampling a sampling period, the duration of the sampling period cannot be accurately determined because the current frequency of the internal crystal oscillator may have errors. Since the period of the AC voltage signal is determined by the extreme points, it is possible to determine whether the sampling point is an extreme point by confirming whether the sampling point is an extreme point in the sampled signal. Thus, a sampling period can be determined by two adjacent extreme points.

[0012] In a further scheme, the step of obtaining the number of samples within a preset sampling period includes: obtaining the number of samples for multiple sampling periods, and averaging the number of samples for multiple sampling periods.

[0013] Therefore, in order to avoid detection errors caused by a single sampling detection, obtaining the sampling count of multiple sampling periods and averaging the sampling counts of multiple sampling periods can improve the detection accuracy of the sampling count.

[0014] In a further scheme, after obtaining the number of samples within a preset sampling period, the method further includes: determining whether the number of samples is within a preset range; if not, re-sampling.

[0015] Therefore, since the clock period and deviation range of the internal crystal oscillator are known, in order to improve the accuracy of the sampling number, it is determined whether the sampling number is within the preset range. If it is unreasonable, it is discarded and resampling is performed.

[0016] In a further scheme, before the step of obtaining the correction value of the current frequency based on the number of samplings and the preset standard number corresponding to the current frequency, it also includes: confirming that the deviation value of the current frequency relative to the AC mains frequency is greater than the preset deviation value.

[0017] Therefore, in order to reduce the fluctuations caused by frequent frequency corrections of the internal crystal oscillator, a preset deviation value can be set to determine whether the deviation of the current frequency from the AC mains frequency needs to be corrected.

[0018] In a further scheme, the deviation value is obtained by the following formula: Deviation value = (Number of samplings - Number of preset standard samplings) / Number of preset standard samplings.

[0019] In a further scheme, the correction value is obtained by the following formula: Correction value = (Number of samplings - Preset standard number of samplings) / Number of samplings.

[0020] Therefore, the number of samplings can represent the frequency, and thus, obtaining the deviation and correction values ​​through the number of samplings facilitates calculation.

[0021] To achieve the second objective of the present invention, the present invention provides a controller chip including a processor and a memory, the memory storing a computer program, which, when executed by the processor, implements the steps of the above-described method for automatically calibrating the frequency of an internal crystal oscillator.

[0022] To achieve the third objective of this invention, the household appliance provided by this invention is equipped with a controller chip, which is the controller chip described above.

[0023] To achieve the fourth objective of the present invention, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a controller, implements the steps of the above-described method for automatically calibrating the frequency of an internal crystal oscillator. Attached Figure Description

[0024] Figure 1 This is a flowchart of an embodiment of the method for automatically calibrating the frequency of the internal crystal oscillator according to the present invention.

[0025] Figure 2 This is a circuit diagram for obtaining AC mains voltage signal in an embodiment of the method for automatically calibrating the frequency of the internal crystal oscillator of the present invention.

[0026] Figure 3This is a waveform diagram of the AC mains voltage signal in an embodiment of the method for automatically calibrating the frequency of the internal crystal oscillator of the present invention.

[0027] The present invention will be further described below with reference to the accompanying drawings and embodiments. Detailed Implementation

[0028] Example of a method for automatically calibrating the frequency of an internal crystal oscillator:

[0029] The method for automatically calibrating the internal crystal oscillator frequency of the present invention is an application program used in a controller chip to calibrate the internal crystal oscillator frequency of the controller chip. Preferably, the controller chip is equipped with an internal crystal oscillator.

[0030] like Figure 1 As shown, the automatic calibration method for the internal crystal oscillator frequency of the present invention first executes step S1 to acquire the AC mains voltage signal during operation. According to the regulations of my country's power grid, the power supply frequency is 50Hz, with an allowable limit deviation of ±0.5Hz, corresponding to a deviation percentage of ±1%. Therefore, the frequency of the AC mains voltage output by the power grid is relatively stable, and the influence of ambient temperature is weak. Thus, the AC mains voltage frequency is selected as the reference. In this embodiment, when the internal crystal oscillator frequency needs to be calibrated, the AC mains voltage signal must first be acquired. The AC mains voltage signal can be obtained through a sampling circuit, for example, see [reference needed]. Figure 2 The AC mains power supply S, after being rectified by rectifier bridge 1, is sampled through sampling capacitor C1. The waveform reflected in the voltage change across sampling capacitor C1 is a 100Hz half-wave, with a corresponding half-wave period of 10ms. Figure 3 As shown.

[0031] After acquiring the AC mains voltage signal, step S2 is executed. The AC mains voltage signal is sampled at the current frequency of the internal crystal oscillator to obtain the number of samples within a preset sampling period. In order to calibrate the current frequency of the internal crystal oscillator, the AC mains voltage signal needs to be sampled at the current frequency of the internal crystal oscillator to confirm the accuracy of the current frequency.

[0032] In this embodiment, the preset sampling period is one-quarter of the AC mains voltage signal cycle. The step of obtaining the number of samples within the preset sampling period includes: obtaining the voltage values ​​of three consecutive sampling points, confirming whether the middle sampling point is an extreme point; if so, starting to accumulate the number of samples; when the next extreme point is obtained, stopping the accumulation of the number of samples and obtaining the number of samples in the current sampling period. During sampling, to speed up the sampling rate, the preset sampling period is one-quarter of the AC mains voltage signal cycle. Simultaneously, to confirm whether a sampling period has been completed, extreme points are obtained. When confirming whether the middle sampling point is an extreme point, the voltage values ​​of three consecutive sampling points are compared to confirm whether the voltage value of the middle sampling point is less than or greater than the voltage values ​​of the two adjacent sampling points. If it is less than the voltage values ​​of the two adjacent sampling points, it indicates that the middle sampling point is a minimum value. Figure 3 Point B in the middle; if the voltage value is greater than the voltage values ​​of the two adjacent sampling points, it indicates that the middle sampling point is a maximum value, such as... Figure 3 Point A in the diagram. The AC voltage signal has two extreme points within a quarter cycle. Therefore, a sampling period can be considered complete after obtaining two adjacent extreme points. Upon obtaining the first extreme point, the accumulation of the current sampling period's sampling count begins; upon obtaining the second extreme point, the accumulation ends, thus obtaining the sampling count for the current sampling period.

[0033] To avoid detection errors caused by a single sampling detection, this embodiment further includes the step of obtaining the number of samples within a preset sampling period by: obtaining the number of samples from multiple sampling periods and averaging the number of samples from multiple sampling periods. By averaging the number of samples from multiple sampling periods, the detection accuracy of the number of samples can be improved.

[0034] After obtaining the number of samples within the preset sampling period, step S3 is executed to determine whether the number of samples falls within a preset range. The preset range is pre-set based on experimental data. To further improve the accuracy of the sampling count, it is necessary to determine whether the number of samples falls within the preset range. Since the clock period and deviation range of the internal crystal oscillator are known, a threshold number for the preset range can be pre-set. The number of samples is then compared with this threshold number to determine whether the number of samples falls within the preset range.

[0035] If the number of samples is not within the preset range, return to step S2 to re-acquire the number of samples within the preset sampling period. If the number of samples is not within the preset range, the number of samples is considered unreasonable, discarded, and resampling is performed.

[0036] If the number of samplings is within a preset range, step S4 is executed to determine whether the deviation of the current frequency relative to the AC mains frequency is greater than a preset deviation value. The preset deviation value can be pre-set based on experimental data. To reduce fluctuations caused by frequent frequency corrections of the internal crystal oscillator, the current frequency is only corrected when the deviation is greater than a certain value. In this embodiment, the deviation is obtained using the following formula: Deviation = (Number of samplings - Preset standard number of samplings) / Preset standard number of samplings. For example, a quarter-cycle of the AC mains voltage signal corresponds to a standard period of 5ms. Assuming the current frequency of the chip's internal crystal oscillator is 10MHz, corresponding to a standard period of 100ns, the standard number of samplings should be N = 5,000,000 ÷ 100 = 50,000 times. However, assuming the actual number of samplings is 51,000, this indicates that the internal crystal oscillator frequency is too fast. Using the deviation calculation formula, we can obtain: (51000–50000)÷50000=2%, that is, the deviation of the internal crystal oscillator from the power grid standard is 2%.

[0037] If it is confirmed that the deviation of the current frequency relative to the AC mains frequency is greater than a preset deviation value, then step S5 is executed. The correction value of the current frequency is obtained based on the number of samples and the preset standard number of samples corresponding to the current frequency, and the current frequency is adjusted. Since the deviation of the current frequency relative to the AC mains frequency is greater than the preset deviation value, a corresponding correction is required. In this embodiment, the correction value is obtained using the following formula: Correction value = (Number of samples - Preset standard number of samples) / Number of samples. The correction value is an adjustment made to the clock precision of the internal crystal oscillator. After obtaining the correction value of the current frequency, the value in the register representing the clock precision of the internal crystal oscillator is modified. For example, if the clock precision is 10MHz, the default value of the register is 450. If it is necessary to correct the frequency by 2%, then 450 * 1.02, i.e., 459, is written to this register using a pointer function. After writing the value, the chip's clock is corrected by 2% from its original value in the direction of frequency reduction.

[0038] If it is confirmed that the deviation of the current frequency from the AC mains frequency is less than or equal to the preset deviation value, then step S6 is executed to maintain the current frequency. If the deviation of the current frequency from the AC mains frequency is less than or equal to the preset deviation value, it means that the current frequency meets the requirements and no correction is needed. Therefore, the current frequency of the internal crystal oscillator is maintained.

[0039] As described above, the method for automatically calibrating the internal crystal oscillator frequency of the present invention obtains the AC mains voltage signal as a reference frequency signal, and samples the AC mains voltage signal with the current frequency of the internal crystal oscillator to determine the correction value of the current frequency and adjust the current frequency. The AC mains voltage signal has high frequency accuracy and is less affected by ambient temperature, thereby reducing the temperature influence when using the chip's built-in oscillator. At the same time, using the AC mains voltage signal for detection eliminates the need for additional detection circuitry, reducing dependence on chip port resources.

[0040] Controller chip example:

[0041] The controller chip in this embodiment includes a controller, which executes the steps in the above-described method embodiment for automatically calibrating the frequency of the internal crystal oscillator when executing a computer program.

[0042] For example, a computer program can be divided into one or more modules, one or more of which are stored in memory and executed by a controller to perform the present invention. One or more modules can be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the controller chip.

[0043] The controller chip may include, but is not limited to, controllers and memory. Those skilled in the art will understand that the controller chip may include more or fewer components, or combinations of certain components, or different components; for example, the controller chip may also include input / output devices, network access devices, buses, etc.

[0044] For example, a controller can be a Central Processing Unit (CPU), or other general-purpose controllers, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose controller can be a microcontroller or any conventional controller. The controller is the control center of the controller chip, connecting all parts of the controller chip through various interfaces and lines.

[0045] The memory can be used to store computer programs and / or modules. The controller implements various functions of the controller chip by running or executing the computer programs and / or modules stored in the memory, and by calling the data stored in the memory. For example, the memory may mainly include a program storage area and a data storage area, wherein the program storage area may store the operating system, application programs required for at least one function, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0046] Example of household appliances:

[0047] In this embodiment, the household appliance is equipped with a controller chip, which is the controller chip described above. The household appliance may be an air conditioner, refrigerator, television, microwave oven, electric stove, and fan, etc.

[0048] Examples of computer-readable storage media:

[0049] If the module integrated into the controller chip in the above embodiments is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above-described method embodiments for automatically calibrating the internal crystal oscillator frequency can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by the controller, it can implement the steps of the above-described method embodiments for automatically calibrating the internal crystal oscillator frequency. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The storage medium can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content contained in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0050] It should be noted that the above are only preferred embodiments of the present invention, but the design concept of the invention is not limited thereto. Any non-substantial modifications made to the present invention using this concept also fall within the protection scope of the present invention.

Claims

1. A method for automatically calibrating the frequency of an internal crystal oscillator, characterized in that, include: Acquire AC voltage signal from mains power; The AC mains voltage signal is sampled at the current frequency of the internal crystal oscillator to obtain the number of samples within a preset sampling period; The correction value of the current frequency is obtained based on the number of samplings and the preset standard number corresponding to the current frequency, and the current frequency is adjusted accordingly; The correction value is obtained by the following formula: Correction value = (number of samplings - number of preset standard samplings) / number of samplings.

2. The method for automatically calibrating the frequency of an internal crystal oscillator according to claim 1, characterized in that: The preset sampling period is one-quarter of the AC voltage signal period. The steps to obtain the number of samples within a preset sampling period include: Obtain the voltage values ​​of three consecutive sampling points, confirm whether the middle sampling point is an extreme point, and if so, start accumulating the number of samplings; When the next extreme point is obtained, the accumulation of the sampling count is stopped and the sampling count of the current sampling period is obtained.

3. The method for automatically calibrating the frequency of an internal crystal oscillator according to claim 1, characterized in that: The steps to obtain the number of samples within a preset sampling period include: Obtain the number of samples from multiple sampling periods, and then average the number of samples from multiple sampling periods.

4. The method for automatically calibrating the frequency of an internal crystal oscillator according to any one of claims 1 to 3, characterized in that: After obtaining the number of samples within the preset sampling period, the process also includes: Determine whether the number of samplings is within a preset range; if not, resample.

5. The method for automatically calibrating the frequency of an internal crystal oscillator according to any one of claims 1 to 3, characterized in that: Before the step of obtaining the correction value of the current frequency based on the sampling number and the preset standard number corresponding to the current frequency, the method further includes: It is confirmed that the deviation of the current frequency from the AC mains frequency is greater than the preset deviation value.

6. The method for automatically calibrating the frequency of an internal crystal oscillator according to claim 5, characterized in that: The deviation value is obtained by the following formula: Deviation value = (number of samplings - number of preset standard samplings) / number of preset standard samplings.

7. A controller chip, comprising a processor and a memory, characterized in that: The memory stores a computer program that, when executed by the processor, implements the steps of the method for automatically calibrating the frequency of an internal crystal oscillator as described in any one of claims 1 to 6.

8. A household appliance, equipped with a controller chip, characterized in that: The controller chip described in claim 7 is used.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the controller, it implements the steps of the method for automatically calibrating the frequency of the internal crystal oscillator as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Asynchronous serial communication method and device, controller, storage medium and household appliance

    CN114844588A