Version 4 SHEET 1 2144 1496 WIRE -144 112 -224 112 WIRE -144 112 -144 -16 WIRE -144 160 -144 112 WIRE -144 272 -144 224 WIRE -144 496 -144 464 WIRE -144 608 -144 576 WIRE -16 464 -144 464 WIRE 32 -16 -144 -16 WIRE 48 112 -144 112 WIRE 272 464 64 464 WIRE 272 560 272 464 WIRE 304 -16 112 -16 WIRE 304 112 112 112 WIRE 304 112 304 -16 WIRE 304 160 304 112 WIRE 304 272 304 224 WIRE 320 560 272 560 WIRE 352 464 272 464 WIRE 496 112 304 112 WIRE 496 176 496 112 WIRE 496 464 432 464 WIRE 496 464 496 256 WIRE 560 112 496 112 WIRE 560 464 496 464 FLAG -144 272 0 FLAG 304 272 0 FLAG -224 112 in IOPIN -224 112 Out FLAG 560 112 out1 IOPIN 560 112 Out FLAG -144 608 0 FLAG 560 464 out IOPIN 560 464 Out FLAG 320 560 out0 IOPIN 320 560 Out SYMBOL Misc\\xtal 112 96 R90 WINDOW 0 0 32 VBottom 0 WINDOW 3 32 32 VTop 0 WINDOW 39 65 14 VTop 0 SYMATTR InstName Q1 SYMATTR Value {C1} SYMATTR SpiceLine Rser=50 Lser={L1} Cpar=5p SYMATTR SpiceLine2 ic=0 SYMBOL cap 288 160 R0 SYMATTR InstName C9 SYMATTR Value 20p SYMBOL cap -160 160 R0 SYMATTR InstName C10 SYMATTR Value 20p SYMBOL res 16 0 R270 WINDOW 0 32 56 VTop 0 WINDOW 3 0 56 VBottom 0 SYMATTR InstName R1 SYMATTR Value 10MEG SYMBOL bv -144 480 R0 SYMATTR InstName B1 SYMATTR Value V=-atan(2*V(in)) SYMBOL res 480 160 R0 SYMATTR InstName R2 SYMATTR Value 200 SYMBOL res 336 480 R270 WINDOW 0 32 56 VTop 0 WINDOW 3 0 56 VBottom 0 SYMATTR InstName R3 SYMATTR Value 100 SYMBOL voltage 80 464 R90 WINDOW 0 -32 56 VBottom 0 WINDOW 3 32 56 VTop 0 WINDOW 123 60 56 VTop 0 WINDOW 39 0 0 Left 0 SYMATTR InstName V1 SYMATTR Value 0 SYMATTR Value2 AC 1 TEXT -808 480 Left 0 ;.ac lin 10000 20MEG 20.01MEG TEXT -816 120 Left 0 !.options plotwinsize=0 TEXT -824 -856 Left 0 ;FS=1/(2*pi*sqrt(L1*C1)) = 20MHz\n \nFP-FS=C1/C0/2\n \nRS=2*pi*FS*L1/Q\n \ndf = Fs*C1/(CL+C0)/2 \n \nQ1 is the quartz crystal\nmoeled with the capacitor \nmodel of LTspice.\nC0 is Cpar of Q1\nC1 is C of Q1\nL1 is Lser of Q1\nRS is Rser of Q1 TEXT -824 -304 Left 0 !.param FS=20e6\n.param Q=25000\n.param RS=50\n.param L1=RS*Q/(2*pi*FS)\n.param C1=1/(2*pi*FS*2*pi*FS*L1) TEXT -848 304 Left 0 !.save V(out0) TEXT -816 -72 Left 0 ;.options nomarch TEXT -816 -40 Left 0 !.options numdgt=12 TEXT -816 -8 Left 0 !.options measdgt=12 TEXT -816 88 Left 0 !.options trtol=1 TEXT -848 272 Left 0 ;.tran 0 2m 0 0.5n uic ; Q=250 or 2500 TEXT -816 24 Left 0 !.options reltol=1e-3 TEXT -816 56 Left 0 !.options method=trap TEXT 112 440 Left 0 ;virtual internal node TEXT -112 616 Left 0 ;V=-tanh(2*V(in)) TEXT 40 392 Left 0 ;V1 is only for .AC simulation TEXT -200 360 Left 0 ;"Ideal nonlinear" Inverter TEXT -808 616 Left 0 ;.save V(in) TEXT -808 656 Left 0 ;V(in) is needed in .AC to find \nthe freqency where phi(Vin)=0 TEXT -280 -304 Left 0 !.measure tran t1 FIND time WHEN V(out0)=0.1 TD=50u RISE=1\n.measure tran t2 FIND time WHEN V(out0)=0.1 TD=50u RISE=10001\n.measure tran f0 PARAM 10000/(t2-t1) TEXT 104 80 Left 0 ;Crystal TEXT 544 -792 Left 0 ;Some results\n--------------------\nBe aware that one .tran simulation may require 1 hour.\n \n\n.tran without minimum timestep: about 20.117 MegHz\n \n*19.4ms to 19.9ms, 0.05n trtol 1 reltol 1e-3 gain=2\nf0: 10000/(t2-t1)=20004771.1534\n \n*19.4ms to 19.9ms, 0.05n trtol 1 reltol 1e-3 gain=5\nf0: 10000/(t2-t1)=20004828.3131\n \n*19.4ms to 19.9ms, 0.05n trtol=1 reltol=1e-4 gain=2 238ppm\nf0: 10000/(t2-t1)=20004771.1612\n \n*19.4ms to 19.9ms, 0.05n trtol 1 reltol 1e-4 gain=5 241ppm\nf0: 10000/(t2-t1)=20004828.2828\n \n \n19.4m to 19.9m, 0.05n reltol=1e-4, trtol=1 gain=2 tanh()\nf0: 10000/(t2-t1)=20004771.4519 TEXT -848 208 Left 0 ;Transient Analysis TEXT -808 392 Left 0 ;AC Analyisis TEXT -840 -112 Left 0 ;Important options for .tran TEXT -848 -352 Left 0 ;The crystal model TEXT -280 -856 Left 0 ;Transient Analysis And AC Analysis Of A Crystal Oscillator\n \nHelmut Sennewald, 27.06.2005\n \nThe goal was to find out which parameters are necessary to \nachieve an accuray of very few ppm in the .tran analysis \nat a frequency of about 20MHz.\n \nMy understanding is that the correct frequency is where the\nphase of the whole path is at 0 degree in the AC-analysis.\n \nHint, I recommend to start with a low Q value to check \nthat the oscillator works. E.g. Q=250 . Also change \nthe .tran time and timestep, e.g. .tran 0 2m 0 0.5n uic .\n \nThe results of .measure are always in the Error-Log-file. TEXT -280 -352 Left 0 ;Measure the frequency with .measure command lines TEXT -280 -192 Left 0 !.measure ac f0ac FIND freq WHEN im(V(in))=0 TEXT 544 -848 Left 0 ;f0ac: freq=(146.022699265dB,0°) at 20004834.5212 TEXT -1592 -864 Left 0 ;Message 6061:\n \nI have tried to find out the necessary parameters for a ppm-precise\n.TRAN simulation of a crystal oscillator.\nMy simulation setup was a crystal plus an ideal inverter made by\na B-source with atan-transfer function.\nThe Q of the crystal model was 25000.\n \nI used the 0-degree frequency from the .AC simulation as the\nreference to see what simulation comes closest.\n \nHere are my recommendations\n---------------------------\n \n1. Reset all simulator settings in the control panel!\n \nLimit the saved traces. One trace may require 200MByte!\n \n.save V(out)\n \nSwitch marching waveform off.\n \n.options nomarch\n \nIncrease the number of digits.\n \n.options numdgt=12\n.options measdgt=12\n \nSet solver method to trap. Don't use "Alternate".\n \n.options method=trap\n \nSet the minimum timing step to 1/1000*period_time.\nSetting no minimum timestep results in a penalty of 100kHz! offset.\n*** I used "uic" in conjunction with ic=.. for the capacitor in the\n*** crystal model. \nChange: I used "uic" in conjunction with .ic V(out1)=5 .\n \nWith a real gain stage you can apply other methods\nto start the oscillator. The only important thing here is the\nminimum timestep.\n \n.tran 0 20m 19.4m 0.05n uic\n \nSwitch off any data compression for lowest distortion.\n \n.options plotwinsize=0\n \nSet it trtol to 1. I tried with 1e-4, but there was only a very very\nlittle change.\n \n.options trtol=1\n \nI tried with 1e-4 too, but the difference was in the sub-ppm range.\n \n.options reltol=1e-3\n \n \nBy the way, one simulation run may require one hour. You should\nhave a few PCs around to simulate in parallel. TEXT -808 560 Left 0 ;.ac lin 10000 20MEG 21MEG TEXT -808 448 Left 0 ;Q=25000 TEXT -808 528 Left 0 ;Q=250 TEXT -280 -80 Left 0 !.ic v(out1)=5 TEXT -848 240 Left 0 !.tran 0 20m 19.4m 0.05n uic ; Q=25000 LINE Normal -288 528 -288 112 2 LINE Normal -192 528 -288 528 2 LINE Normal -208 512 -192 528 2 LINE Normal -208 544 -192 528 2 LINE Normal -272 112 -288 112 2 RECTANGLE Normal 464 672 -224 336 RECTANGLE Normal -424 704 -872 368 RECTANGLE Normal -424 328 -872 184 RECTANGLE Normal -424 152 -872 -136 RECTANGLE Normal -424 -168 -872 -376 RECTANGLE Normal 424 -168 -312 -376