Shop OBEX P1 Docs P2 Docs Learn Events
Propeller osillaction and freqency testing — Parallax Forums

Propeller osillaction and freqency testing

rwgast_logicdesignrwgast_logicdesign Posts: 1,464
edited 2012-04-22 20:24 in Propeller 1
Im sort of unclear om a few things as far as frequency/osicillation type stuff goes. it all started with those 5mhz crystals not working and me thinking about all sorts of stuff.

first of all i looked online for simple crystal testing type circuts and they all seem abit rediculous compared to the diode/meter method jmg recommended. But they all do the same thing check for oscilation. is there a way you could output a wave to oscilate the crystal and then use another pin check and verify the xtal is oscilating.

the whole xtal thing has got me looking into frequency counters. most of the diy projects are fairly low freqency like 1mhz or something. i had found this 1ghz diy http://electronics-diy.com/electronic_schematic.php?id=508v its main problem is the supporting cpu doesnt seem like an easy buy.
I know theres a spin program on obex that lets you use your propeller as a frequency counter, i havent been near a computer for a few days to test it out.
this is where i start to get a bit confused and dunno where to keep researching. ok so lets say i wanted to use a frequency counter to find out what my prop chip was running at. and then lets say im running a 5mhz pll16x how big of a counter/scope or whatever test tool would i need, surely not something capable of 80mhz+ right? I mean my prop is layed out on a breadboard and appears to run fine well over 100mhz, since i know a breadboard cant really hit more than 10mhz that means the only thing runing at a high frequency is the prop internally. so im thinking if i had a counter to verify the props freq i would be testing to make sure it was running at 5mhz (i.e. the speed of xtal im using). and exactly where on a chip would i want to probe to find the exact external frequency, the vdd inputs? i mean you could test the xtal but that still only gives u the xtal speed. so ur still just trusting that everything is as fast as it should be. im not sure if this is making seanse it does in my head lol. i guess i just wanna know how you would find the frequency of the prop without just trusting xtall x pll, and exactly what frequency im measuring for, bexuase im pretty sure its not acually 80mhz.

i have alot of prop projects going on and one of them is just a multi purpose circut tester. i use my prop alot to test caps, and the next thing id like to add would be a freq counter. i understand freq is just pulses/time. what i am woundering is if i were to try to make a freq counter based on the prop what the theroretical maxium frequency is i could detect using the prop alone without a chip like the one i linked to in the schematic above. i know the max freq the prop will read has something to do with its own clock speed i just dont know how u would find it, and wether its based of the props external or interal clock speed.

