Patent Publication Number: US-2016241248-A1

Title: Single insertion trimming of highly accurate reference oscillators

Description:
BACKGROUND 
     The techniques described relate to the trimming and calibration of oscillators, and more particularly highly accurate oscillators which can serve as clock references in electronic platforms. 
     Clock reference oscillators must provide a highly stable output frequency versus the variation of the different electrical and environmental conditions such as and not limited to supply voltage, temperature, stress, humidity and aging. The trimming of such oscillator is imperative to achieve high performance. 
     The ever increasing complexity of electronic systems due to requirements of supporting multiple standards, increased functionality, higher data rates and memory in a smaller size and at a lower cost is pushing designers to increase the integration level through the development of Systems on Chip (SoC) in deep submicron Complimentary MOS (CMOS) technologies to benefit from the increased gate density. Every application requires a reference clock where the oscillator frequency must not vary due to changes in supply voltage and temperature by more than a specific amount. 
     Quartz crystal oscillators (XOs) are the industry standard for generating a reference clock. The mature and stable technology of quartz crystals permits excellent control on the manufacturing process to select an exact cut angle to produce superior performance. Crystal oscillators stemming from the very high quality factor (Q) of the quartz crystal can achieve high frequency accuracy, low frequency drift with temperature and low phase noise. Consequently, crystal oscillators dominated the commercial market for many decades. However, crystals have not managed to scale nor integrate thus limiting the size and cost reduction of the reference clock. 
     Recent efforts in using high-Q Micro-Electro-Mechanical Systems (MEMS) resonators and Film Bulk Acoustic Resonators (FBARs)Error! Reference source not found. have illustrated possibilities of integrating a high-Q element and Application Specific Integrated Circuits (ASIC) in the same package. The cost of a MEMS resonator is lower than a quartz one owing to the very high number of resonators on a single MEMS wafer. Expensive ceramic packaging of crystal oscillators is also reduced to low cost plastic packaging. However, the assembly cost of a MEMS-based solution requires stacking of the wafer level packaged MEMS die and the CMOS die. Additionally, elaborate production testing is required to trim each part to the required performance over the specified temperature range. This process may require more than one temperature insertion to estimate the temperature compensation parameters and to adjust the oscillator frequency to the required value. This makes the testing cost of MEMS and FBAR oscillators too high to compete with XOs for consumer applications. 
     Another approach is to produce reference clocks using RC oscillators. Due to the low quality factor of an RC oscillator the frequency accuracy is limited, but excellent power consumption and full integration can be achieved, making this solution suitable for applications like wireless sensors networks (WSN). However, the testing cost of RC oscillators like MEMS and FBAR oscillators is very high due the extensive trimming which usually requires more than one temperature insertion point. 
     An alternative technology uses an all silicon CMOS reference clock based on an on-chip LC-tank. Such solutions are by definition highly integrated and have short lead times due to their programmability compared to XOs. Moreover, they can provide frequency accuracy and phase noise performances comparable to XOs. However, the large temperature dependence of LC-tanks has been the main challenge in designing an LC-tank based reference which requires sophisticated compensation techniques to neutralize the frequency variation. To successfully achieve the required accuracy in compensation it is imperative not just to have an accurate temperature measurement but to also have precise knowledge of the oscillator frequency across temperature and its frequency tuning control(s). 
     One trimming routine starts by selecting a center frequency (f 0 ) at a first temperature using a capacitor bank. Then at a second temperature the algorithm couples one or more resistances to the resonator as a method of temperature compensation. After that at a next temperature, the algorithm determines whether the required calibration has occurred over the predetermined temperature range or not. In case of not achieving the required performance the previous steps have to be redone iteratively until the total temperature dependence of the oscillator is minimized over the predetermined temperature range while attaining the required output frequency. Consequently, more than one temperature insertion point is required to achieve acceptable performance thus increasing the complexity of product testing and consequently increasing the overall cost of the product. 
     An all silicon CMOS reference clock is described in U.S. Pat. No. 8,072,281. It uses an on-chip LC-tank designed to operate at a very specific low temperature-sensitivity phase operating point. Thus, the architecture is applicable to a Self-Compensated Oscillator (SCO) that is self-compensated across temperature. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWING FIGURES 
       The present invention may be understood from the following detailed description in conjunction with the appended drawing figures. In the drawing: 
         FIG. 1(A)  is plot illustrating the concept of a temperature null and corresponding phase. 
         FIG. 1(B)  is a plot of frequency variation over temperature when operating at the temperature null, for different temperature ranges. 
         FIG. 2  is a diagram of a temperature-compensated LC oscillator. 
         FIG. 3  is a diagram illustrating temperature modulation for purposes of determining temperature sensitivity of oscillation frequency. 
         FIG. 4  is a diagram of a calibration system for determining temperature sensitivity. 
         FIG. 5  is a diagram of another calibration system for determining temperature sensitivity. 
         FIG. 6(A)  is a diagram illustrating in circuit form how a phase shift calibration value may be determined. 
         FIG. 6(B)  is a diagram illustrating operation of the circuit of  FIG. 6(A) . 
         FIG. 7(A)  is a diagram illustrating in circuit form a different way of determining a phase shift calibration value. 
         FIG. 7(B)  is a diagram illustrating operation of the circuit of  FIG. 7(A) . 
         FIG. 8  is a diagram illustrating in circuit form how a frequency setting calibration value may be determined. 
         FIG. 9  is a flow chart of a calibration process. 
         FIG. 10  is a diagram illustrating in circuit form a different way of determining a frequency setting calibration. 
         FIG. 11  is a diagram of a calibration system for determining both phase shift and frequency setting calibration values. 
         FIG. 12  is a diagram of another calibration system for determining both phase shift and frequency setting calibration values. 
         FIG. 13(A)  is a diagram of a heater element. 
         FIG. 13(B)  is a diagram of another heater element; 
         FIG. 14  is a diagram of oscillation, compensation and sensing circuitry. 
         FIG. 15  is a diagram of temperature modulation circuitry. 
         FIG. 16  is a diagram of another temperature modulation circuit. 
         FIG. 17  is a diagram of still another temperature modulation circuit. 
         FIG. 18  is a diagram of a frequency-to-digital converter. 
         FIG. 19  is a diagram of another frequency-to-digital converter. 
         FIG. 20  is a diagram of a generalized temperature compensation system. 
         FIG. 21  is a diagram of a generalized calibration system for temperature compensation system. 
     
    
    
     DETAILED DESCRIPTION 
     Summary 
     A self compensated oscillator architecture utilizes phase shift circuitry to achieve minimum frequency deviation across temperature. It provides an electrical phase shift that is accurate, temperature independent and programmable through a digital phase setting (PS) word. The SCO requires trimming to get an optimum operating phase setting (PS opt ) in the predetermined temperature range and to adjust the oscillator output frequency to a target frequency by setting the oscillator&#39;s frequency setting (FS). 
     In one embodiment, an SPT alogorithm is provided for the SCO, thus reducing the testing cost while achieving high frequency stability. The present appartus is capable of finding the optimum phase operating point and of adjusting the oscillator frequency to the required value simultaneously. Thus it provides a robust, fast and low cost trimming solution for SCO thus decreasing the complexity of product testing and consequently decreasing the overall cost of the product. 
     DESCRIPTION 
     An LC oscillator is composed of an LC-Tank. and an amplifier which is responsible for overcoming the tank losses. For the oscillator to have sustained oscillations the Barkhausen criterion requires an open loop gain greater than unity and phase equal to zero. Assuming that the used amplifier contributes a zero phase thus, at oscillation conditions, the LC-Tank impedance Z Tank  will have a zero phase. Error! Reference source not found.(B) shows Z Tank  phase versus frequency at different temperatures; a zero phase intersection with the tank phase curves over temperature (0° C.-70° C.) results in a large frequency variation Δf 1 . As seen in  FIG. 1(A) , the tank phase curves across temperature intersect at a negative phase where frequency variation across temperature is minimized (frequency variation Δf NULL ). 
     The conditions at which minimum temperature sensitivity of frequency occurs is termed the LC-tank temperature null (T NULL ) and the phase across the tank is referred to as φ NULL . As shown in Error! Reference source not found, the oscillator may be formed of a transconductor stage  201  and a phase shift stage  203 . Phase magnitude is controlled via a digital phase setting (PS) word with very fine steps, while the oscillator frequency is tuned by changing the effective capacitance value of the tank impedance (Z Tank )  205  using a frequency setting (FS) word with very fine steps. At steady state, the transconductor and phase shifter provide a phase that is the negative of the required T NULL  phase. Thus, the LC-tank is forced to oscillate at the required non-zero φ NULL . One of the most important design aspects of the phase shift circuitry is to provide a phase that is accurate and temperature independent, otherwise frequency deviation will increase. 
     The SCO relies on operating at φ NULL  to achieve a high frequency stability across a specific temperature range. However, the value of φ NULL , will vary with process, oscillation frequency and the required operating temperature range. Thus, trimming is required to compensate for these variations. Trimming is one of the main challenges in having a highly accurate and fully-integrated LC-based reference oscillator as it can limit the overall cost and accuracy of the oscillator. The main objective of the trimming of the SCO is to set the oscillator&#39;s phase to φ NULL  and at the same time adjust the oscillator&#39;s frequency to the required output frequency. 
     There are many challenges to develop an accurate, robust and cost effective trimming solution for SCO. The first challenge is that a direct method for measuring the tank phase across temperature to determine directly the value of φ NULL  does not exist. Consequently, the brute force solution to find φ NULL  is to measure the oscillator&#39;s frequency while varying PS at the two extreme temperature points of the required operating range. The tank PS that minimizes the absolute frequency difference between the two extreme temperature points is considered the global φ NULL . However, this two temperature point trimming solution is not cost effective due to the high cost of the two required temperature insertions. Additionally, a very long testing time is usually required for a large number of accurate frequency measurements. The second challenge is that φ NULL  slightly changes as the oscillator&#39;s frequency changes. Moreover, the oscillator&#39;s frequency depends on the tank PS word. Thus, this coupled relation between the oscillator&#39;s frequency and the oscillator&#39;s temperature dependence imposes multiple trimming iterations to find φ NULL  and to adjust the oscillator&#39;s frequency to the required value simultaneously. 
     The following robust on-chip SPT algorithm overcomes these two challenges and enables achieving a highly accurate and cost effective SCO reference oscillator. Trimming is required to set PS opt  so that the oscillator operates at φ NULL  with minimum frequency deviation across temperature, and at the same time adjusts the oscillator frequency to the required frequency by setting the oscillator&#39;s FS. The trimmed value of PS and FS are digitally stored on a non-volatile memory for future retrieval such as a One-Time Programmable (OTP) Read Only Memory (ROM) on chip after trimming. 
     SCO Temperature Sensitivity (K T ) Detection 
     Conceptually, the temperature dependence of any oscillator can be estimated at T o  by applying a square wave temperature modulating signal as shown in Error! Reference source not found. The output of an oscillator  301  in response to the temperature modulating signal will be a frequency modulated (FM) signal that depends on the frequency versus temperature dependence slope (K T ) at this temperature. The oscillator frequency (F osc ) can then be converted into a digital word (D osc ) using an accurate frequency-to-digital converter (FDC)  303  that performs FM demodulation to the oscillator output. The value of K T  at T o  can be estimated from the frequency difference F osc (T o +ΔT/2)−F osc (T o −ΔT/2) where ΔT represents a variation in temperature around T o . Equivalently, the difference between D osc (T o +ΔT/2) and D osc (T o −ΔT/2) can be utilized to generate the same estimate. 
     The difference between these two digital words gives an accurate digital representation of K T  that is utilized in the present SPT trimming algorithm. The concept is illustrated in Error! Reference source not found. where K T  of the SCO is estimated using a temperature modulating signal and an FDC. At φ NULL , the SCO temperature dependence can be parabolic-like and T o  is the center of the required temperature range as illustrated previously in Error! Reference source not found.(B). Thus at T o , if K T =0 would imply a minimum SCO oscillation frequency temperature variation across a specific temperature range. 
     Different methods of temperature modulation of oscillators may be used to determine their temperature sensitivity K T  for single insertion temperature point trimming. In one embodiment, on-chip heaters are used to generate different temperature modulation waveforms. The temperature modulation waveform can be any shape including sinusoidal, triangular, saw tooth or square waveform. The example demonstrates a square or an ON/OFF modulating waveform. This approach can be easily extended to trim other reference oscillators including TCXO, MEMS, FBAR, and RC oscillators. 
     The architecture may employ a simple ON/OFF temperature modulation, thus simplifying the temperature modulation module. Practically, the thermal modulation frequency is limited by the thermal time constant of the packaged part under test. Thus, the temperature modulating square wave is low pass filtered as illustrated in Error! Reference source not found. A temperature modulation module  401  applies temperature modulation to an oscillator  403  under control of a digital controller  405 . An output signal of the oscillator is applied to an FDC  407 . A temperature sensitivity detection module  409  uses an output signal of the FDC  407  and an excitation signal from the digital controller  405  to determine K T . 
     The thermal time constant depends on many factors mainly die size and package size. As the thermal modulation frequency decreases, the trimming routine becomes slower. Thus, testing cost increases, impacting the overall cost of SCO. Consequently, it becomes very important to reach PS opt  that is equivalent to φ NULL  in a minimum number of thermal modulation cycles. Oscillator&#39;s thermal and flicker phase noise affect the accuracy of the SPT especially when K T  approaches zero as the magnitude of the demodulated signal becomes very close to zero too. 
     The impact of phase noise at very low frequency offsets on K T  is insignificant as sensing K T  depends on the difference between two frequencies. Thus, most of the noise will be cancelled. However, phase noise at high frequency offsets is effective and can be suppressed by incorporating an integrate and dump filter. Only half of the heating and cooling periods are utilized by the integrate and dump filter due to the low pass filter effect induced by the slow thermal time constant of the package under test. A set percentage of the heating cycle period is integrated into A hot  while a similar percentage of the cooling cycle period is integrated into A cold  as shown in Error! Reference source not found. The difference between A hot  and A cold  is thus a digital word that represents K T  more accurately in the presence of oscillator phase noise and a large thermal time constant. In this manner, only phase noise at frequency offsets close to the modulation frequency can slightly affect the accuracy of K T  sensing and consequently the results of SPT. 
     Another method for finding the K T . of any oscillator at T o  is illustrated in Error! Reference source not found. As compared to  FIG. 4 , a triangular excitation signal is used to obtain a triangular temperature modulation characteristic. A temperature excitation signal superimposed over T o  is applied to the oscillator through a temperature modulation module. The oscillator frequency will act in response to the temperature modulation signal according to its characteristic K r . The FDC will convert the oscillator frequency into a digital word (D osc ). If the excitation signal is a triangular wave, then Δf/ΔT can be obtained using a difference block  501 . During the negative slope of the triangular wave ΔT is negative so the output of the difference block  501  is multiplied by the slope sign of the triangular wave using a multiplier  503  to finally obtain a digital word that accurately represents K T  at T o . The difference block  501  helps to filter out the close-in phase noise of the oscillator while an Integrate &amp; Dump filter  505  is used to suppress high frequency noise. Consequently, K T  can be measured more accurately. This triangular wave modulation enables using a higher thermal modulation frequency over a square wave modulation technique, consequently a faster trimming routine. (The structure  550  is reused as structure  2150  in  FIG. 21 , described below.) The challenge in this method is to accurately modulate the temperature using a triangular wave; such a requirement may be taken into account in design of the temperature modulation module. 
     SCO Phase Trimming Algorithm 
     An objective of the phase trimming algorithm is to search for PS opt  that adjusts the SCO K T  to a user&#39;s slope control word (KCW). The selection of KCW depends on the operating T o , the predetermined temperature range and the desired SCO temperature dependence curve. Usually a value of KCW that is equal to zero or very close to zero is used to optimize the SCO temperature dependence using room temperature only (RTO) trimming (T o =25° C.) for the different temperature ranges illustrated in Error! Reference source not found.(B). Running the trimming routine at room temperature is highly valuable as it reduces the overall testing and trimming cost of the product. 
     One method to find PS opt  is to sweep PS and measure its corresponding K T  to select PS opt  which gives K T =KCW. However, we may need 2″ modulation cycles to find PS opt , where n is the number of bits of the PS word. Consequently, this method will consume a lot of time thus increase production testing time and cost. A successive approximation register (SAR) trimming algorithm is adopted to minimize the number of modulation cycles involved in the trimming to n modulation cycles. Error! Reference source not found.(A) illustrates a block diagram of the present SAR trimming algorithm. The binary search process is illustrated in Error! Reference source not found.(B). The algorithm starts by loading an initial phase setting (PS initial ) into an output accumulator  601  and loading an initial step into a SAR  603 . Usually PS initial  is set to middle of phase setting PS range, but the setting can be chosen to reduce the convergence time. Temperature sensitivity K T , previously determined, is subtracted from a control word KCW by a block  602 , and the result is applied to a sign detection, circuit  605 . Second, after one modulation cycle the sign of K T  is detected by the block  605  and inverted then multiplied by the SAR step using a multiplier  607 . The output of the multiplication is then added to PS initial  to produce PS next . The operation of the algorithm requires n cycles to reach PS opt  where the SAR step is halved after each cycle to complete the binary search. 
     Slope control word KCW is an input parameter to the trimming algorithm specifying a specific slope criterion to, search for, and the trimming algorithm starts searching this criterion just by changing the PS of the oscillator. The relation between PS opt  and KCW is a result of the algorithm, which assumes that there is a single PS that satisfies PS opt  where the behavior of the oscillator is a specific shape with a specific slope around T o  defined by KCW. The design of the oscillator may be such that at PS opt , the behavior of the oscillator has a specific shape, for example a parabola or an inverted sine. Based on the knowledge of the shape, the trimming algorithm starts searching for PS opt  by means of the slope of the expected shape around T o . For instance, if the expected shape is a parabola, the trimming algorithm searches for a KCW=0 around T o . If the expected shape is an inverted sine, the trimming algorithm searches for a KCW&gt;0 around T o . 
     The SAR algorithm saves a lot of time compared to extensive sweep techniques, but it depends only on the sign of K T  and ignores its magnitude. The magnitude may be very helpful to minimize the number of cycles of the algorithm. Error! Reference source not found.(A) illustrates a block diagram of a least mean square (LMS) trimming algorithm that utilizes both the sign and magnitude of K T  to reach PS opt  faster than the SAR algorithm. Similar to the SAR algorithm, the LMS algorithm starts by loading PS initial  into the output accumulator  701 . Temperature sensitivity K T , previously determined, is subtracted from a control word KCW by a block  702 , and the result is applied to a multiplier circuit  707 . After each modulation cycle K T  is detected and inverted then multiplied by an LMS gain factor (multiplier  707 ). The LMS gain factor may be constant or variable. Its defines the convergence speed, the steady state error and the stability of the loop. When a large step size is used, the adaptation process converges faster, but it would have a greater steady state error and lower phase margin. After each modulation cycle, the value of PS gets closer to PS opt  and the magnitude of K T  gets closer to KCW. The operation of the algorithm is finished when the magnitude of K T  is smaller than a certain value defined by the user or after certain number of cycles defined by the user. 
     SCO Frequency Trimming 
     Different methods and apparatus may be used to trim the FS of the oscillator to adjust its output frequency as discussed. Error! Reference source not found. shows a generic block diagram of a digital phase locked loop (DPLL) and a digital frequency locked loop (DFLL) depending on the type of the loop filter. An FDC  801  will convert the oscillator frequency into D osc . The FDC uses an external reference clock whose frequency is equal to F ref . The reference clock is assumed accurate and it is frequency stable during trimming as the oscillator output frequency will be referenced to it. The FDC output (D osc ) is subtracted from the user frequency control word (FCW) at block  803  to give a digital word that represents the frequency error (f e ) between the oscillator frequency (F osc ) and the target required frequency (FCW F ref ). The output of the subtraction f e  is filtered via a digital loop filter  805  to control FS of the oscillator  807 . The accumulator of the digital loop filter may be loaded with an initial frequency setting (FS Init ) to speed-up the frequency settling. The loop will settle when the oscillator&#39;s frequency is equal to the target required frequency (F osc =FCW F ref ) at steady-state. Note if the digital loop filter is only an accumulator then the DPLL loop will turn into a DFLL. The settling time of the DPLL can be faster than a DFLL, but the advantage of a DFLL is being unconditionally stable. 
     SCO Simultaneous Phase and Frequency Trimming 
     As has been explained previously, the coupled relation between the oscillator&#39;s frequency and oscillator&#39;s optimum phase has represented a major challenge for the trimming of the integrated oscillators and has required multiple trimming iterations. Phase trimming is much slower than frequency trimming as it is limited by the slow thermal time constant of the packaged part under test. 
     Error! Reference source not found. illustrates a flowchart of an iterative trimming routine for the SCO. At block  901 , the iterative trimming routine is started by frequency trimming of the SCO by selecting a certain FCW that defines the oscillator frequency locked in DPLL as (F osc =FCW.f ref ). The second step ( 903 ) is the single temperature point trimming of the SCO by selecting a certain KCW using a K T  detection module followed by SAR or LMS trimming algorithm to search for PS opt . During this process, the DPLL is disabled where the oscillator is not locked anymore and the FDC is used now within the K T  detection module. After several temperature modulation cycles, the SAR or LMS algorithm selects PS opt . However, changing the value of PS will change the output frequency of the oscillator besides changing its temperature performance. This means that the value of FS of the oscillator needs to be readjusted again using the DPLL ( 905 ). 
     Finally, the oscillator&#39;s performance across temperature is checked using the K T  detection module ( 907 ). If the performance is acceptable ( 909 ) both FS and PS parameters are programmed in the OTP ROM ( 911 ). However, the oscillator performance across temperature may be deteriorated after the second frequency trimming step. This happens because the optimum phase operating point φ NULL  is changed when FS is changed. Consequently, the single temperature point trimming of the SCO has to be repeated again. In conclusion, this conventional trimming routine, even though it employs a single temperature insertion point, requires several iterations and thus increases the production testing time and accordingly increases the overall product cost. 
     In order to minimize the testing time, it is necessary to eliminate multiple phase trimming iterations. The techniques described herein overcome the disadvantages of the iterative trimming routine and performs simultaneous trimming of the oscillator temperature sensitivity and output frequency by controlling both PS and FS at the same time. The DPLL is used to adjust its output frequency to the required frequency. The DPLL will force the oscillator frequency to be FCW.f ref , now the oscillator is locked to that frequency and not free running anymore. A simple ON/OFF temperature modulation is applied to the oscillator. The frequency of the temperature modulation is too low because of the large thermal time constant and it is much smaller than the bandwidth of the DPLL. Consequently, the loop will track the slow changes due to temperature so that the oscillator frequency remains constant while the oscillator FS will invert any low frequency temperature modulation. In this way, the DPLL performs the required frequency demodulation process instead of the FDC while preserving the oscillator frequency to the required frequency. Modified operation of the circuitry of  FIG. 8  is illustrated in  FIG. 10 . 
     The FS will be used as an input to the K T  detection module. The second half the heating period is integrated into A hot  while the second half the cooling period is integrated into A cold  as shown in Error! Reference source not found. Then the difference between A hot  and A cold  is a digital word that accurately represents K T . At the end of each modulation cycle (heating then cooling) the output of the K T  detection module is used in the SAR/LMS trimming algorithm to find the new PS. As has been mentioned before, changing PS will change the oscillator frequency. However, the DPLL will rapidly lock to the required target frequency FCW.f ref  in a period much smaller than half the heating period. Moreover, the settling of the DPLL does not affect the operation of K T  detection module because it starts integration in the second half of the heating period where the ADPLL is settled and it depends on the difference between A hot  and A cold  rather than their absolute value. Now both loops are working at the same time to search for the PS opt  at the required frequency FCW.f ref , thus canceling the need for several iterations required in the conventional trimming routine. 
     Error! Reference source not found.Error! Reference source not found. shows the top-level diagram of the SPT with simultaneous phase and frequency trimming. The digital Implementation of the SPT module is highly programmable to accommodate different oscillators with different characteristics. A serial input/output (I/O) interface is used to communicate with the chip to set different programmable parameters. It utilizes a single insertion temperature point and employs on-chip heaters in the temperature modulation module to measure the oscillator temperature sensitivity K T . Moreover, it utilizes smart algorithms including SAR and LMS algorithms rather than extensive sweeps to provide a fast, robust and low cost trimming algorithm. At the end of the trimming routine, the oscillator trimmed parameters PS and FS are programmed in a OTP ROM module. The OTP ROM is used to hold the value of these parameters in normal operation after trimming is done. 
     In  FIG. 11 , a temperature modulation module  1102  applied temperature modulation to an oscillator  1107  under control of a trimming algorithm  1104  having as an input KCW. An output frequency of the oscillator  1107  is detected using a frequency-to-digital converter  1101  having as an input a reference frequency F ref . The detected frequency is filtered by a DPLL filter  1105 . An output of the DPLL is input to an FS register  1109 , the value of which is applied to the oscillator  1107 . The output of the DPLL is also output to a K T  detection module  1111 , which detect the value of K T  and applies it to the trimming algorithm  1104 . The trimming algorithm determines a value of PS and stores it in a PS register  1113 , the value of which is applied to the oscillator  1107 . 
     The PS register is used to hold the value of the phase setting factor of the SCO or the temperature compensation parameter in any other oscillator. PS is adjusted to obtain an oscillator with minimum frequency variation with temperature. The FS register is used to hold the value of the frequency setting of the oscillator and is used to tune the oscillator to the required frequency. 
     However, the use of the DPLL as a frequency demodulator may not be suitable for some oscillators where the relation between FS and output frequency suffers from high non-linearity. This may be the case when the capacitor bank of the oscillator is split into a coarse/fine capacitor bank with overlapping ranges. For such oscillators, the simultaneous operation of the DPLL and phase trimming algorithm may not converge do to the non-linearity of FS. 
     SCO Interleaved Phase and Frequency Trimming 
     In the case just mentioned, a slightly different approach may be followed. In this approach, the FDC will be used again as a frequency demodulator and its output will be the input of the K T  detection module as shown in Error! Reference source not found. 
       FIG. 12  differs from  FIG. 11  in that in  FIG. 12 , the K T  detection module receives an output of the FDC  1201  directly, while the oscillator is not locked. As has been mentioned before, PS is changed after each temperature modulation cycle. The DPLL will be enabled for half the heating period of the modulation cycle and is started to reacquire the required frequency FCW.f ref . Afterwards, the DPLL is disabled and the oscillator becomes free-running again to respond to the temperature modulation as the K T  detection module is insensitive to the absolute frequency of the oscillator. The time-interleaving operation of the two trimming loops allows searching for PS opt  at the required frequency FCW.f ref , thus it eliminates the imperative iterations of the conventional trimming routine and overcomes the non-linearity of the frequency tuning of digitally controlled oscillators. 
     The techniques described herein provide a smart, robust, and all-digital trimming solution for SCO thus decreasing the complexity of production testing and consequently decreasing the overall cost of the product. 
     Temperature Modulation Module Implementations 
     Different methods and apparatus may be used to modulate the chip temperature using integrated techniques. Error! Reference source not found.(A) shows a circuit implementation of an on-chip heater cell using only an NMOS transistor N 1 . The amount of heat generated is controlled by analog voltage (V ctrl ). The implementation of Error! Reference source not found.(B) adds a resistance (R) in series with the NMOS transistor in order to limit the current. Many heater cells H 1 -Hn may be distributed around the oscillator, for example an inductor L, which is coupled to other oscillator circuitry  1401  as shown in Error! Reference source not found. A temperature sensor  1403  is located in proximity. An objective of this configuration is to achieve a suitable temperature field across the oscillator. The generated heat will increase the temperature of the chip on average by ΔT, the magnitude of ΔT depends on many factors including but not limited to: number of heater cells, die area, package type and package volume. This configuration can be used to make ON/OFF temperature modulation by setting V ctrl  to ground or supply voltage. 
     Error! Reference source not found. shows a block diagram of an analog temperature modulation in which the temperature modulation can be accurately controlled. It employs a temperature sensor  1503  to sense the chip temperature and convert it into an analog voltage (V temp ). The relationship between the chip temperature and V temp  is linear. This voltage is subtracted from a user set voltage (V set ) from an Analog Waveform Generation Module (AWGM)  1505 , then amplified using the error amplifier  1507  whose gain equals to (K a ). An output signal of the error amplifier  1507  is used to control heater cells H 1 ′-Hn′. The negative feedback loop will force the heaters to generate the required amount of heat so that V temp  equals to V set . The loop stability is maintained due to the presence of the very low frequency dominant pole of the heaters. In this manner, the temperature of the chip may be controlled linearly and accurately using V set . Different temperature modulation waveforms can be easily generated in the voltage domain using the AWGM. 
     In order to have precise control on the temperature modulation waveform, AWGM is replaced by a Digital Waveform Generation Module (DWGM)  1605  and a Digital to Analog Converter (DAC)  1606  as shown in Error! Reference source not found. The implementation of the DWGM is much simpler than AWGM. 
     Error! Reference source not found. shows a block diagram of a digital temperature modulation module. It employs a digital temperature sensor  1703  to sense the chip temperature and converts it into a digital word (D temp ). Similar to the analog temperature modulation module, D temp  is subtracted (block  1704 ) from a user set digital word (D set ) generated by a Digital Waveform Generation  1705  then multiplied by gain equal to (KO using an amplifier  1701  to control the heaters though a DAC  1706 . 
     Frequency to Digital Converter (FDC) Implementations 
     The function of the FDC is to measure the frequency of a clock and convert it into a digital word. The main specifications of the FDC are as follows: 
     (1) Frequency Resolution (f res ) 
     (2) Sampling Frequency (f s ) 
     (3) Dynamic Range 
     Different techniques may be used to design an FDC. Error! Reference source not found. shows a block diagram of a counter based FDC. A counter  1801  is clocked with the oscillator frequency (F osc ) and it starts counting at the positive edge of the reference frequency (F ref ) after synchronization by synchronizer  1803 . At the end of the reference period, the counter output is latched to a register  1802 . This means that the counter based FDC is used to compute the integer ratio (D osc ) between F osc  and F ref . The sampling frequency as well as the frequency resolution of this architecture is equal to F ref . This means that there is a trade-off between achieving a high sampling frequency and fine frequency resolution. The dynamic range is determined by the number of bits of the counter. 
     Error! Reference source not found. shows a block diagram of a fractional FDC that breaks the trade-off between achieving a high sampling frequency and a fine frequency resolution. The number of whole F osc  periods between two reference edges is computed as D integer  using a counter as mentioned before. The residual time distance between the reference period and the D integer  oscillator periods is measured using a time-to-digital converter (TDC)  1904  as D fractional . Both integer and fractional parts are added (block  1905 ) to produce the digital output of the converter (D osc ). Here, the sampling frequency is equal to F ref  while frequency resolution is determined by the resolution of the TDC. 
     Single Point Trimming for TCO 
     The techniques described can be reconfigured easily to provide a robust, low-cost and fast SPT routine for any temperature compensated oscillator (TCO) including TCXO, MEMS, FBAR, and RC oscillators. Error! Reference source not found. illustrates a generic block diagram of an open loop TCO. An open loop temperature compensation technique aims to negate the temperature generated frequency shift of the oscillator  2001  by imposing a frequency shift in the opposite direction of equal magnitude using a temperature sensor  2003  and a digital/analog control module  2010 . To achieve this, one can modify the oscillation frequency using one or more frequency tuning controls of the oscillator. Alternatively one can follow the oscillator with a frequency multiplier/divider  2009  and control the multiplication/division factor such that the output frequency is temperature independent. In the illustrated embodiment, the digital/analog control module includes a temperature compensation algorithm  2005  and an OTP ROM  2007 . Conversion circuitry  2020  is provided as needed. 
     A smart compensation algorithm can cancel the temperature dependence of the oscillator by utilizing accurate temperature measurement and dynamic adjustment of the oscillator or frequency multiplier/divider based on a linear or higher-order polynomial fit. However, choosing the optimum coefficients of the polynomial fit is difficult and may require extensive characterization of the complete system to achieve tight temperature stability in the predetermined temperature range. This means that every single part has to be calibrated using multiple insertion temperature points to achieve the required specification. Consequently, the production cost increases dramatically thus increasing the cost of the whole product. 
     The techniques described herein provide an SPT alogorithm for any TCO, thus reducing the testing cost while achieving high frequency stability. The present appartus is capable of finding the optimum temperature compensation parameters and of adjusting the oscillator frequency to the required value simultaneously. Thus it provides a robust, fast and low cost trimming solution for TCO thus decreasing the complexity of product testing and consequently decreasing the overall cost of the product. 
     Assume an oscillator, to be temperature compensated, has temperature dependence as described in equation (1), where T is the operating temperature and T o  is the center of a predetermined temperature range. a 1 , a 2  and a 3  are constants representing the oscillator&#39;s temperature dependence. The aim of the temperature compensation algorithm is to negate this temperature dependence dynamically based on accurate temperature measurement (D temp ). The compensation algorithm tunes the oscillator and/or the frequency multiplier/divider according to a polynomial function whose coefficients are c 1 , c 2  and c 3 . The optimum values of the compensation coefficients (c 1 , c 2  and c 3 ) are those which make the temperature dependence coefficients (a 1 , a 2  and a 3 ) equal to zero. 
         F   out   =F   o   +a   1 ×( T−T   o )+ a   2 ×( T−T   o ) 2   +a   3 ×( T−T   o ) 3  
 
         F   out′   F   o   +a   1 ×( T−T   o )+ a   2 ×( T−T   o ) 2   +a   3 ×( T−T   o ) 3   (1)
 
       FIG. 21  shows a top-level diagram of the SPT for TCO infrastructure based in part on a structure  2150  like that of the structure  550  of  FIG. 5 . The digital implementation of the SPT module may be highly programmable to accommodate different oscillators with different characteristics. A temperature triangular excitation signal superimposed over T o  is applied to the oscillator through a temperature modulation module. The oscillator frequency will act in response to the temperature modulation signal according to its temperature dependence as described in equation (1). The FDC will convert the oscillator frequency into a digital word D osc . 
     An LMS calibration block  2160  includes derivative blocks  2161  and  2162 , a coefficients detection module  2163 , and an LMS trimming algorithm  2165 . As the excitation signal is a triangular wave, then the first derivative of frequency can be represented in a digital word (Df 1 ) using a difference block. The process can be extended to get higher derivatives (Df 2 , Df 3 ). The coefficients detection module uses frequency derivatives (Df 1 , Df 2  and Df 3 ) to estimate the oscillator&#39;s temperature dependence coefficients (a j , a 2  and a 3 ). An LMS trimming algorithm can be used to search for the optimum compensation coefficients (c 1opt , c 2opt  and c 3opt ) similar to Error! Reference source not found. (A). 
     The accuracy of the trimming algorithm depends on the amplitude of the temperature modulation waveform. As the amplitude of temperature modulation increase the total temperature dependence of the oscillator in the required temperature range increases. The oscillator output frequency can be readjusted after each modulation cycle by enabling the DPLL module to reacquire the required frequency FCW.f ref . Afterwards, the DPLL is disabled and the oscillator becomes free-running again to respond to the temperature modulation. The techniques described herein are capable of adjusting the optimum compensation parameter for minimum temperature dependence besides adjusting the oscillator output frequency at the same time. 
     The techniques described herein provide a smart, robust, and all-digital trimming solution for TCO thus decreasing the complexity of production testing and consequently decreasing the overall cost of the product.