A time calibration method, a chip timing system and a chip
By calibrating the RC oscillator timing of the chip timing system through synchronous counting and intermittent wake-up of the external crystal oscillator, the problem of inaccurate timing caused by RC oscillator frequency drift is solved, and accurate timing with low power consumption is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AMICRO SEMICONDUCTOR CO LTD
- Filing Date
- 2023-04-23
- Publication Date
- 2026-07-07
AI Technical Summary
Existing chip timing systems suffer from inaccurate timing due to frequency drift issues in RC oscillators. This is especially problematic under low-power requirements, where current technologies are power-intensive and struggle to achieve green and environmentally friendly low-power timing.
By waking up an external crystal oscillator and using the synchronous counting and stopping method of the first and second counters, the timing of the RC oscillator is calibrated. The external crystal oscillator is only woken up when needed, and the calibration is repeated at regular intervals to reduce power consumption.
It enables accurate timing calibration of the RC oscillator under low power conditions, improving the reliability and accuracy of timing and reducing the power consumption of the external crystal oscillator.
Smart Images

Figure CN116540517B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of chip timing calibration technology, specifically to a timing calibration method, a chip timing system, and a chip. Background Technology
[0002] To achieve accurate timing, current chip timing systems typically employ either an external crystal oscillator (i.e., an external crystal oscillator) or an internal RC oscillator (i.e., an oscillation circuit composed of an RC frequency selection network). When a chip timing system uses an internal RC oscillator for timing, the internal RC oscillator experiences frequency drift due to temperature changes during operation. This causes the chip timing system to be unable to determine the current frequency of the internal RC oscillator, resulting in inaccurate timing based on its current frequency and affecting timing precision.
[0003] With the promotion of green and environmentally friendly concepts, users are paying close attention to whether a solution is green and low-power, especially in solutions that require battery systems. The low power consumption of a solution directly affects the length of the battery's operating cycle. The power consumption of a chip timing system using an external crystal oscillator is much higher than that using an internal RC oscillator. Therefore, low-power timing solutions typically use chip timing systems with internal RC oscillators. However, due to the frequency drift problem of RC oscillators, calibration is required.
[0004] Chinese patent application number 201711154750.4 discloses a method for calibrating the clock frequency of a low-frequency RC oscillator. This method utilizes an external high-frequency crystal oscillator to convert the clock frequency into a high-frequency standard crystal oscillator. The high-frequency standard crystal oscillator is then used to calibrate the low-frequency RC standard clock, and a count value of the calibrated frequency is output to a division module. The division module uses the product of the low-frequency RC standard clock cycle and the frequency of the high-frequency standard crystal oscillator as the dividend, and the count value as the divisor to obtain the calibrated frequency value. However, this method requires a division module and other computational modules for calibrating the clock frequency of a low-frequency RC oscillator, resulting in high overall power consumption and making it difficult to achieve a green, low-power output calibration frequency. Summary of the Invention
[0005] This application provides a timing calibration method, a chip timing system, and a chip, the specific technical solution of which is as follows:
[0006] A timing calibration method is provided for calibrating the timing of an RC oscillator inside a timing chip. Specifically, the method includes: Step S1: waking up an external crystal oscillator, synchronously starting a first counter and a second counter, and determining whether the first count of the first counter is equal to the counting period corresponding to a preset calibration time. If yes, proceed to Step S2; otherwise, the first and second counters continue counting. The first counter uses a first clock signal provided by the external crystal oscillator as its first counting clock source, and the second counter uses a second clock signal provided by the RC oscillator inside the timing chip as its second counting clock source. Step S2: when the first count value of the first counter equals the counting period corresponding to the preset calibration time, synchronously stopping the counting of the first and second counters, and proceeding to Step S3. Step S3: using the second count value of the second counter to calibrate the timing of the RC oscillator inside the timing chip. This technical solution uses the first clock signal provided by an external crystal oscillator as the standard clock source, and uses the first count value obtained by the first counter as the standard count value. By using the method of synchronously starting and stopping the counting of the first counter and the second counter, the count value that the second counter should obtain within the preset calibration time is calibrated, thereby realizing the calibration of the timing of the RC oscillator inside the timing chip and ensuring the accuracy of timing using the RC oscillator. At the same time, by waking up the external crystal oscillator only when timing calibration is needed, the power consumption required by using the external crystal oscillator is reduced, and low-power calibration timing is achieved.
[0007] Furthermore, the timing calibration method further includes: repeating steps S1 to S3 at each first time interval to calibrate the timing of the RC oscillator inside the timing chip once at each first time interval. Because the clock frequency of the RC oscillator inside the timing chip deviates due to changes in the chip's operating temperature during operation, the second counter inside the timing chip cannot accurately count based on the RC oscillator's clock frequency to achieve precise timing. Therefore, timing calibration is necessary. However, a single timing calibration cannot guarantee the timing accuracy of the timing chip in the long term. The timing calibration method provided in this technical solution repeats the timing calibration method at each first time interval to perform timed calibration of the clock frequency of the RC oscillator inside the timing chip, effectively improving the timing reliability of the timing chip.
[0008] Furthermore, the preset calibration time is equal to the unit timing cycle of the RC oscillator inside the timing chip; the counting period corresponding to the preset calibration time is equal to the frequency value of the external crystal oscillator within the preset calibration time. This technical solution configures the counting period corresponding to the preset calibration time to be equal to the frequency value of the external crystal oscillator within the preset calibration time. When using external crystal oscillators of different frequencies, the counting period of the preset calibration time will be different accordingly, enabling adaptive adjustment of the counting value limitation of the first counter based on the frequency of the external crystal oscillator used in a specific solution.
[0009] Furthermore, step S2 further includes: controlling the external crystal oscillator to enter a sleep state when the first count value of the first counter equals the counting period corresponding to the preset calibration time. This technical solution reduces the power consumption required by the external crystal oscillator by controlling it to enter a sleep state when the first count value of the first counter equals the counting period corresponding to the preset calibration time, i.e., after the second count value has been calibrated. This effectively reduces the power consumption required by the timing calibration method, achieving the goal of low-power timing calibration.
[0010] Furthermore, the calibration of the timing of the RC oscillator inside the timing chip using the second count value of the second counter specifically includes: transmitting the second count value of the second counter to a unit timing cycle count register in the timing chip for storage as the count value corresponding to a unit timing cycle, so that the timing chip counts the frequency value of the second clock signal provided by the RC oscillator inside the timing chip according to the count value corresponding to a unit timing cycle stored in the unit timing cycle count register, thereby realizing the timing of the second clock signal provided by the RC oscillator inside the timing chip. This counting scheme updates the second count value obtained after calibration by an external crystal oscillator combined with the first counter to the count value corresponding to a unit timing cycle. By updating the count value corresponding to a unit timing cycle, the timing of the RC oscillator inside the timing chip is calibrated.
[0011] Furthermore, the first counter uses the first clock signal provided by an external crystal oscillator as the first counting clock source for counting, specifically including: the first counter increments the first count value by one for each clock cycle of the first counting clock source detected.
[0012] Furthermore, the second counter uses the second clock signal provided by the RC oscillator inside the timing chip as the second counting clock source for counting, specifically including: the second counter increments the second count value by one for each clock cycle of the second counting clock source detected.
[0013] This application also provides a chip timing system, specifically including: an external crystal oscillator for providing a first clock signal to a first counter as a first counting clock source; a first counter for receiving the first counting clock source provided by the external crystal oscillator to count and obtain a first count value; a timing chip internally comprising an RC oscillator, a second counter, a unit timing cycle counting register, and a timing calibration control device; wherein, the RC oscillator is used to provide a second clock signal to the second counter as a second counting clock source; the second counter is used to receive the second counting clock source provided by the RC oscillator to count and obtain a second count value, and the calibrated second count value is transmitted as the count value corresponding to a unit timing cycle to the unit timing cycle counting register for storage; the unit timing cycle counting register... The timing chip uses a counter register to store the count value corresponding to a unit timing cycle, allowing the timing chip to time the second clock signal provided by the RC oscillator according to the count value stored in the unit timing cycle counter register. The timing calibration control device outputs a timing calibration control signal, which wakes up the external crystal oscillator and controls the first and second counters to start counting synchronously. When the first count value acquired by the first counter equals the counting cycle corresponding to the preset calibration time, the external crystal oscillator stops working, and the first and second counters stop counting synchronously. The second count value acquired by the second counter is then transmitted to the unit timing cycle counter register as the calibrated second count value and stored as the count value corresponding to the unit timing cycle. This chip timing system, by using the synchronous start and stop of the first and second counters, calibrates the count value that the second counter should acquire within the preset calibration time, achieving timing calibration of the RC oscillator inside the timing chip. While ensuring the accuracy of timing calibration, it reduces the power consumption of the external crystal oscillator by waking it up, achieving low-power calibration timing.
[0014] Furthermore, the timing calibration control device is also used to output a timing calibration control signal at each first time interval, so that the count value corresponding to the unit timing cycle stored in the unit timing cycle counter register is updated once every first time interval. This technical solution, by controlling the timing calibration control device to output a timing calibration control signal at each first time interval, causes the external crystal oscillator to be intermittently woken up, reducing the power consumption required for external crystal oscillator calibration. By updating the count value corresponding to the unit timing cycle, the frequency timing of the RC oscillator inside the timing chip can be calibrated periodically, ensuring the timing accuracy of the timing chip.
[0015] This application also provides a chip that includes the chip timing system as described above, the chip timing system performing the timing calibration method as described above. Attached Figure Description
[0016] Figure 1 This is a schematic flowchart of a timing calibration method according to one embodiment of this application. Implementation
[0017] The specific embodiments of the present invention will be further described below with reference to the accompanying drawings. All modules involved in the following embodiments are logic circuit units. In practical applications, a logic circuit unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. Furthermore, to highlight the innovative aspects of the present invention, units that are not closely related to solving the technical problem proposed by the present invention are not introduced in the embodiments of the present invention. However, this does not mean that other units are absent from the embodiments of the present invention.
[0018] This application provides a timing calibration method in some embodiments, which aims to calibrate the clock of the RC oscillator inside a timing chip with low power consumption and high precision. Specifically, as shown... Figure 1As shown, the timing calibration method includes: Step S1: Wake up the external crystal oscillator, synchronously start the first counter and the second counter to perform counting work, and determine in real time whether the first count value obtained by the first counter is equal to the counting period corresponding to the preset calibration time. When the first count value obtained by the first counter is equal to the counting period corresponding to the preset calibration time, proceed to step S2; conversely, when the first count value obtained by the first counter is not equal to the counting period corresponding to the preset calibration time, continue to execute step S1, that is, control the first counter and the second counter to continue to perform counting work; wherein, the first counter uses the first clock signal provided by the external crystal oscillator as the first counting clock source to perform counting work; the second counter uses the second clock signal provided by the RC oscillator inside the timing chip as the second counting clock source to perform counting work. Step S2: When the first count value obtained by the first counter is equal to the counting period corresponding to the preset calibration time, control the first counter and the second counter to synchronously stop performing counting work, and proceed to step S3; Step S3: Use the second count value of the second counter to calibrate the clock of the RC oscillator inside the timing chip. It should be noted that "wake up the external crystal oscillator" refers to waking up the external crystal oscillator from its dormant state and switching it to an operating state, i.e., controlling the external crystal oscillator to operate and provide a first clock signal to the first counter as the first counting clock source. This embodiment uses the first clock signal provided by the external crystal oscillator as the standard clock source, and uses the first count value obtained by the first counter as the standard count value. By synchronously starting and stopping the counting of the first and second counters, the count value that the second counter should obtain within a preset calibration time is calibrated, thereby calibrating the timing of the RC oscillator inside the timing chip. While ensuring the accuracy of timing calibration, waking up the external crystal oscillator reduces the power consumption required by the external crystal oscillator, achieving low-power calibration timing.
[0019] It should be noted that the preset calibration time is a pre-designed time used to limit the duration of timing calibration. The preset calibration time can be, but is not limited to, the unit timing cycle of the timing chip to the internal RC oscillator. For example, when the unit timing cycle of the timing chip to the internal RC oscillator is configured to be 1 second, the preset calibration time is set to 1 second in order to calibrate the timing of the internal RC oscillator. Similarly, when the unit timing cycle of the timing chip to the internal RC oscillator is configured to be 2 seconds, the preset calibration time is set to 2 seconds in order to calibrate the timing of the internal RC oscillator. Preferably, the preset calibration time can also be the product of the unit timing cycle of the timing chip for the internal RC oscillator and a preset specified value, such as half a unit timing cycle, two unit timing cycles, etc. Specifically, when the preset calibration time is configured to be equal to half of the unit timing cycle of the timing chip for the internal RC oscillator, that is, when the preset specified value is half, when the first count value of the first counter reaches the counting cycle corresponding to half of the unit timing cycle of the RC oscillator, the result obtained by dividing the second count value of the second counter by the preset specified value is used to calibrate the internal RC oscillator of the timing chip, effectively speeding up the calibration efficiency and shortening the calibration time. When the preset calibration is configured to be equal to twice the unit timing cycle of the timing chip for the internal RC oscillator, that is, when the preset specified value is equal to 2, when the first counter of the first counter reaches the counting cycle corresponding to twice the unit timing cycle of the RC oscillator, the result obtained by dividing the second count value of the second counter by the preset specified value is used to calibrate the internal RC oscillator of the timing chip. Although the calibration efficiency is reduced by increasing the number of counts to obtain the average calibration, the calibration accuracy can be improved. The counting period corresponding to the preset calibration time is equal to the frequency value of the external crystal oscillator within the preset calibration time. For example, if the frequency of the external crystal oscillator is 32.768MHz and the preset calibration time is configured to 1 second, the counting period corresponding to the preset calibration time is 32768. If the preset calibration time is configured to 2 seconds, the counting period corresponding to the preset calibration time is 32768*2, which is 65536. That is, when the frequency of the external crystal oscillator is X Hz and the preset calibration time is N seconds, the counting period corresponding to the preset calibration time is the product of X and N.
[0020] The timing calibration method provided in some embodiments of this application further includes: repeating steps S1 to S3 at each first time interval, thereby calibrating the timing of the RC oscillator inside the timing chip once at each first time interval. Specifically, during the operation of the timing chip, the clock frequency of the RC oscillator inside the timing chip will deviate due to changes in the chip's operating temperature. This causes the second counter inside the timing chip to be unable to accurately count by the clock frequency of the RC oscillator, thus requiring timing calibration. However, a single timing calibration cannot guarantee the timing accuracy of the timing chip in the long term. The timing calibration method provided in this embodiment, by repeatedly executing the timing calibration method at each first time interval, achieves timed calibration of the clock frequency of the RC oscillator inside the timing chip, effectively improving the timing reliability of the timing chip.
[0021] In some embodiments of the timing calibration method provided in this application, step S2 further includes: when the first count value acquired by the first counter is equal to the counting period corresponding to the preset calibration time, controlling the external crystal oscillator to enter a sleep state, and controlling the first counter and the second counter to stop counting, so that when the first counter stops counting, the first count value is equal to the counting period corresponding to the preset calibration time; wherein, the external crystal oscillator entering a sleep state means that the external crystal oscillator stops working and stops providing the first counting clock source to the first counter. In this embodiment, controlling the first counter and the second counter to stop counting while controlling the external crystal oscillator to enter a sleep state reduces the power consumption required for timing calibration, and achieves the timing calibration work of the RC oscillator inside the timing chip with low power consumption.
[0022] In the timing calibration method provided in some embodiments of this application, step S3, which involves calibrating the timing of the RC oscillator inside the timing chip using the second count value of the second counter, specifically includes: transmitting the second count value of the second counter to the unit timing cycle count memory in the timing chip and storing it as the count value corresponding to the unit timing cycle, so that the timing chip counts the frequency value of the second clock signal provided by the RC oscillator inside the timing chip according to the count value corresponding to the unit timing cycle stored in the unit timing cycle count register, thereby realizing the timing of the second clock signal provided by the RC oscillator inside the timing chip. In the timing calibration method provided in this embodiment, the second count value obtained after calibration by an external crystal oscillator combined with the first counter is updated to the count value corresponding to the unit timing cycle. By updating the count value corresponding to the unit timing cycle, the timing calibration of the RC oscillator inside the timing chip is achieved.
[0023] In some embodiments of this application, the timing calibration method provides a method where the first counter uses a first clock signal provided by an external crystal oscillator as the first counting clock source for counting. Specifically, this includes incrementing the first count value by one for each clock cycle detected by the first counting clock source. The second count value is calculated using a second clock signal provided by an RC oscillator inside the timing chip as the second counting clock source. Specifically, this includes incrementing the second count value by one for each clock cycle detected by the second counting clock source. The timing calibration method provided in this embodiment uses one clock cycle of the first counting clock source as the condition for incrementing the first count value, and one clock cycle of the second counting clock source as the condition for incrementing the second count value.
[0024] This application provides a chip timing system in some embodiments, which aims to use an external crystal oscillator to calibrate the timing of an internal RC oscillator of a timing chip. The chip timing system includes: an external crystal oscillator, a first counter, and a timing chip; specifically, the external crystal oscillator provides a first clock signal to the first counter as a first counting clock source; the first counter receives the first counting clock source from the external crystal oscillator and counts to obtain a first count value, and indirectly calibrates the timing of the timing chip based on the first count value; the timing chip internally includes an RC oscillator, a second counter, a unit timing cycle counting register, and a timing calibration control device; wherein, the RC oscillator provides a second clock signal to the second counter as a second counting clock source; the second counter receives the second counting clock source from the RC oscillator and counts to obtain a second count value, and the second count value, indirectly calibrated based on the first count value, is transmitted as the count value corresponding to a unit timing cycle to the unit timing cycle counting register for storage; the single... The timing cycle register is used to receive and store the calibrated second count value as the count value corresponding to the unit timing cycle, so that the timing chip times the second clock signal provided by the RC oscillator according to the count value corresponding to the unit timing cycle stored in the timing cycle register. The timing calibration control device is used to output a timing calibration control signal, wake up the external crystal oscillator to start working based on the timing calibration control signal, and control the first counter and the second counter to start counting work synchronously. When the first count value obtained by the first counter is equal to the counting cycle corresponding to the preset calibration time, the external crystal oscillator is controlled to stop working and the first counter and the second counter are controlled to stop counting work synchronously. The second count value obtained by the second counter is transmitted as the calibrated second count value to the unit timing cycle register as the count value corresponding to the unit timing cycle and stored. The chip timing system provided in this embodiment utilizes a first clock signal provided by an external crystal oscillator as the first counting clock source for a first counter. A timing calibration control device controls the first and second counters to count synchronously. This allows the first counter to use the accurate frequency provided by the external crystal oscillator as a standard for timing. When the first count value acquired by the first counter reaches the counting period corresponding to the preset calibration time, the second count value acquired by the second counter is equivalent to the calibrated second count value. The timing calibration control device updates the calibrated second count value to the count value corresponding to the unit timing period and stores it, thus achieving internal calibration of the RC oscillator timing within the timing chip. Furthermore, when the first count value acquired by the first counter reaches the counting period corresponding to the preset calibration time, the timing calibration control device controls the external crystal oscillator to enter a sleep state, reducing the external crystal oscillator's operating power consumption and thereby reducing the overall power consumption of the chip timing system, achieving low-power calibration timing.
[0025] In the chip timing system provided in some embodiments of this application, the timing calibration control device is further configured to output a timing calibration control signal at each first time interval, so that the count value corresponding to the unit timing cycle stored in the unit timing cycle counter register is updated once at each first time interval. The update interval of the count value corresponding to the unit timing cycle is the same as the wake-up calibration interval of the external crystal oscillator, both set to the first time interval. The length of the first time interval can be adjusted according to factors such as the frequency drift speed of the RC oscillator during the testing phase.
[0026] In some embodiments of this application, a chip is provided that includes the chip timing system described above, and the chip timing system in the chip performs the timing calibration method described above.
[0027] In the embodiments provided by this invention, it should be understood that the disclosed chip can be implemented in other ways. For example, the chip embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another module, or some features may be ignored or not executed. Although embodiments of the present invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The above embodiments are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A timing calibration method for calibrating the timing of an RC oscillator inside a timing chip, characterized in that, The timing calibration method includes: Step S1: Wake up the external crystal oscillator, synchronously start the first counter and the second counter to count, and determine whether the first count of the first counter is equal to the counting period corresponding to the preset calibration time. If yes, proceed to step S2; otherwise, the first counter and the second counter continue to count. The first counter uses the first clock signal provided by the external crystal oscillator as the first counting clock source, and the second counter uses the second clock signal provided by the RC oscillator inside the timing chip as the second counting clock source. Step S2: When the first count value of the first counter is equal to the count period corresponding to the preset calibration time, the counting of the first counter and the second counter is stopped synchronously, and the external crystal oscillator is controlled to enter the sleep state, and then proceed to step S3; Step S3: The timing of the RC oscillator inside the timing chip is calibrated using the second count value of the second counter. Specifically, the second count value of the second counter is transmitted to the unit timing cycle count register in the timing chip and stored as the count value corresponding to the unit timing cycle. This allows the timing chip to count the frequency value of the second clock signal provided by the RC oscillator inside the timing chip according to the count value corresponding to the unit timing cycle stored in the unit timing cycle count register, thereby realizing the timing of the second clock signal provided by the RC oscillator inside the timing chip. Wherein, the preset calibration time is equal to the unit timing cycle of the RC oscillator inside the timing chip; the counting cycle corresponding to the preset calibration time is equal to the frequency value of the external crystal oscillator within the preset calibration time.
2. The timing calibration method according to claim 1, characterized in that, The timing calibration method further includes: repeating steps S1 to S3 at each first time interval to calibrate the timing of the RC oscillator inside the timing chip once at each first time interval.
3. The timing calibration method according to claim 2, characterized in that, The first counter uses the first clock signal provided by the external crystal oscillator as the first counting clock source for counting, specifically including: the first counter increments the first count value by one every time it detects one clock cycle of the first counting clock source.
4. The timing calibration method according to claim 3, characterized in that, The second counter uses the second clock signal provided by the RC oscillator inside the timing chip as the second counting clock source for counting. Specifically, the second counter increments the second count value by one for each clock cycle of the second counting clock source it detects.
5. A chip timing system, characterized in that, The chip timing system includes: An external crystal oscillator is used to provide a first clock signal to the first counter as a first counting clock source; The first counter is used to receive a first counting clock source provided by an external crystal oscillator to count and obtain a first count value; The timing chip internally includes an RC oscillator, a second counter, a unit timing cycle counter register, and a timing calibration control device; among which, The RC oscillator is used to provide a second clock signal to the second counter as a second counting clock source; The second counter is used to receive a second counting clock source provided by an RC oscillator to count and obtain a second count value. The calibrated second count value is transmitted to the unit timing cycle count register for storage as the count value corresponding to the unit timing cycle. The unit timing cycle counter register is used to store the count value corresponding to the unit timing cycle, so that the timing chip can time the second clock signal provided by the RC oscillator according to the count value corresponding to the unit timing cycle stored in the unit timing cycle counter register. The timing calibration control device is used to output a timing calibration control signal, wake up the external crystal oscillator based on the timing calibration control signal, and control the first counter and the second counter to start counting synchronously. When the first count value obtained by the first counter is equal to the counting period corresponding to the preset calibration time, the external crystal oscillator is controlled to stop working and the first counter and the second counter are controlled to stop counting synchronously. The second count value obtained by the second counter is transmitted as the calibrated second count value to the unit timing period counting register for storage as the count value corresponding to the unit timing period.
6. The chip timing system according to claim 5, characterized in that, The timing calibration control device is also used to output a timing calibration control signal at each first time interval, so that the count value corresponding to the unit timing cycle stored in the unit timing cycle counter register is updated once every first time interval.
7. A chip, characterized in that, The chip includes a chip timing system as described in any one of claims 5 to 6, the chip timing system performing a timing calibration method as described in any one of claims 1 to 4.