CN111162737B - Working method and working system of real-time clock - Google Patents

Working method and working system of real-time clock Download PDF

Info

Publication number
CN111162737B
CN111162737B CN201910822646.0A CN201910822646A CN111162737B CN 111162737 B CN111162737 B CN 111162737B CN 201910822646 A CN201910822646 A CN 201910822646A CN 111162737 B CN111162737 B CN 111162737B
Authority
CN
China
Prior art keywords
fosc
oscillation frequency
frequency range
time
fref
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
CN201910822646.0A
Other languages
Chinese (zh)
Other versions
CN111162737A (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.)
Fengjia Technology Shanghai Co ltd
Original Assignee
Phyplus Inc
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 Phyplus Inc filed Critical Phyplus Inc
Priority to CN201910822646.0A priority Critical patent/CN111162737B/en
Publication of CN111162737A publication Critical patent/CN111162737A/en
Application granted granted Critical
Publication of CN111162737B publication Critical patent/CN111162737B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03BGENERATION OF OSCILLATIONS, DIRECTLY OR BY FREQUENCY-CHANGING, BY CIRCUITS EMPLOYING ACTIVE ELEMENTS WHICH OPERATE IN A NON-SWITCHING MANNER; GENERATION OF NOISE BY SUCH CIRCUITS
    • H03B5/00Generation of oscillations using amplifier with regenerative feedback from output to input
    • H03B5/30Generation of oscillations using amplifier with regenerative feedback from output to input with frequency-determining element being electromechanical resonator
    • H03B5/32Generation of oscillations using amplifier with regenerative feedback from output to input with frequency-determining element being electromechanical resonator being a piezoelectric resonator
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03LAUTOMATIC CONTROL, STARTING, SYNCHRONISATION OR STABILISATION OF GENERATORS OF ELECTRONIC OSCILLATIONS OR PULSES
    • H03L7/00Automatic control of frequency or phase; Synchronisation
    • H03L7/06Automatic control of frequency or phase; Synchronisation using a reference signal applied to a frequency- or phase-locked loop
    • H03L7/08Details of the phase-locked loop
    • H03L7/099Details of the phase-locked loop concerning mainly the controlled oscillator of the loop
    • H03L7/0995Details of the phase-locked loop concerning mainly the controlled oscillator of the loop the oscillator comprising a ring oscillator

Landscapes

  • Oscillators With Electromechanical Resonators (AREA)

Abstract

The embodiment of the invention relates to the field of integrated circuits, and discloses a working method and a working system of a real-time clock. In the invention, an on-chip ring oscillator and a high-frequency crystal oscillator are controlled to work in a wake-up period, and the oscillation frequency fref of the high-frequency crystal oscillator and the oscillation frequency fosc of the on-chip ring oscillator are obtained; acquiring a first oscillation frequency range of the on-chip ring oscillator according to a preset first error range of the fref and the fref; correcting the fosc to be within the first oscillation frequency range; acquiring the time length t required by the fosc exceeding the first oscillation frequency range; acquiring a sleep time according to the time t, and determining a wakeup time point; and correcting the fosc to the first oscillation frequency range, entering a sleep period, and controlling the on-chip ring oscillator to freely oscillate. By using the method, the original element in the real-time clock is used for providing an accurate time reference in the sleep period of the real-time clock, the structure of the real-time clock is simplified, and the manufacturing cost is saved.

Description

