The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Apr 27th, 2024, 5:00pm
Pages: 1
Send Topic Print
Simulation of Crystal Oscillators (Read 20225 times)
loose-electron
Senior Fellow
******
Offline

Best Design Tool =
Capable Designers

Posts: 1638
San Diego California
Simulation of Crystal Oscillators
Jul 18th, 2008, 4:22am
 
ONe of the nasty problems of simulating a crystal oscillator circuit is that the start up time can take thousands of cycles to build up, or not start at all.

That said, what techniques have you used to kick start a crystal, or get the device to come to steady state quicker?
Back to top
 
 

Jerry Twomey
www.effectiveelectrons.com
Read My Electronic Design Column Here
Contract IC-PCB-System Design - Analog, Mixed Signal, RF & Medical
View Profile WWW   IP Logged
buddypoor
Community Fellow
*****
Offline



Posts: 529
Bremen, Germany
Re: Simulation of Crystal Oscillators
Reply #1 - Jul 18th, 2008, 6:06am
 
Very often I have faced the same problem - and my experience was that it needs at least app. Q cycles until the oscillator comes to a steady state.
I donīt know if there is simulation method to allow a shorter start time.
Back to top
 
 

LvW (buddypoor: In memory of the great late Buddy Rich)
View Profile   IP Logged
vivkr
Community Fellow
*****
Offline



Posts: 780

Re: Simulation of Crystal Oscillators
Reply #2 - Jul 18th, 2008, 7:40am
 
Can't you use PSS analysis and input the approximate frequency? I would imagine that that would work,
unless you want to simulate start-up time Wink

I can't think of any other way though.

Regards
Vivek
Back to top
 
 
View Profile   IP Logged
loose-electron
Senior Fellow
******
Offline

Best Design Tool =
Capable Designers

Posts: 1638
San Diego California
Re: Simulation of Crystal Oscillators
Reply #3 - Jul 18th, 2008, 9:19am
 
using PSS just means that the simualtor has to burn the time to find the PSS solution, and that in the background is just running the .tran to find it.

I have inserted a damped sinusoid voltage source in series with the crystal model, which kicks the crystal in the past.

any other ideas?
Back to top
 
 

Jerry Twomey
www.effectiveelectrons.com
Read My Electronic Design Column Here
Contract IC-PCB-System Design - Analog, Mixed Signal, RF & Medical
View Profile WWW   IP Logged
pancho_hideboo
Senior Fellow
******
Offline



Posts: 1424
Real Homeless
Re: Simulation of Crystal Oscillators
Reply #4 - Jul 18th, 2008, 6:05pm
 
loose-electron wrote on Jul 18th, 2008, 9:19am:
I have inserted a damped sinusoid voltage source in series with the crystal model, which kicks the crystal in the past.
any other ideas?

I set an initial current for inductor of equivalent circuit of crystal.
Then I run tran or pss with skipdc=yes in cadence spectre.
Or I run tran with uic=yes in Agilent ADS and HSPICE.
As an initial current for inductor, I use typical drive power or current value in data sheet of crystal as initial try.

In cadence spectre, an initial current parameter of inductor instance is not valid when you set skipdc=yes.
Instead you must use ic statement to set an initial current for inductor.
Back to top
 
 
View Profile WWW Top+Secret Top+Secret   IP Logged
loose-electron
Senior Fellow
******
Offline

Best Design Tool =
Capable Designers

Posts: 1638
San Diego California
Re: Simulation of Crystal Oscillators
Reply #5 - Jul 19th, 2008, 12:55pm
 
The initial condition current on the inductor within the crystal model works nicely!
Smiley
5 star! Thanks!
Cheesy
Back to top
 
 

Jerry Twomey
www.effectiveelectrons.com
Read My Electronic Design Column Here
Contract IC-PCB-System Design - Analog, Mixed Signal, RF & Medical
View Profile WWW   IP Logged
Visjnoe
Senior Member
****
Offline



