Search

CN-115800922-B - Method for automatically calibrating the frequency of an internal crystal oscillator, controller chip, household appliance and storage medium

CN115800922BCN 115800922 BCN115800922 BCN 115800922BCN-115800922-B

Abstract

The invention provides a method for automatically calibrating the frequency of an internal crystal oscillator, a controller chip, a household appliance and a storage medium, wherein the method for automatically calibrating the frequency of the internal crystal oscillator comprises the steps of obtaining a mains supply alternating voltage signal; sampling the commercial alternating voltage signal with the current frequency of the internal crystal oscillator to obtain the sampling times in a preset sampling period, obtaining the correction value of the current frequency according to the preset standard times corresponding to the sampling times and the current frequency, and adjusting the current frequency. The method for automatically calibrating the frequency of the internal crystal oscillator can reduce the temperature influence and simultaneously reduce the dependence of chip port resources when using the built-in oscillator of the chip.

Inventors

  • ZHOU WEI
  • LI MING
  • LV LIJUN
  • MAO LONG
  • Qin Hailiao

Assignees

  • 珠海格力电器股份有限公司

Dates

Publication Date
20260508
Application Date
20221110

Claims (9)

  1. 1. A method for automatically calibrating the frequency of an internal crystal oscillator, comprising: acquiring a mains supply alternating voltage signal; sampling the commercial alternating voltage signal with the current frequency of an internal crystal oscillator to obtain sampling times in a preset sampling period; acquiring a correction value of the current frequency according to the sampling times and preset standard times corresponding to the current frequency, and adjusting the current frequency; Wherein the correction value is obtained by the following formula: correction value= (number of samples-preset standard number of times)/number of samples.
  2. 2. The method of automatically calibrating an internal crystal oscillator frequency of claim 1, wherein: The preset sampling period is a quarter period of the mains supply alternating voltage signal; The step of obtaining the sampling times in the preset sampling period comprises the following steps: acquiring voltage values of three continuous sampling points, confirming whether the middle sampling point is an extreme point, if so, starting to accumulate sampling times; And stopping the accumulation of the sampling times and obtaining the sampling times of the current sampling period when the next extreme point is obtained.
  3. 3. The method of automatically calibrating an internal crystal oscillator frequency of claim 1, wherein: The step of obtaining the sampling times in the preset sampling period comprises the following steps: And acquiring sampling times of a plurality of sampling periods, and carrying out average value average processing on the sampling times of the plurality of sampling periods.
  4. 4. A method of automatically calibrating the frequency of an internal crystal oscillator according to any of claims 1 to 3, wherein: after the step of obtaining the sampling times in the preset sampling period, the method further comprises the following steps: and judging whether the sampling times are in a preset interval range, and if not, re-sampling.
  5. 5. A method of automatically calibrating the frequency of an internal crystal oscillator according to any of claims 1 to 3, wherein: Before the step of obtaining the correction value of the current frequency according to the preset standard frequency corresponding to the current frequency, the method further comprises the following steps: And confirming that the deviation value of the current frequency relative to the alternating current frequency of the mains supply is larger than a preset deviation value.
  6. 6. The method of automatically calibrating an internal crystal oscillator frequency of claim 5, wherein: The deviation value is obtained by the following formula: deviation value= (number of samples-preset standard number)/preset standard number.
  7. 7. A controller chip comprising a processor and a memory, wherein the memory stores a computer program which, when executed by the processor, performs the steps of the method of automatically calibrating the frequency of an internal crystal oscillator as claimed in any one of claims 1 to 6.
  8. 8. A household appliance provided with a controller chip, wherein the controller chip is provided with the controller chip as claimed in claim 7.
  9. 9. A computer-readable storage medium, on which a computer program is stored, characterized in that the computer program, when executed by a controller, implements the steps of the method of automatically calibrating the frequency of an internal crystal oscillator as claimed in any of claims 1 to 6.

Description

Method for automatically calibrating the frequency of an internal crystal oscillator, controller chip, household appliance and storage medium Technical Field The invention relates to the technical field of controller chips, in particular to a method for automatically calibrating the frequency of an internal crystal oscillator, a controller chip applying the method for automatically calibrating the frequency of the internal crystal oscillator, a household appliance applying the controller chip and a computer readable storage medium applying the method for automatically calibrating the frequency of the internal crystal oscillator. Background The timer, the PWM time base, the communication signal pulse width and the like of the household appliance controller chip work by taking the internal oscillator time base as a standard, so that the accuracy of the internal oscillator time base determines the accuracy of the running time of the controller. The current internal oscillator circuit of the chip for the household electrical appliance is generally of an RC circuit structure, when the temperature of the working environment of the chip changes, for example, the temperature change range of the running environment of an external air conditioner can reach-30 ℃ to 100 ℃, the temperature drift of the oscillator circuit of the chip can occur, and therefore the precision of the internal oscillator cannot be ensured. Under the local severe working condition, the deviation of the internal oscillator reaches more than 3%, so that the operation time base of the chip is inaccurate, serious problems such as compressor and fan frequency deviation are generated, comfortableness is affected, and internal and external machines cannot normally communicate due to abnormal serial port communication, and accordingly faults are reported. In order to meet the normal technical use requirements, the precision of the internal oscillator is generally required to be about +/-1%. In the prior art, when the deviation of the oscillator arranged in the chip is too large in the normal working environment range of the electric appliance and the precision cannot be ensured, a chip peripheral crystal oscillator circuit or a standard frequency circuit is added to provide a time reference for the chip working. Therefore, the cost of the device is increased, and meanwhile, the area of the PCB is increased and the IO port resource of the chip is occupied. Disclosure of Invention It is a first object of the present invention to provide a method of automatically calibrating the frequency of an internal crystal oscillator that reduces the temperature effects while reducing the chip port resource dependence when using an on-chip oscillator. A second object of the present invention is to provide a controller chip that can reduce the influence of temperature while reducing the dependence of chip port resources when using an on-chip oscillator. A third object of the present invention is to provide a home appliance that can reduce the influence of temperature while reducing the dependence of chip port resources when using a chip built-in oscillator. A fourth object of the present invention is to provide a computer-readable storage medium that can reduce the temperature influence while reducing the chip port resource dependence when using a chip built-in oscillator. In order to achieve the first object, the method for automatically calibrating the frequency of the internal crystal oscillator provided by the invention comprises the steps of obtaining a mains supply alternating current voltage signal, sampling the mains supply alternating current voltage signal with the current frequency of the internal crystal oscillator to obtain sampling times in a preset sampling period, obtaining a correction value of the current frequency according to the sampling times and preset standard times corresponding to the current frequency, and adjusting the current frequency. According to the scheme, the method for automatically calibrating the frequency of the internal crystal oscillator is characterized in that the mains supply alternating voltage signal is obtained as the reference frequency signal, the mains supply alternating voltage signal is sampled at the current frequency of the internal crystal oscillator, so that the correction value of the current frequency is determined, the current frequency is adjusted, the frequency precision of the mains supply alternating voltage signal is higher, the influence of the ambient temperature is smaller, and therefore the temperature influence can be reduced when the chip built-in oscillator is used, meanwhile, the mains supply alternating voltage signal is utilized for detection, no additional detection circuit is needed, and the dependence on chip port resources is reduced. In a further scheme, the preset sampling period is a quarter period of the mains supply alternating voltage signal, and the step of acquiring the sampling time