Comments

  • jmgjmg Posts: 15,183
    edited 2012-04-21 19:59
    The link above does not work, but they seem to sell Pre-programmed chips.

    To measure any Internal frequency, you need to first load a tiny pgm that toggles a pin, at some easy to check frequency.

    Or you might toggle more than one pin, using different methods, so you can check both the Xtal, and your translated values..
    eg
    Pin1 : Set a counter as Adder on a /2^N value. - Pure HW so the COG that starts this can do :
    Pin2 : Use WAITCNT and a defined delay

    A easily available, low cost prescaler is the 74LV4060, or the more generic but slower 74HC4060, this can move any Prop frequency into the range of PC Sound Card Frequency counters, I linked to before.
    For wider range, and some preamp, I like the look of the ADF4xxx series.
    The ADi designers thought to include a test-mode mux, that can route any divider to a pin, and to allow full integer range on the Dividers.
    Simplest is the ADF4001, thru to ADF4151 which would allow up to 3.5GHz counting



    http://www.daqarta.com/dw_freq.htm
    http://opend.co.za/hardware/freqmeter1/index.htm

    These are reciprocal counters, so give good precision at lower frequencies.
    They will be as good as your PC sound clocks, so some tens of parts per million absolute, and less than 1ppm relative.

    Of course, the NEXT thing you want to know, is what your Crystal errors are to fractions of a part per million, so these Digikey parts can do that :
    Oscillator Modules, with errors in Parts per billion (!) and Price
    ±20ppb $39.32 CW727-1-ND
    ±100ppb $31.13 CW700-1-ND
    ±250ppb $21.00 CW663-ND

    The Prop can of course do Frequency counting, and the data sheet gives some ideas of possible limits.

    Just simple counter toggling, needs to see a H then L on following SysClks, so that's a Count ceiling of ~40MHz (less a bit for skews)
    If you simply wait 10 seconds and then read that timebase, you will have added 50,000,000 counts from a 5MHz signal, and added 200,000,000 counts from one of those 20MHz precision refs above.

    The ideal test system would measure two frequencies at the same time : the precision ref, and the unknown, then any PLL issues can be removed from the error budget.

    Such a system is fine for good precision > 1MHz, but if you want wide dynamic range, and faster readings for a given precision, you need to move to a Reciprocal Counter Design.
    That delivers N digits per second, and does not care about 1MHz, 100KHz or even 1 second.

    This ideally needs a Pin-Edge capture, of Two counters, and the Prop sadly lacks full support for that in hardware.

    So some extra SW is needed, and the question is how that impacts the FMax, and resolution figures.

    If we relax that to a (say) 100ns granularity or 2 opcodes, at high frequencies, that gives 7 decimal digits per second, or 100ppb/s and it can improve from there as the Fu drops to close to 8 decimal digits / second, or 12.5ppb/second ( 8 digits and 10ppb/s if you overclock @ 100MHz)
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-04-21 22:52
    wow man u give some detailed replies thank you so much. i dont understand everything your talking about but its goldmine to start research. i think my biggest lack of understanding comes from lack of knowelge when using more advanced test equitment, due to no access. hence the reason for building my own.

    anyways your post was very detailed but i still would like to get a few straight forward answers to some of the basic questions. #1 if i were to just go buy a counter to use to test basically my prop would i need one equivalent to my internal prop clock speed or something that tests as high as my crystal frequency? #2 can the prop be used for a basic yes no type test for oscilation? if so what would be a good place to start researching how to detect it?

    i looked into the sound card counters as you suggested and i plan on getting one set up to experiment with before i attempt a prop based one.
    this is the link i posted im not sure what happend up there, http://electronics-diy.com/electronic_schematic.php?id=508 its basicaly a pic with a prescaler that can measure 1ghz looks pretty slick for a homeade counter, better than paying a grand
  • jmgjmg Posts: 15,183
    edited 2012-04-22 00:31
    #1 if i were to just go buy a counter to use to test basically my prop would i need one equivalent to my internal prop clock speed or something that tests as high as my crystal frequency?

    Only buy one if it comes either cheap, or fully spec'd. It only needs to count crystal speeds, you have to feed the PLL out a pin anyway, so just divide it as you do so.

    A HC4060 + SoundCard meter, will be more than good enough to start with, and get you to some 10's of ppm.

    Or, if you are spending money, look at a multi purpose model like this one - available on ebay from ~ $73
    http://www.uni-trend.com/UT60H.html
    or a little more gets this
    http://www.uni-trend.com/UT71A.html
    #2 can the prop be used for a basic yes no type test for oscilation? if so what would be a good place to start researching how to detect it?

    Sure, but that's a complex way to check a pulse. It also needs a working oscillator, to operate properly!

    Cheaper pulse checker, would be a HC4060 (AC coupled into the preamp, linear biased) and a Piezo Speaker.
    5e6/2^12 = 1220.703125Hz => a good squeal.
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2012-04-22 05:07
    While a frequency counter is not the highest priority in a well equipped shop, they are very handy to have sometimes.

    Check out ebay, there are about 900 to choose from.

    Yes, I would like it to count to 1GHz or so, and have at least 8 digits in the display with many timebase options.

    Duane J
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-04-22 18:22
    ok so i was looking into some stuff, just to test the frequency the prop is running at couldnt you get to values from cnt at a specific time interval and use there diffrence over time?
  • jmgjmg Posts: 15,183
    edited 2012-04-22 19:14
    ok so i was looking into some stuff, just to test the frequency the prop is running at couldnt you get to values from cnt at a specific time interval and use there diffrence over time?

    Sure, provided you know the time interval.

    A good example could be a 1 pps GPS Pulse, used to capture CNT every second.

    Expected delta value is 80,000,000, and the numeric LSB here is 12.5ppb
    GPS 1pps are often spec'd around 100ns, so your system LSB is closer to 100ppb, but you get the idea.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-04-22 19:28
    hmm i was thinking youd calculate the the time interval with a counter on another cog but i guess this wouldnt work becuase your relying on the props timing. i need to get something running like this to do a bunch of oc tests. i have no need for a gps so thats kind of out. although i have a few of those ds1302 rtc chips on the way, could that work to get an exact interval i would think rtc would be super acurate.
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2012-04-22 20:05
    The DS1302 is itself controlled by it's crystal.
    So you wouldn't have any calibrated independent reference.

    The GPS 1 second tic is about the best reference the ordinary guy can get. You do need to average many thousands of these to obtain its full accuracy though.

    Another method is to setup the counter to run at the carrier frequency of a local AM broadcast radio station. Then using a radio listen to the beat frequency. Adjust the counter until the beat is zero. OK, not all radio stations have precision master oscillators. But some do. I have a local station, KSTP, that is precision. Just talk to the stations engineer. They will tell you if they are precision or not.

    Duane J
  • jmgjmg Posts: 15,183
    edited 2012-04-22 20:18
    i would think rtc would be super acurate.

    Never assume, always check the data :)

    General Rule : It it does not actually specify a ppm, you can expect it to be un-corrected

    http://para.maxim-ic.com/en/search.mvp?fam=rtc&374=I%3Csup%3E2%3C/sup%3EC&tree=timers

    but even there, there are traps for the unwary, as a common method of RTC time-base fixup, is count skipping.

    Only a few actually trim/adjust the Oscillator.
    Added: I've checked the PCF2129A, and it is $2.65 at Mouser, for 3ppm, and they use a hybrid solution : they vary the OscCap, but in a time-modulated way, and also state the 1 second Divider choice, is the best to avoid the Cal-jitter effects.

    Note they do not actually give a 1 second ppm error, but the (very) high crystal Q, and a time-modulation that repeats every 32768, (or factor of /2) should (hopefully) average the jitter down to their quantize level.


    The 'better end' Maxim parts are also quite costly, you can get a FOX924B TCXO for less money;
    Newark show them at a a promo price of $3.18 1+, for a 10.0000MHz, 1.5/2.5ppm rated part.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-04-22 20:24
    I would get a cheap shortwave radio and tune it to WWV at 10 MHz (or 2.5 Mhz, 5 MHz, or 20 MHz). Then program one of the counters in PLL mode to output at the tuned-in WWV frequency and run a wire from the output pin near the antenna of the radio. This will cause the WWV carrier and the Prop output to beat together, producing a tone at the difference frequency. By adjusting the value of the counter's frqx register, you will be able to produce a "zero beat" where the two frequencies are the same. By comparing the actual value of frqx at zero-beat to what it should have been to generate the WWV frequency, you can determine how far off your Propeller's crystal really is.

    BTW, if you don't have a shortwave radio, you can also pick any broadcast station in the AM band (550 kHz .. 1610 kHz). It won't be as accurate as WWV's NIST-calibrated signal, but it will be close enough for most uses.

    -Phil
Sign In or Register to comment.