Clock calibration
11422585 · 2022-08-23
Assignee
Inventors
Cpc classification
G06F1/04
PHYSICS
Y02D30/70
GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
H04W52/0293
ELECTRICITY
International classification
G06F1/04
PHYSICS
Abstract
A circuit system comprises a processor, a first clock with a first frequency, a second clock with a second frequency, such second frequency being higher than said first frequency and a clock calibration module. The clock calibration module comprises a plurality of counters configured to count cycles of the second clock when triggered. Each of the plurality of counters is configured to be triggered at successive cycles of the first clock. Each of the plurality of counters is configured, after a predetermined number of cycles of the first clock, to output a count of elapsed second clock cycles and the processor is configured to determine, using the counts outputted by the plurality of counters, a ratio between the first frequency and the second frequency.
Claims
1. A circuit system comprising: a processor; a first clock with a first frequency; a second clock with a second frequency, such second frequency being higher than said first frequency; and a clock calibration module comprising a plurality of counters configured to count cycles of the second clock when triggered; wherein each of the plurality of counters is configured to be triggered at successive cycles of the first clock; each of the plurality of counters is configured, after a predetermined number of cycles of the first clock, to output a count of elapsed second clock cycles; the processor is configured to determine, using the counts outputted by the plurality of counters, a ratio between the first frequency and the second frequency, and to use the ratio to perform a calibration of the pre-set number of cycles used by the first clock; wherein the processor is further configured: to determine a value of the ratio between the first frequency and the second frequency using measurements from only a sub-set of the plurality of counters; to determine if an uncertainty parameter of the value is below a threshold and, if the uncertainty parameter is below the threshold, to cut short a calibration of the pre-set number of cycles used by the first clock.
2. The circuit system as claimed in claim 1, wherein at least some counters of the plurality of counters are arranged to count in parallel.
3. The circuit system as claimed in claim 1, wherein the first clock is configured to issue a signal to the processor once a pre-set number of cycles have elapsed.
4. The circuit system as claimed in claim 1, wherein the processor is operable in a lower power state and a higher power state and the processor is configured to perform a calibration of the first clock every time it enters the higher power state.
5. The circuit system as claimed in claim 1, wherein the processor is configured to decide dynamically whether or not to perform a calibration based upon a previously determined ratio.
6. The circuit system as claimed in claim 1, wherein the second clock is powered down when the calibration is complete.
7. The circuit system as claimed in claim 1, wherein the circuit system is configured to extend a calibration if required.
8. The circuit system as claimed in claim 1, wherein the plurality of counters comprises a plurality of hardware counters.
9. The circuit system as claimed in claim 1, wherein the processor is configured to determine an initial value for the ratio using the count outputted by a first counter of the plurality of counters.
10. The circuit system as claimed in claim 1, wherein the plurality of counters comprises at least five counters.
11. The circuit system as claimed in claim 1, wherein the clock calibration module further comprises a ring buffer, to which the counts outputted by the plurality of counters are saved.
12. The circuit system as claimed in claim 1, wherein the processor is configured to provide one or more measurement parameters to the clock calibration module and to vary dynamically the measurement parameters provided to the clock calibration module dependent upon a previously determined ratio.
13. The circuit system as claimed in claim 1, wherein the processor is configured to use the ratio to refine a previous time measurement.
14. The circuit system as claimed in claim 1, wherein the processor is configured to predict a maximum level of drift expected during a period of low power operation.
15. The circuit system as claimed in claim 14, wherein the maximum level of expected drift is adjusted dynamically based upon a previously measured ratio.
16. The circuit system as claimed in claim 1, wherein the first frequency is less than 100 kHz.
17. The circuit system as claimed in claim 1, wherein the second frequency is greater than 1 MHz.
Description
DETAILED DESCRIPTION
(1) Certain preferred embodiments of the invention will now be described, by way of example only, with reference to the accompanying drawings, in which:
(2)
(3)
(4)
(5)
(6)
(7)
(8) The low frequency clock 4 nominally operates at a lower frequency f.sub.1, and the high frequency clock 6 operates at a higher frequency f.sub.2. The counters 10 are configured to, when triggered, count cycles of the high frequency clock 4. The clock calibration module 8 is configured to trigger successive counters 10 at successive cycles of the low frequency clock 4. The clock calibration module 8 is further configured to stop each of the counters 10 after each one has measured a predetermined number M of cycles of the low frequency clock 4, set by the processor 9. The processor 9 is configured to read the contents of the ring buffer 12 and calculate a ratio between the lower frequency f.sub.1 and the higher frequency f.sub.2.
(9) The operation of the clock module 2 will be described with reference to the timing diagram shown in
(10) In general the LF clock signal 14 will be phase offset from the HF clock signal 16, whereby rising edges of each signal do not coincide. This phase offset can be a source of error when calculating the ratio between the lower frequency f1 and the higher frequency f2, especially when measurements are short (e.g. if their length is only a few cycles of the low frequency clock 4).
(11) At a first time 18, a first rising edge of the LF clock signal 14 occurs and the clock calibration module 8 triggers the first counter 10a to begin counting cycles of the HF clock signal 16. At a second time 20, a second rising edge of the low frequency clock occurs. The clock calibration module 8 triggers the second counter 10b to begin counting cycles of the HF clock signal 16. At this point the first counter 10a has counted 18 HF cycles.
(12) At a third time 22, a third rising edge of the LF clock signal 14 occurs. At this point the first counter 10a has counted 35 cycles and the second counter has counted 17 cycles. The clock calibration module 8 stops the first counter 10a and triggers the third counter 10c. The count from the first counter 10a is stored in the ring buffer 12.
(13) Although not shown in
(14) This measurement process is shown in
(15) As shown by the dotted line 212, the measurement process optionally comprises steps 214 and 216. The processor 9 is able to read the contents of the ring buffer 12 at any time and as such, in addition to reading the contents of the ring buffer 12 once all four counters 10a-d have provided a measurement, the processor 9 is also able to read the ring buffer 12 when only N counters have provided a measurement, where N is less than four.
(16) At step 214, the processor 9 calculates an intermediate value of the ratio between the lower frequency f1 and the higher frequency f2, using the average of the N measurements that are available. While this intermediate value is likely to be less accurate than one determined using measurements from all of the counters 10a-d, it may still indicate a definitive ratio. In order to establish whether the intermediate value is definitive, the processor 9 may calculate a measure of statistical dispersion (e.g. a variance) of the measurements in the ring buffer 12, and compare this to a threshold value of statistical dispersion when deciding if a determined value of the ratio is definitive.
(17) If the intermediate value for the ratio is definitive, the processor 9 may cut short any further measurements by stopping any counters 10a-d that have not yet been stopped to prevent unnecessary further power use. If the intermediate value for the ratio is not definitive, the process returns to step 204. An intermediate value for the ratio may not be calculated on every rising edge of the LF clock signal 14.
(18) While in this case the counters 10a-d count the number of cycles of the high frequency clock 6 taken for two low frequency clock cycles to elapse, this may be set by the processor to any number of low frequency clock cycles. Counting a greater number of low frequency cycles reduces the effects of any phase difference between the LF clock signal 14 and the HF clock signal 16 on the measured ratio, as the error caused by the initial rising edge offset is averaged across many cycles.
(19)
(20) The modem 102 may be provided as part of a battery powered mobile communication device (not shown), for example a smartphone or an ‘Internet of Things’ connected smart device. In such cases the input/output module 8 provides means for communication with other elements of the device, for example a display or a sensor (not shown). It is desirable, particularly when provided as part of a battery powered device, to decrease the power demands of the modem 102 so as to increase battery life.
(21) The modem 102 is operable to send and receive data from a network (not shown) via an antenna 116 and the transceiver module 110. Data received by the modem 102 is decoded by the processor 104 and may be sent onto other components of the device in an understandable format via the input/output module 108.
(22) In use, the processor 104 executes various tasks, for example controlling discontinuous reception (DRX) operation of the transceiver module 110. In such operation the processor 104 controls the transceiver module 110 to periodically receive data from the network, in short prearranged time slots, and to power down in between. DRX operation can reduce the power demands of the modem 102 significantly compared to continuous reception operation (where the transceiver module 110 is continually powered), however to achieve reliable and effective operation the processor 104 must issue control commands at precise times to synchronise the reception periods properly with the network.
(23) As described above, the clock module 2 comprises a low frequency clock 4 (such as an RC oscillator), a high frequency clock 6 (such as a crystal oscillator) and a clock calibration module 8.
(24) During ordinary operation, the processor 104 is fully powered and uses the high frequency clock 6 for timing. However in order to reduce the power used by the modem 102, when the processor 104 is not in use (i.e. when it is not executing a task), the processor 104 enters into a lower power sleep state where one or more modules or circuits are switched off. There can often be long periods of time between tasks being executed, and so this measure can decrease power use significantly.
(25) The high frequency clock 6 is switched off in the lower power sleep state, and instead the low frequency clock 4 is used to keep time.
(26) The low frequency clock 4, however, is not entirely reliable. Between and during periods of sleep, the frequency of the low frequency clock 4 may drift from its nominal value, such that times measured by the low frequency clock 4 vary. To be confident of executing a task (e.g. starting a receiver for a DRX reception time slot) at precisely the correct time, the processor 104 may, on entry to the higher power state, measure the frequency of the low power clock 4, and use this measurement to determine and compensate for any drift that has occurred during the preceding period of low power operation. This allows the processor 104 to execute the task at precisely the right time This frequency measurement is achieved by comparing the frequency of the low frequency clock 4 to that of the high frequency clock 6. Higher frequency clocks are generally less susceptible to drift and so are suitable to use as reference clocks.
(27) The ratio of the frequencies is be determined by the processor 104 during a period of high power operation. The clock module 2 is operated as described above, such that the ring buffer 12 contains measurements of the number of the high frequency clock cycles taken for a number, predetermined by the processor 104, of low frequency clock cycles to elapse. The processor 104 reads the contents of the ring buffer 12 and uses it to determine a ratio between the frequency of the low frequency clock 4 and that of the high frequency clock 6. This ratio can be compared to a previously measured (or provided) value to identify the amount of drift that has occurred.
(28) In order to reduce the effects of jitter and other factors (e.g. phase offset from the HF clock signal 16) impacting the LF clock signal 14 and therefore the ratio determined by the processor 104, the processor 104 may calculate an average of the entries in the ring buffer 12, and use this average to determine the ratio.
(29) The processor 104 can in fact read the contents of the ring buffer 12 at any time, including during a calibration. The processor 104 can therefore quickly produce a first estimate of the ratio using only a count from the first counter 10a or the first few counters (e.g. using counts from the first and second counters 10a, 10b). If the first estimate of the ratio definitively shows no drift has occurred since the previous calibration, the processor 104 may cut the calibration short, instructing the clock calibration module 8 to stop all the counters 10a-d. By reducing the length of time taken for a calibration, the total amount of time the processor 104 must spend in the higher power state may be reduced.
(30) Once the processor 104 has determined the current ratio between the frequencies of the low and high frequency clocks 4, 6, it can adjust timings made by the low frequency clock 4 to ensure that the task is executed at the correct time.
(31) This process of calibrating the low frequency clock 4 may be carried out during every period of high power operation. However if the processor 104 determines from a calibration that no or negligible drift has occurred since a previous calibration, it may not perform a calibration following the subsequent period of low power operation, saving power by reducing the amount of time the processor 104 is in the higher power state.
(32)
(33) At a subsequent time 420, after the DRX reception period 416 has ended, the modem enters the low power state 410. This process is repeated as operation of the modem 102 continues.
(34) It will be appreciated by those skilled in the art that the invention has been illustrated by describing one or more specific embodiments thereof, but is not limited to these embodiments; many variations and modifications are possible, within the scope of the accompanying claims.