Posts: 233

Re: Simulation of Crystal Oscillators
Reply #6 - Aug 25th, 2008, 11:07am
 
1. RF analysis: you can do an 'envelope analysis' to simulate the startup time.
   It will be a huge improvement over a standard transient analysis.

2. Transient analysis: put an initial condition on the inductor of the XTAL model.

3. Transient analysis: include a damped sinusoid (at the expected frequency) in the XTAL model.

Personally, I prefer method (1) since  the other methods (initial conditions) might also provide a quick start-up but you cannot be certain about the resulting waveforms (amplitude) unless your initial conditions are very accurate (or you simulate over a long time). Otherwise, you will introduce a finite error into the solution which decays very slowly because the Q of your circuit is very high. So, eventually, you will see the true steady-state, but an RF simulator provides this immediately.


Regards

Peter
Back to top
 
 
View Profile   IP Logged
pancho_hideboo
Senior Fellow
******
Offline



Posts: 1424
Real Homeless
Re: Simulation of Crystal Oscillators
Reply #7 - Aug 25th, 2008, 4:51pm
 
Visjnoe wrote on Aug 25th, 2008, 11:07am:
1. RF analysis: you can do an 'envelope analysis' to simulate the startup time.
   It will be a huge improvement over a standard transient analysis.
2. Transient analysis: put an initial condition on the inductor of the XTAL model.
3. Transient analysis: include a damped sinusoid (at the expected frequency) in the XTAL model.

Which envelope analysis do you mean shooting Newton based or Harmonic Balance based ?
If you use RF simulator without any kick start of oscillator, simulation speed is not improved.

If you use shooting newton based, you have to kick start oscillation by 2 or 3 in the above or using step power supply.

If you use HB based without transient asist, you have to set very accurate final state oscillation frequency.

If you use transient asisted HB based, you have to kick start oscillation by 2 or 3 in the above or using step power supply as same as in shooting newton.

Situation is same in both HB based envelope analysis and transient assisted HB analysis.

Anyway you have to invoke any kick start method for very high Q oscillator whatever simulator you use.

Visjnoe wrote on Aug 25th, 2008, 11:07am:
since  the other methods (initial conditions) might also provide a quick start-up but you cannot be certain about the resulting waveforms (amplitude) unless your initial conditions are very accurate (or you simulate over a long time). Otherwise, you will introduce a finite error into the solution which decays very slowly because the Q of your circuit is very high.

Using kick start of method 2 or 3, I execute Shooting Newton or HB analysis.
So result is true steady-state.

Visjnoe wrote on Aug 25th, 2008, 11:07am:
So, eventually, you will see the true steady-state, but an RF simulator provides this immediately.

I don't think simulation speed is improved even if you use RF simulator without ank kick start.

If start up time is improved in envelope analysis without any artficial kick start, it is very suspicious.

Maybe you mean compared to common transient analysis, envelope analysis is fast.
If so, speed of envelope analysis is not always superior to transient analysis.

Back to top
 
« Last Edit: Aug 26th, 2008, 9:39am by pancho_hideboo »  
View Profile WWW Top+Secret Top+Secret   IP Logged
Visjnoe
Senior Member
****
Offline



Posts: 233

Re: Simulation of Crystal Oscillators
Reply #8 - Aug 26th, 2008, 12:21am
 
Dear,

Sorry for the confusion, of course you also need an initial condition for the RF simulation.

For the RF simulation, I prefer to use shooting Newton for oscillators which exhibit non-linear behavior (as most do), thus showing more 'square wave' like behavior than pure sinusoidal.

When I mean faster, I indeed compare 'common' transient analysis to envelope analysis. It is just based on my experience. I have not compared in detail (side-by-side) a transient analysis with an envelope analysis on a xtal oscillator.

But let me ask this: if the envelope analysis has no benefit over a common transient analysis, why would all EDA vendors advocate/promote using this method? Just to sell more licenses of the more expensive RF simulator?