Working method and working system of real-time clock
Technical Field
The embodiment of the invention relates to the field of integrated circuits, in particular to a working method and a working system of a real-time clock.
Background
A Real-Time Clock (RTC) is an integrated circuit that provides an accurate Real-Time reference for an electronic system. The timing principle is as follows: the time is determined by counting the oscillation frequency generated by the crystal oscillator. In the field of chip design, the design of a real-time clock is a very important link.
The working period of the real-time clock can be divided into a wakeup period and a sleep period, and in the wakeup period, the high-frequency crystal oscillator starts oscillation to provide a time reference with extremely high accuracy for the real-time clock; during the sleep period, the high frequency crystal oscillator will stop working and cannot provide the time reference for the real-time clock during the sleep period.
The inventor finds that at least the following problems exist in the prior art:
in the prior art, a low-frequency crystal oscillator is added to provide a time reference for a real-time clock in a sleep period, so that the accuracy of the time reference in the sleep period cannot be guaranteed, a new element is introduced to occupy the pin position of the real-time clock, and the manufacturing cost is increased.
Disclosure of Invention
The invention aims to provide a working and working system of a real-time clock, which utilizes original elements in the real-time clock to ensure that an accurate time reference is provided for the real-time clock in a sleep period, simplifies the structure of the real-time clock and saves the manufacturing cost.
In order to solve the above technical problem, an embodiment of the present invention provides a method for operating a real-time clock, including the following steps: controlling an on-chip ring oscillator and a high-frequency crystal oscillator to work in an awakening period, and acquiring the oscillation frequency fref (reference frequency) of the high-frequency crystal oscillator and the oscillation frequency fosc (oscillator frequency) of the on-chip ring oscillator; acquiring a first oscillation frequency range of the on-chip ring oscillator according to a preset first error range of the fref and the fref; correcting the fosc to be within the first oscillation frequency range; acquiring the time length t required by the fosc exceeding the first oscillation frequency range; acquiring a sleep time according to the time t, and determining a wakeup time point; and correcting the fosc to the first oscillation frequency range, entering a sleep period, and controlling the on-chip ring oscillator to freely oscillate.
The embodiment of the invention also provides a working system of the real-time clock, which comprises the following components: the device comprises a control module, an acquisition module, a correction module and a processing module; the control module controls the high-frequency crystal oscillator and the on-chip ring oscillator to work in the wake-up period and controls the on-chip ring oscillator to freely oscillate in the sleep period; the acquisition module is used for acquiring the oscillation frequency fref of the high-frequency crystal oscillator, the oscillation frequency fosc of the on-chip ring oscillator and the first oscillation frequency range of the on-chip ring oscillator; the correction module corrects the fosc in the real-time clock wake-up period; and the processing module is used for acquiring the time length t required by the fosc exceeding the first oscillation frequency range, acquiring the dormancy time length and determining the awakening time point.
Compared with the prior art, the embodiment of the invention obtains the first oscillation frequency range of the fosc according to the first error range of the preset fref in the wake-up period of the real-time clock, firstly corrects the fosc to the first oscillation frequency range, and controls the fosc to the oscillation frequency range capable of providing accurate time reference by using the method; then, the time t required by the fosc to exceed the first oscillation frequency range is obtained by tracking the fosc, and by the method, the oscillation frequency range which can provide accurate time reference and how long the fosc needs to exceed can be obtained; acquiring an accurate sleep time length according to the time t, and determining a wakeup time point, wherein by using the method, when the real-time clock enters a sleep period, the free oscillation of the on-chip ring oscillator can provide an accurate time reference for the real-time clock after the high-frequency crystal oscillator stops working within the determined sleep time length; the embodiment of the invention solves the problem that the real-time clock high-frequency crystal oscillator in the prior art can not provide accurate time reference in the sleep period, and because the on-chip ring oscillator is the original element of the real-time clock, no new element needs to be introduced, no more chip pins are occupied, the structure is simplified, and the manufacturing cost is saved.
In addition, the controlling the on-chip ring oscillator and the high-frequency crystal oscillator to work in the wake-up period to obtain the oscillation frequency fref of the high-frequency crystal oscillator and the oscillation frequency fosc of the on-chip ring oscillator specifically includes: controlling an on-chip ring oscillator and a high-frequency crystal oscillator to work in an awakening period to obtain the oscillation frequency fref of the high-frequency crystal oscillator; tracking and counting the fosc to obtain a counting value Q; and acquiring the fosc according to the count value Q and the fref. By the method, fosc is acquired according to the counting value, and the accuracy of the acquired fosc value is guaranteed.
In addition, the correcting the fosc to the first oscillation frequency range specifically includes: tracking and counting the fosc to obtain a count value N; judging whether the fosc exceeds the first oscillation frequency range or not according to the counting value N and the fref; and if so, correcting the fosc to be in the first oscillation frequency range according to the count value N. By using the method, the fosc is tracked and counted, whether the fosc exceeds the first oscillation frequency range is judged according to the counting value, and the fosc is corrected to the first oscillation frequency range, so that the accuracy of the fosc is ensured, and the accuracy of the time length t is further ensured.
In addition, the acquiring a time duration t required by the fosc exceeding the first oscillation frequency range specifically includes: performing tracking counting on the fosc for multiple times to obtain a counting value M of each tracking; converting a real offset value of the fosc according to the counting value M and the fref; judging whether the fosc exceeds the first oscillation frequency range or not according to the real offset value; and if so, taking the time length used by the multiple tracking counting as the time length t. By using the method, the fosc is tracked and counted, the count value is obtained, the more accurate real offset value of the fosc is obtained according to the count value and fref, whether the fosc exceeds the first oscillation frequency range is further judged according to the real offset value, the time length used for tracking and counting is taken as the time length t, and the accuracy of the obtained time length t is further ensured.
In addition, after obtaining the time period t required by the fosc exceeding the first oscillation frequency range and before entering the sleep period, the method further includes: correcting the fosc to the first oscillation frequency range; performing cycle tracking counting on the fosc to obtain a count value L of each tracking; converting a real offset value of the fosc according to the counting value L and the fref; in the process of cycle tracking counting, whether the fosc exceeds the first oscillation frequency range is judged according to the real deviation value; and if so, correcting the fosc to be in the first oscillation frequency range. By using the method, the fosc is tracked and counted in real time, the real offset value of the fosc is calculated according to the count value tracked each time, and the offset condition of the fosc is monitored in real time, so that the fosc is corrected in time when exceeding the first oscillation frequency range, the accuracy of the fosc when entering the sleep period is further ensured, and the accuracy of the time reference of the sleep period is improved.
In addition, the obtaining of the sleep duration according to the duration t and the determining of the wake-up time point specifically include: acquiring a tracking count value T corresponding to the last fosc which does not exceed the first oscillation frequency range; and acquiring the sleep time length according to the count value T and the duration T, and determining the awakening time point. By using the method, the accuracy of the determined sleeping time length is higher by taking the finally obtained accurate count value T as a reference and combining the time length T, the accuracy of the awakening time is further improved, and the fosc in the sleeping period can provide an accurate time reference for the real-time clock.
In addition, the obtaining of the sleep duration according to the duration t and the determining of the wake-up time point further include: acquiring an average A of a plurality of count values W corresponding to fosc which does not exceed a first oscillation frequency range; and acquiring the length of the sleep time according to the average A and the time t, and determining the awakening time point. By using the method, the average value A of the uploaded accurate count values W is taken as a reference, and the time length of the sleep is determined to be higher in accuracy by combining the time length t, so that the accuracy of the awakening time is further improved, and the fosc in the sleep period can provide an accurate time reference for the real-time clock.
In addition, before the obtaining the first oscillation frequency range of the on-chip ring oscillator according to the preset first error range of the fref and the fref, the method further includes: acquiring a second oscillation frequency range of the on-chip ring oscillator according to a preset second error range of the fref and the fref, wherein the second oscillation frequency range is larger than the first oscillation frequency range; correcting the fosc to be within the second oscillation frequency range.
Drawings
One or more embodiments are illustrated by the corresponding figures in the drawings, which are not meant to be limiting.
FIG. 1 is a flow chart of a method of operation of a real time clock according to a first embodiment of the present invention;
FIG. 2 is a schematic diagram of the distribution of the operating time of a real-time clock according to a first embodiment of the present invention;
FIG. 3 is a flow chart of a method of operation of a real time clock according to a second embodiment of the invention;
fig. 4 is a schematic diagram of an operating system of a real time clock according to a third embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. However, it will be appreciated by those of ordinary skill in the art that numerous technical details are set forth in order to provide a better understanding of the present application in various embodiments of the present invention. However, the technical solution claimed in the present application can be implemented without these technical details and various changes and modifications based on the following embodiments.
A first embodiment of the present invention relates to a method for operating a real-time clock. In the embodiment, an on-chip ring oscillator and a high-frequency crystal oscillator are controlled to work in an awakening period, and the oscillation frequency fref of the high-frequency crystal oscillator and the oscillation frequency fosc of the on-chip ring oscillator are obtained; acquiring a first oscillation frequency range of the on-chip ring oscillator according to a preset first error range of the fref and the fref; correcting the fosc to be within the first oscillation frequency range; acquiring the time length t required by the fosc exceeding the first oscillation frequency range; acquiring a sleep time according to the time t, and determining a wakeup time point; and correcting the fosc to the first oscillation frequency range, entering a sleep period, and controlling the on-chip ring oscillator to freely oscillate.
In the embodiment, in the wake-up period of the real-time clock, the vibration frequency fref of the high-frequency crystal oscillator is taken as a reference, a first oscillation frequency range of the fosc is obtained according to a preset first error range of the fref, and the fosc is corrected to be in the first oscillation frequency range; the method comprises the steps of obtaining the time t required by the fosc exceeding the first oscillation frequency range by tracking the fosc, obtaining the accurate dormancy time length according to the time t, determining the awakening time point, and ensuring that when the real-time clock enters the dormancy period, the free oscillation of the on-chip ring oscillator can provide accurate time reference for the real-time clock after the high-frequency crystal oscillator stops working within the determined dormancy time length. The problem of among the prior art real-time clock high frequency crystal oscillator can't provide accurate time reference in the dormancy period is solved, moreover because the piece internal ring oscillator is the original component of real-time clock, need not to introduce new component, do not occupy more chip stitches, simplified the structure, practiced thrift manufacturing cost.
The following describes implementation details of the operating method of the real-time clock of the present embodiment in detail, and the following is only provided for easy understanding and is not necessary for implementing the present embodiment.
The flow chart is shown in fig. 1, and comprises:
step S101, entering a wake-up period, controlling an on-chip ring oscillator and a high-frequency crystal oscillator to start working, and acquiring an oscillation frequency fosc of the on-chip ring oscillator and an oscillation frequency fref of the high-frequency crystal oscillator.
Specifically, when the wake-up period is started, the real-time clock controls the high-frequency crystal oscillator to start oscillation, and the high-frequency crystal oscillator generates high-precision oscillation frequency fref; meanwhile, the real-time clock controls the on-chip ring oscillator to freely oscillate, the on-chip ring oscillator generates oscillator frequency fosc by taking fref as a reference, the on-chip ring oscillator is tracked and counted, and specific numerical values of fosc are obtained according to the obtained counting value Q, for example, fref is 1000 times per second, the counting value is 100, and then when the tracking time is 1 second, the fosc is 10 times per second. By the method, fosc is acquired according to the counting value, and the accuracy of the acquired fosc value is guaranteed.
Step S102, acquiring a first oscillation frequency range of the fosc according to a preset first error range of the fref and the fref.
Specifically, a first error range of fref is preset, and when the fref is within the first error range, a precise time reference can be provided for the real-time clock; based on fref, a first oscillation frequency range of fosc corresponding to the first error range of fref is converted from the count value in step S101. By the method, the first oscillation frequency range of the fosc is obtained, and when the fosc is in the first oscillation frequency range, a precise time reference can be provided for the real-time clock.
It should be noted that, in other embodiments, before step S102, a second oscillation frequency range of the on-chip ring oscillator is further obtained according to a preset second error range of the fref and the fref, where the second oscillation frequency range is greater than the first oscillation frequency range; and correcting the fosc to within the second oscillation frequency range. With this method, before correction with higher accuracy is performed, coarse correction is performed, and fosc is first determined to be within a rough range to prepare for correction with higher accuracy.
Step S103, performing tracking counting on the fosc, and acquiring a count value N.
Specifically, fref in the tracking time is taken as a reference, fosc is tracked and counted, and in the tracking process, the oscillation frequency of the high-frequency crystal oscillator is obtained when the ring oscillator in the chip oscillates once, wherein the oscillation frequency is a count value N; for example, fref is 1000 times per second, fosc is 10 times per second, and the count value is 100 when the tracking time is 1 second.
Step S104, judging whether the fosc exceeds the first oscillation frequency range or not according to the counting value N and the fref, and if so, entering step S105; if not, the process proceeds to step S106.
Specifically, the average oscillation frequency of the on-chip ring oscillator within the tracking time can be calculated by the count value N and fref, for example, if the count value is 100, the tracking time is 5 seconds, and the fref is 3000 times per second, it can be found that the average oscillation frequency of the on-chip ring oscillator within the five-second time is (3000/100)/5-6 times per second; then, taking the average oscillation frequency as fosc in the tracking time, and according to the obtained first oscillation frequency range, it can be determined whether fosc exceeds the first oscillation frequency range.
Step S105, correcting the fosc to be within the first oscillation frequency range.
Specifically, the oscillation frequency of the on-chip ring oscillator is adjusted to be within the first oscillation frequency range by the control signal according to the average oscillation frequency of the on-chip ring oscillator and the first oscillation frequency range acquired in step S104.
And step S106, tracking and counting the fosc, and acquiring a tracked count value M.
Specifically, fref in the tracking time is taken as a reference, fosc is tracked and counted, and in the tracking process, the oscillation frequency of the high-frequency crystal oscillator is obtained when the on-chip ring oscillator oscillates once, wherein the oscillation frequency is a count value M; for example, fref is 1000 times per second, fosc is 10 times per second, and the count value is 100 when the tracking time is 1 second.
And step S107, converting the real offset value of the fosc according to the counting value M and the fref.
Specifically, according to a count value and fref obtained in one tracking process, the average oscillation frequency of the on-chip ring oscillator in the current tracking process is converted, the average oscillation frequency is used as fosc, and the fosc is compared with the average oscillation frequency to obtain a real offset value; for example, the exact fosc is 30 times per second, the average oscillation frequency is 25 times per second, and the true offset value is 5 times per second. By using the method, the offset of the average value relative to the accurate value is obtained according to the average value of the fosc in each tracking and counting process, and when the fosc exceeds the first oscillation frequency range is known in real time.
Step S108, judging whether the fosc exceeds the first oscillation frequency range or not according to the real offset value, if so, entering step S109, and if not, entering step S106.
Specifically, the real offset value obtained by tracking each time is compared with the absolute value of the difference between the boundary value of the first oscillation frequency range and the accurate value, whether fsoc exceeds the first oscillation frequency range is judged, if the real offset value is larger than the absolute value of the difference, fosc exceeds the first oscillation frequency range, and if the real offset value is smaller than the absolute value of the difference, fosc does not exceed the first oscillation frequency range. For example, if the true offset value is 5 times per second, the boundary values of the first oscillation frequency range are 28 times per second and 32 times per second, and the accurate value is 30 times per second, then the absolute value of the difference between the boundary values and the accurate value is 2 times per second, the true offset value is greater than the absolute value, and fosc exceeds the first oscillation frequency range.
Step S109, the time length used for tracking counting is taken as the time length t.
Specifically, when it is determined that the fosc has exceeded the first oscillation frequency range after one tracking count, the time taken from the first tracking to the last tracking is added as the time period t required for the fosc to exceed the first oscillation frequency range. For example, if the counting time is 1 second per tracking and 10 times of tracking are performed in total, the time duration t is 10 seconds. By using the method, the time that the fosc needs to exceed the first oscillation frequency range is mastered, the sleep time duration can be controlled within the time duration t, and the sleep time fosc is ensured to provide an accurate time reference.
It should be noted that in other embodiments, the tracking count of the fosc results in a time t for the fosc to exceed the first oscillation frequency range1Then, correcting the fosc to be within the first oscillation frequency range, and continuously tracking and counting the fosc to obtain the fact that the fosc exceeds the first oscillation frequency rangeTime t used2Will t1And t2Is taken as the time length t, of course, t can also be obtained3、t4……tnAnd then calculates the average value as the time period t. By using the method, the time length required by the fosc exceeding the first oscillation frequency range is tracked and calculated for multiple times, the average value is calculated to be used as the time length t, the accuracy of the time length t is further ensured, and the accuracy of the time reference provided by the fosc in the time length t is further ensured.
And step S110, acquiring the sleeping time according to the time t, and determining the awakening time point.
Specifically, after the duration t is obtained, a sleep duration may be obtained, and the sleep duration needs to be less than or equal to the sleep duration. By using the method, the sleep time duration is controlled within the time duration t, and the sleep time fosc is ensured to provide an accurate time reference.
And step S111, correcting the fosc to be within the first oscillation frequency range, entering a sleep period, and controlling the on-chip ring oscillator to freely oscillate.
Specifically, the wake-up period is about to end, and before entering the sleep period, the fosc is corrected to be within the first oscillation frequency range, and by using the method, the fosc is ensured not to exceed the first oscillation frequency range within the sleep time length; when the wake-up period is finished and the sleep period is entered, the high-frequency crystal oscillator stops working, the free oscillation of the on-chip ring oscillator is controlled in the sleep period, and the fosc does not exceed the first oscillation frequency range, so that the on-chip ring oscillator is guaranteed to freely oscillate in the sleep period and can provide a precise time reference for the real-time clock.
The embodiment acquires a first oscillation frequency range of the fosc in the wake-up period of the real-time clock, corrects the fosc to the first oscillation frequency range, and controls the fosc to the oscillation frequency range capable of providing accurate time reference by using the method; then, the time t required by the fosc to exceed the first oscillation frequency range is obtained by tracking the fosc, and by the method, the oscillation frequency range which can provide accurate time reference and how long the fosc needs to exceed can be obtained; the sleep time length is controlled within the time t to determine the awakening time point, and by using the method, the fact that the free oscillation of the on-chip ring oscillator can provide an accurate time reference for the real-time clock within the sleep time length after the high-frequency crystal oscillator stops working when the real-time clock enters the sleep period is guaranteed; the embodiment solves the problem that the real-time clock high-frequency crystal oscillator in the prior art can not provide accurate time reference in the sleep period, and the on-chip ring oscillator is an original element of the real-time clock, so that a new element is not required to be introduced, more chip pins are not occupied, the structure is simplified, and the manufacturing cost is saved.
It is worth to be noted that the wake-up period time of the real-time clock is preset, the wake-up period is started after the end of the sleep period, the wake-up period and the sleep period are alternately performed, the high-frequency crystal oscillator works intermittently, and the on-chip ring oscillator oscillates all the time. The schematic diagram of the allocation of the specific working time is shown in fig. 2, and includes: x, the wake-up period time length of the real-time clock; t, the time length of the sleep period of the real-time clock; fref, oscillation frequency of real-time clock high-frequency crystal oscillator; and the fosc real-time clock chip wakes up the oscillation frequency of the oscillator.
A second embodiment of the invention relates to a method of operating a real-time clock. The second embodiment is further improved from the first embodiment.
Specifically, in the second embodiment of the present invention, after the first embodiment obtains the time length t required for the fosc to exceed the first oscillation frequency range, before entering the sleep period, cycle tracking counting is performed on the fosc, and the fosc is corrected to the first oscillation frequency range in real time in the tracking process. By using the method, the accuracy of the fosc when entering the sleep period is ensured, and the accuracy of the time reference provided by the fosc for the real-time clock is further improved. The specific flow is shown in fig. 3.
S301, entering a wake-up period, controlling the on-chip ring oscillator and the high-frequency crystal oscillator to start working, and acquiring the oscillation frequency fosc of the on-chip ring oscillator and the oscillation frequency fref of the high-frequency crystal oscillator. This step is similar to step S101 and will not be described herein again.
S302, acquiring a first oscillation frequency range of the fosc according to a preset first error range of the fref and the fref. This step is similar to step S102 and will not be described herein again.
S303, tracking and counting the fosc to obtain a count value N. This step is similar to step S103 and will not be described herein again.
S304, judging whether the fosc exceeds the first oscillation frequency range or not according to the counting value N and the fref, and if so, entering the step S205; if not, the process proceeds to step S206. This step is similar to step S104 and will not be described herein again.
S305, correcting the fosc to be in the first oscillation frequency range. This step is similar to step S105, and is not described herein again.
S306, tracking and counting the fosc, and acquiring a tracked count value M. This step is similar to step S106 and will not be described herein again.
S307, converting the real offset value of the fosc according to the counting value M and the fref. This step is similar to step S107 and will not be described herein.
S308, judging whether the fosc exceeds the first oscillation frequency range or not according to the real offset value, if so, entering the step S309, and if not, entering the step S306. This step is similar to step S108 and will not be described herein.
And S309, taking the time length used for tracking and counting as the time length t. This step is similar to step S109 and will not be described herein.
S310, correcting the fosc to the first oscillation frequency range. This step is similar to step S105, and is not described herein again.
S311, tracking and counting the fosc, and acquiring a tracked count value L. This step is similar to step S106 and will not be described herein again.
S312, according to the counting value L and the fref, the real offset value of the fosc is converted. This step is similar to step S107 and will not be described herein.
S313, whether the fosc exceeds the first oscillation frequency range is judged according to the real deviation value, if yes, the step S314 is carried out, and if not, the step S315 is carried out. This step is similar to step S104 and will not be described herein again.
S314, correcting the fosc to the first oscillation frequency range, which is similar to step S105 and is not repeated herein.
S315, determine whether to enter the sleep period, if yes, go to step S216, if no, go to step S211.
And S316, acquiring the sleeping time according to the time t and the fosc, and determining the awakening time point.
Specifically, if fosc is just corrected, the sleep duration can be guaranteed within the sleep duration as long as the sleep duration is guaranteed within the duration t, and the fosc provides a precise time reference for the real-time clock; if the fosc does not exceed the first oscillation frequency range but is not just corrected, the sleep time duration needs to be determined according to the count value T and fref obtained by the last tracking count and the time duration T, the sleep time duration is within the time duration T, for example, the count value T is 125, the time duration T is 5 seconds, the accurate fosc is 10 times per second, the first oscillation frequency range is 8 times per second to 12 times per second, the fref is 1000 times per second, the current fosc is (1000/125) ═ 8 times per second, and the sleep time duration is 1 second. By the method, accurate time reference is provided for the real-time clock by the fosc within the set sleep duration.
It is worth mentioning that in other embodiments. The sleep period may also be determined from the average values a and fref of the count values W obtained by the plurality of trace counts and the period t. By using the method, the current fosc is obtained by the average value of the counting values L which are tracked and counted for multiple times and fref, the accuracy of the obtained current fosc is further ensured, and therefore the fosc can provide an accurate time reference for the real-time clock in the sleep duration.
And S317, entering a sleep period and controlling the on-chip ring oscillator to freely oscillate. This step is similar to step S111 and will not be described herein again.
The embodiment acquires a first oscillation frequency range of the fosc in the wake-up period of the real-time clock, corrects the fosc to the first oscillation frequency range, and controls the fosc to the oscillation frequency range capable of providing accurate time reference by using the method; then, acquiring the time t required by the corrected fosc to exceed the first oscillation frequency range by tracking the corrected fosc, and acquiring how long the corrected fosc needs to exceed the oscillation frequency range capable of providing an accurate time reference by using the method; when the sleep period is not entered, performing circular tracking correction on the fosc, and ensuring the accuracy of the fosc when the sleep period is entered by using the method; acquiring sleep duration according to fosc and time t when the real-time clock enters the sleep period, and determining a wake-up time point; the embodiment solves the problem that the real-time clock high-frequency crystal oscillator in the prior art can not provide accurate time reference in the sleep period, and the on-chip ring oscillator is an original element of the real-time clock, so that a new element is not required to be introduced, more chip pins are not occupied, the structure is simplified, and the manufacturing cost is saved.
The steps of the above methods are divided for clarity, and the implementation may be combined into one step or split some steps, and the steps are divided into multiple steps, so long as the same logical relationship is included, which are all within the protection scope of the present patent; it is within the scope of the patent to add insignificant modifications to the algorithms or processes or to introduce insignificant design changes to the core design without changing the algorithms or processes.
A third embodiment of the present invention relates to a system for operating a real-time clock, which is schematically shown in fig. 4 and includes: a counting module 401, a first judging module 402, a second judging module 403, a correcting module 404, a processing module 405, a control module 406 and an obtaining module 407.
Specifically, all the above elements interact through digital control signals. The counting module tracks and counts the oscillation frequency of the ring oscillator in the chip in the wake-up period of the real-time clock to obtain a count value; the first judging module 402 judges whether the oscillation frequency of the on-chip ring oscillator is in the first oscillation frequency range during the wake-up period of the real-time clock; the second judging module 403 judges whether the oscillation frequency of the on-chip ring oscillator is within the second oscillation frequency range in the wake-up period of the real-time clock; the correction module 404 corrects the oscillation frequency of the ring oscillator in the correction chip to the first oscillation frequency range or the second oscillation frequency range during the wake-up period of the real-time clock; the processing module 405 acquires a time length t required by the oscillation frequency of the on-chip ring oscillator exceeding the first oscillation frequency range according to the count value acquired by the counting module 401, acquires a sleep time length according to the time length t, and determines a wakeup time point; the control module 406 controls the high-frequency crystal oscillator and the on-chip ring oscillator to work in the wake-up period and controls the on-chip ring oscillator to freely oscillate in the sleep period; the obtaining module 407 obtains an oscillation frequency of the high-frequency crystal oscillator, an oscillation frequency of the on-chip ring oscillator, and a first oscillation frequency range of the on-chip ring oscillator during the wake-up period.
It should be understood that this embodiment is a system example corresponding to the above embodiment, and that this embodiment can be implemented in cooperation with the above embodiment. The related technical details mentioned in the above embodiments are still valid in this embodiment, and are not described herein again in order to reduce repetition. Accordingly, the related-art details mentioned in the present embodiment can also be applied to the above-described embodiments.
It should be noted that each module in this embodiment is a logical module, and in practical applications, one logical unit may be one physical unit, may be a part of one physical unit, and may be implemented by a combination of a plurality of physical units. In addition, in order to highlight the innovative part of the present invention, elements that are not so closely related to solving the technical problems proposed by the present invention are not introduced in the present embodiment, but this does not indicate that other elements are not present in the present embodiment.
It will be understood by those of ordinary skill in the art that the foregoing embodiments are specific examples for carrying out the invention, and that various changes in form and details may be made therein without departing from the spirit and scope of the invention in practice.

Claims (10)

1. A method of operating a real time clock, comprising:
controlling an on-chip ring oscillator and a high-frequency crystal oscillator to work in a wake-up period, and obtaining an oscillation frequency fref of the high-frequency crystal oscillator and an oscillation frequency fosc of the on-chip ring oscillator;
acquiring a first oscillation frequency range of the fosc according to a preset first error range of the fref and the fref;
correcting the fosc to be within the first oscillation frequency range;
acquiring the time length t required by the fosc exceeding the first oscillation frequency range;
acquiring a sleep time according to the time t, and determining a wakeup time point;
and correcting the fosc to the first oscillation frequency range, entering a sleep period, and controlling the on-chip ring oscillator to freely oscillate.
2. The method according to claim 1, wherein the controlling the on-chip ring oscillator and the high-frequency crystal oscillator to operate in the wake-up period to obtain the oscillation frequency fref of the high-frequency crystal oscillator and the oscillation frequency fosc of the on-chip ring oscillator includes:
controlling an on-chip ring oscillator and a high-frequency crystal oscillator to work in an awakening period to obtain the oscillation frequency fref of the high-frequency crystal oscillator;
tracking and counting the fosc to obtain a counting value Q;
and acquiring the fosc according to the count value Q and the fref.
3. The method according to claim 1, wherein the correcting the fosc to the first oscillation frequency range comprises:
tracking and counting the fosc to obtain a count value N;
judging whether the fosc exceeds the first oscillation frequency range or not according to the counting value N and the fref;
and if so, correcting the fosc to be in the first oscillation frequency range.
4. The method according to claim 1, wherein the obtaining the time duration t required for the fosc to exceed the first oscillation frequency range specifically comprises:
performing tracking counting on the fosc for multiple times to obtain a counting value M of each tracking;
converting a real offset value of the fosc according to the counting value M and the fref;
judging whether the fosc exceeds the first oscillation frequency range or not according to the real offset value;
and if so, taking the time length used by the multiple tracking counting as the time length t.
5. The method of claim 1, wherein after the obtaining the time period t required for the fosc to exceed the first oscillation frequency range and before entering the sleep period, the method further comprises:
correcting the fosc to the first oscillation frequency range;
performing cycle tracking counting on the fosc to obtain a count value L of each tracking;
converting a real offset value of the fosc according to the counting value L and the fref;
in the process of cycle tracking counting, whether the fosc exceeds the first oscillation frequency range is judged according to the real deviation value; and if so, correcting the fosc to be in the first oscillation frequency range.
6. The working method of the real-time clock according to claim 5, wherein the obtaining the sleep duration according to the duration t and determining the wakeup time point specifically comprises:
acquiring a tracking count value T corresponding to the last fosc which does not exceed the first oscillation frequency range;
and acquiring the sleeping time according to the counting value T and the time T, and determining the awakening time point.
7. The method according to claim 5, wherein the obtaining a sleep duration and determining the wakeup time point according to the duration t further comprises:
acquiring an average A of a plurality of count values W corresponding to fosc which does not exceed a first oscillation frequency range;
and acquiring the sleeping time according to the average A and the time t, and determining the awakening time point.
8. The method according to claim 1, wherein before obtaining the first oscillation frequency range of the on-chip ring oscillator according to the preset first error range of the fref and the fref, the method further comprises:
acquiring a second oscillation frequency range of the on-chip ring oscillator according to a preset second error range of the fref and the fref, wherein the second oscillation frequency range is larger than the first oscillation frequency range;
correcting the fosc to be within the second oscillation frequency range.
9. A system for operating a real time clock, comprising: the device comprises a control module, an acquisition module, a correction module and a processing module;
the control module controls the high-frequency crystal oscillator and the on-chip ring oscillator to work in the wake-up period and controls the on-chip ring oscillator to freely oscillate in the sleep period;
the acquisition module is used for acquiring the oscillation frequency fref of the high-frequency crystal oscillator, the oscillation frequency fosc of the on-chip ring oscillator and the first oscillation frequency range of the on-chip ring oscillator;
the correction module corrects the fosc in the real-time clock wake-up period;
and the processing module is used for acquiring the time length t required by the fosc exceeding the first oscillation frequency range, acquiring the dormancy time length and determining the awakening time point.
10. The system for operating a real-time clock as recited in claim 9, further comprising: the device comprises a counting module, a first judging module and a second judging module;
the counting module is used for tracking and counting the fosc to obtain a counting value;
the first judging module is used for judging whether the fosc is in the first oscillation frequency range or not;
and the second judging module is used for judging whether the fosc is in a second oscillation frequency range, wherein the second oscillation frequency range is larger than the first oscillation frequency range.
CN201910822646.0A 2019-09-02 2019-09-02 Working method and working system of real-time clock Active CN111162737B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910822646.0A CN111162737B (en) 2019-09-02 2019-09-02 Working method and working system of real-time clock

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910822646.0A CN111162737B (en) 2019-09-02 2019-09-02 Working method and working system of real-time clock