Regards

Peter

Back to top
 
 
View Profile   IP Logged
loose-electron
Senior Fellow
******
Offline

Best Design Tool =
Capable Designers

Posts: 1638
San Diego California
Re: Simulation of Crystal Oscillators
Reply #9 - Aug 26th, 2008, 2:25pm
 
I took a careful look at the envelope methods and did not see a advantadge there. Still need a kick start method.

Since simulations of cold starting crystals take HUGE amounts of simulation time (and memory space into the big GByte world) often the best strategy there is to Initial Condition with a current on the inductor in the crystal to roughly 20-50% of expected final amplitude. Looking at the envelope, if it degenrates, you got gain problems, if its growing you are ok.  Unfortunate but the simulations can take 10-40 hours to run. (and thats on a good UNix server not some old junk PC)

A simple AC analysis on gain is a good guide to whether or not the gain is sufficient, but the transient test (above) needs to be also applied. Gain is heavily bias point dependent, so AC can be misleading. Put some gain margin on your worst case AC gain.

Other little goodies learned on crystal simulations:

AC analysis of a crystal will show a complementary pole/zero response side by side. This can mess the simulation up. For simulation purposes (tranisent and AC) model the crystal with just 3 elements, the series RLC and dont include the parasitic bypass capacitinace. That way you are simulating with just the pole response of the crystal resonance.

The high Q of a crystal can mess up simulations. Drop the Q of the crystal down. Normal Q is 10E4 to 10E6, bring the Q down to 100, to make the simulator happy. That means increasing the resistance in the series RLC.

The ESR of the crystal can play into the loop  gain due to voltage division between the ESR and input impedance of the amplifier.

Due to the above two items, the crystal model gets to be a little more complex than a series RLC circuit. On the input driven side it is a series RLC, buffered by a VCVS (voltage controlled voltage source) which then has the VCVS connected thru a series resistance (the crystal ESR) to the input of your amplifier. A little more complicated but gives viable results.

Starting a crystal (or any other oscillator) is not a function of noise or offsets in simulation. Have a careful read thru section 4.4.2 (page 209) of Ken Kunderts book (The designers guide to Spice and Spectre) for simulation starts and the concept of equilibrium. In the real world (not simulations) the noise/offset plays in, but generally not in simulation.

Crystal oscillators look simple but in reality have lots of touchy issues.
Back to top
 
 

Jerry Twomey
www.effectiveelectrons.com
Read My Electronic Design Column Here
Contract IC-PCB-System Design - Analog, Mixed Signal, RF & Medical
View Profile WWW   IP Logged
ywguo
Community Fellow
*****
Offline



Posts: 943
Shanghai, PRC
Re: Simulation of Crystal Oscillators
Reply #10 - Aug 28th, 2008, 12:50am
 
Hi loose-electron,

You gave a good conclusion on the simulation of crystal oscillator. You have already pointed that the long transient simulation time is strongly related to very high Q value. So it is a good way to bring the Q down to 100. However, don't increase ESR, just adjust L and C, because we need to assure if the amplifier has enough negative resistance to compensate the ESR. In other words, the negative resistance and ESR determine whether the crystall oscillator starts or fails to start.  :)
Back to top
 
 
View Profile   IP Logged
Visjnoe
Senior Member
****
Offline



Posts: 233

Re: Simulation of Crystal Oscillators
Reply #11 - Aug 28th, 2008, 2:09am
 
Dear,

I took the time to do some simulation experiments on a 32.768kHz crystal oscillator.

1. The transient analysis (using initial conditions) took 7hrs.

2. The steady-state analysis using harmonic balance took 2min.
    You immediately can assess the steady-state conditions, but unlike transient analysis
     you cannot see the detailed start-up behavior over time.

I can see why the RF simulation using shooting-Newton methods might not gain you that much in simulation time, but it turns out that an harmonic balance simulation speeds things up significantly. This is without decreasing the Q of the crystal oscillator.