Publications (2)

Publication Number Publication Date
CN111162737A CN111162737A (en) 2020-05-15
CN111162737B true CN111162737B (en) 2021-02-05

Family

ID=70555632

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910822646.0A Active CN111162737B (en) 2019-09-02 2019-09-02 Working method and working system of real-time clock

Country Status (1)

Country Link
CN (1) CN111162737B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114578153B (en) * 2022-01-26 2023-05-16 奉加科技(上海)股份有限公司 Crystal oscillator oscillation detection circuit

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1215266A (en) * 1997-09-27 1999-04-28 日本电气株式会社 High-resolution clock reconstruction used in mobile communication equipment
CN101782791A (en) * 2010-01-29 2010-07-21 杭州电子科技大学 Clock/reset and configuration controller hardcore in communication processor chip
CN102843758A (en) * 2012-08-28 2012-12-26 苏州博联科技有限公司 Method for data energy conservation transmission between nodes in wireless sensor network
CN105684299A (en) * 2013-10-28 2016-06-15 高通股份有限公司 An ultra low-power high frequency crystal oscillator for real time clock applications
CN105703749A (en) * 2014-11-24 2016-06-22 中国科学院沈阳自动化研究所 Low-power consumption and accurate sleep timer circuit and method
CN106028436A (en) * 2016-04-28 2016-10-12 华为技术有限公司 Time and frequency deviation compensation method and user terminal

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1215266A (en) * 1997-09-27 1999-04-28 日本电气株式会社 High-resolution clock reconstruction used in mobile communication equipment
CN101782791A (en) * 2010-01-29 2010-07-21 杭州电子科技大学 Clock/reset and configuration controller hardcore in communication processor chip
CN102843758A (en) * 2012-08-28 2012-12-26 苏州博联科技有限公司 Method for data energy conservation transmission between nodes in wireless sensor network
CN105684299A (en) * 2013-10-28 2016-06-15 高通股份有限公司 An ultra low-power high frequency crystal oscillator for real time clock applications
CN105703749A (en) * 2014-11-24 2016-06-22 中国科学院沈阳自动化研究所 Low-power consumption and accurate sleep timer circuit and method
CN106028436A (en) * 2016-04-28 2016-10-12 华为技术有限公司 Time and frequency deviation compensation method and user terminal