Again, I'm not the simulation expert here, I can just say what I empirically see using a commercial RF simulator on a CMOS 32.768kHz oscillator.


Regards

Peter
Back to top
 
 
View Profile   IP Logged
loose-electron
Senior Fellow
******
Offline

Best Design Tool =
Capable Designers

Posts: 1638
San Diego California
Re: Simulation of Crystal Oscillators
Reply #12 - Aug 28th, 2008, 9:33am
 
The splitting of the crystal model into two parts that I described above seems to work reasonably well:

Input part: RLC resonance, with Q around 100, and NO parasitic bypass capacitance. Output of that gets buffered by a VCVS (gain of unity) - The tightly spaced pole/zero combination that the parasitic bypass capacitance causes will mess up the simulation results.

Output part: The VCVS drives a series resistance to drive the output which is equivalent to the highest expected ESR of the crystal.

Between the two above items you get a "simulator friendly" spectral response for the crystal, and yet a "gain accurate" response for the oscillator loop.

--- Jerry
Back to top
 
 

Jerry Twomey
www.effectiveelectrons.com
Read My Electronic Design Column Here
Contract IC-PCB-System Design - Analog, Mixed Signal, RF & Medical
View Profile WWW   IP Logged
pancho_hideboo
Senior Fellow
******
Offline



Posts: 1424
Real Homeless
Re: Simulation of Crystal Oscillators
Reply #13 - Aug 28th, 2008, 7:49pm
 
Visjnoe wrote on Aug 26th, 2008, 12:21am:
When I mean faster, I indeed compare 'common' transient analysis to envelope analysis.

If you have interest only on steady state, you don't have to invoke envelope analysis. Rather just run simple steady state analysis such as HB or Shooting Newton.
Envelope analysis is time varied steady state analysis, so envelope analysis is redundant and slow, compared to simple time invariant steady state analysis.

Visjnoe wrote on Aug 26th, 2008, 12:21am:
But let me ask this: if the envelope analysis has no benefit over a common transient analysis, why would all EDA vendors advocate/promote using this method?

This is dependent on situation for which you apply envelope analysis.

Envelope analysis is efficient if energy is concentrated on one harmonic.
If energies are distributed to many harmonics, envelope analysis is less efficient than common transient analysis.
And if a complex envelope(magnitude and phase) is varied fairly fast, envelope analysis is also less efficient.
These are true for both HB and Shooting Newton based envelope analysis.

Visjnoe wrote on Aug 28th, 2008, 2:09am:
1. The transient analysis (using initial conditions) took 7hrs.

Your initial conditions are not good.
If you apply proper initial conditions with skipdc=yes(spectre) or uic=yes(hspice), it can reach steady state immediately.
Here initial conditions I mean are all node voltages and all state currents. Not only initial current of inductor.

Visjnoe wrote on Aug 28th, 2008, 2:09am:
2. The steady-state analysis using harmonic balance took 2min.
    You immediately can assess the steady-state conditions, but unlike transient analysis
     you cannot see the detailed start-up behavior over time.

If you have interest on start-up behavior over time, use a time varied steady state analysis such as envelope analysis.

Visjnoe wrote on Aug 28th, 2008, 2:09am:
I can see why the RF simulation using shooting-Newton methods might not gain you that much in simulation time,

Just your initial conditions are not good.

For very high Q osciilator, HB analysis is not always superior than Shooting Newton.

Again you have to consider the followings for rapid simulation of very high Q oscillator.
  HB analysis require very accurate final state oscillation frequency.
  Shooting Newton require good initial conditions.

For transient assisted HB analysis, both good guess of final state oscillation frequency and good initial conditions are useful.

Back to top
 
« Last Edit: Aug 29th, 2008, 12:59am by pancho_hideboo »  
View Profile WWW Top+Secret Top+Secret   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.