Also Published As

Publication number Publication date
CN111162737A (en) 2020-05-15

Similar Documents

Publication Publication Date Title
DE602005002667T2 (en) Method and apparatus for determining a calibration factor for a slow clock
JP4503616B2 (en) Precise sleep timer using low-cost and low-accuracy clock
KR101651263B1 (en) Automatic synchronization of an internal oscillator to an external frequency reference
EP2666239B1 (en) Low-power oscillator
EP2369438B1 (en) Calibration method of a real time clock signal
CN1323494A (en) Synchronisation of a low power clock in a wireless communication device
CN111162737B (en) Working method and working system of real-time clock
US9307571B2 (en) Communication device and frequency offset calibrating method
CN106227293A (en) A kind of system clock
CN1917372B (en) Circuit arrangement for detection of a locking condition for a phase locked loop, and a method
US6084441A (en) Apparatus for and method of processing data
CN105829989A (en) Microcomputer and method for correction of clock signal thereof
CN113970698A (en) Method and system for calibrating off-chip crystal oscillator
CN104869628B (en) Clock correcting method, air conditioner electric control device, terminal and the system of air conditioner electric control device
US6442704B1 (en) Ring oscillator clock frequency measuring method, ring oscillator clock frequency measuring circuit, and microcomputer
CN103023433B (en) Improved high-precision oscillator
JP2002305443A (en) Timer circuit
JP2011197910A (en) Clock control circuit and microcomputer
CN204389902U (en) A kind of digital display high-precision electronic clock based on CPLD digital circuit
CN203135792U (en) Improved high-precision oscillator
US6721377B1 (en) Method and circuit configuration for resynchronizing a clock signal
KR101709821B1 (en) Cloc recovery in a battery powered device
JP2003232876A (en) Time correction device
JPH0784666A (en) Control device for intermittent operation of cpu
US20040164814A1 (en) Clock generating circuit

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
CP01 Change in the name or title of a patent holder

Address after: 201403 room 6043, building 1, 1150 Lanfeng Road, Fengxian District, Shanghai

Patentee after: Fengjia Technology (Shanghai) Co.,Ltd.

Address before: 201403 room 6043, building 1, 1150 Lanfeng Road, Fengxian District, Shanghai

Patentee before: PHYPLUS Inc.

CP01 Change in the name or title of a patent holder