Shop OBEX P1 Docs P2 Docs Learn Events
analyzing clock jitter — Parallax Forums

analyzing clock jitter

darrenodarreno Posts: 16
edited 2012-03-19 00:55 in Propeller 1
Anyone know of way to determine how much cycle to cycle jitter a clock has without having a spectrum analyzer?
The clock under test is up to 4MHz. I'm thinknig a propeller counter could only be used to find really large instabilities. Will a 20ppm crystal keep a propeller's clock accuracy near 20 ppm?

Comments

  • Mark_TMark_T Posts: 1,981
    edited 2012-03-15 09:24
    Unless you use prop counter frequencies that are a divisor of 2^32 you get jitter from the counter modules... Quartz crystals produce very low jitter. By using waitpeq and waitpne in PASM you can time external signals to 12.5ns accuracy, so it depends on what amount of jitter you care about. Jitter is called "phase-noise" in the analog (RF) domain and 12.5ns of jitter is a show-stopper for RF signal processing.
  • darrenodarreno Posts: 16
    edited 2012-03-15 12:48
    I was planning on measuring the jitter of a beat oscillation using one of the counters. From what I understand, if you can generate a stable frequency close to the signal being tested the beat between the two magnifies the jitter. So if I am able to use a 10MHz clock generated from an 80Mhz propeller to mix against a 980Khz clock the beat frequency should be 20Khz. The jitter should be amplified by 500x, which is what I hope to measure.

    This is all theory, which I may be not fully understanding.

    A question about the WAITPEQ, does it start the next instruction on the next clock cycle or after 6 cycles. I don't understand if the 6 cycle time for the instruction includes any latency after the condition is met.
  • BeanBean Posts: 8,129
    edited 2012-03-15 19:25
    darreno,
    I'm assuming you meant to mix 1MHz with 980KHz ???

    One way is as you describe. Mix (xor) the two frequencies the result will be the sum and the difference. Then filter off the sum (low pass filter). That is how we did it in this video http://www.youtube.com/watch?v=fkYL7fluv5E

    If I was doing it again, I would try sampling the 980KHz at 1MHz (1 million samples per second). This should be possible with PASM. The sampled pin should change state at 20KHz. You would count how many samples are high, then how many samples are low. The change in high or low counts will be the jitter.

    If you want to try this method I could help you with the code. Let me know in this thread.

    Bean
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-15 19:47
    Another way to analyze jitter is to use the jittery clock to drive a PLL that has a long time constant. Then look at the output of the phase comparator before it hits the low-pass filter.

    -Phil
  • jmgjmg Posts: 15,189
    edited 2012-03-16 00:50
    darreno wrote: »
    I was planning on measuring the jitter of a beat oscillation using one of the counters. From what I understand, if you can generate a stable frequency close to the signal being tested the beat between the two magnifies the jitter. So if I am able to use a 10MHz clock generated from an 80Mhz propeller to mix against a 980Khz clock the beat frequency should be 20Khz. The jitter should be amplified by 500x, which is what I hope to measure.

    This is all theory, which I may be not fully understanding.

    A question about the WAITPEQ, does it start the next instruction on the next clock cycle or after 6 cycles. I don't understand if the 6 cycle time for the instruction includes any latency after the condition is met.

    IIRC WAITPEQ takes 6 cycles to 'get going' but thereafter it will sync to 1 clock, not the usual 4.

    What time frame jitter do you want ? Do you mean measure the ppm error, or do you expect more jitter on this.4MHz ?

    Generating Fsys/2^N will avoid any NCO rounding jitter, but it will have PLL jitter.
    You could mix this down to an Audio range, and then use a Sound Card to get the spectrum which will give more info about the jitter.
  • darrenodarreno Posts: 16
    edited 2012-03-16 09:26
    Thanks for all the ideas. Phil, can you recommend a PLL or two for my next parts order? a 4046?

    This all came about when I started playing with a Si5351 clock generator. It's a fractional N clock that is very cheap but advertises a high max jitter (100ps). The datasheet doesn't say much about how to calculate the jitter given a choice of divisors so I though I'd learn how to measure it myself. I found out that jitter analysis tools even for a moderate clock rate can be expensive.

    I think I may try a few different methods so I can compare them.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-16 09:36
    100 ps? Oh. I doubt that a 4046 (or any phase comparators that I'm familiar with) could switch that fast. And that may well be under the switching-time uncertainty of most logic chips. 'Probably explains why professional jitter analyzers are so expensive.

    -Phil
  • darrenodarreno Posts: 16
    edited 2012-03-16 11:35
    I was hoping to measure indirectly using jitter expansion which by the equations would be in the double digit ns range.

    This may be an entire waste of time other than a good learning experience.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-16 13:26
    Take a look at this thread:

    'Different app, but similar issues and a solution like what you're proposing.

    -Phil
  • jmgjmg Posts: 15,189
    edited 2012-03-16 17:12
    darreno wrote: »
    Thanks for all the ideas. Phil, can you recommend a PLL or two for my next parts order? a 4046?

    This all came about when I started playing with a Si5351 clock generator. It's a fractional N clock that is very cheap but advertises a high max jitter (100ps). The datasheet doesn't say much about how to calculate the jitter given a choice of divisors so I though I'd learn how to measure it myself. I found out that jitter analysis tools even for a moderate clock rate can be expensive.

    I think I may try a few different methods so I can compare them.

    Look at the report file for the Si5351, and you can 'work backwards'
    It has a choice of pre-PLL lock, and post PLL - the Post PLL works like a NCO, so does a fractional divide from the VCO, and that will jitter at the VCO frequency.
    They do mention the VCO somewhere, IIRC just under 2GHz, so peak jitter can be derived from that.
    If you avoid the post-fractional, then the jitter will be much less.

    If you want to test this more, the best way is likely to use TWO Si5351, and get the reports and then use the beat system then to check jitter.
  • darrenodarreno Posts: 16
    edited 2012-03-16 20:53
    Thanks for the thread link on the rangefinder. It was very interesting to follow the development. "The laser module is the quickest and easiest module to test. It either works or blows up" :o


    jmg, I'm not sure I understand what you mean by the report files for the 5351. Here's what the summary output of the "clock builder" application.

    PLL A
    Input Frequency (MHz) = 25.000000000
    VCO Frequency (MHz) = 800.000000000
    Feedback Divider = 32
    SSC disabled

    PLL B
    Input Frequency (MHz) = 25.000000000
    VCO Frequency (MHz) = 656.640000000
    Feedback Divider = 26 166/625

    Output Clocks
    Channel 0
    Output Frequency (MHz) = 0.100000000
    Multisynth Divider = 250
    R Divider = 32
    PLL source = PLLA
    Initial phase offset (ns) = 0.000
    Inverted = No
    Drive Strength (mA) = 8
    Disable State = Low
    Channel 1
    Output Frequency (MHz) = 0.090000000
    Multisynth Divider = 228
    R Divider = 32
    PLL source = PLLB
    Initial phase offset (ns) = 0.000
    Inverted = No
    Drive Strength (mA) = 8
    Disable State = Low
  • darrenodarreno Posts: 16
    edited 2012-03-17 09:41
    I just read Bean's thread about the cable length measurement and noticed something that could be related to this topic.

    http://forums.parallax.com/showthread.php?135563-Measure-the-speed-of-electricity...

    In one of the posts Bean said "The reading are pretty jittery".

    I'm wondering now if that was just the result I'm looking for.
  • jmgjmg Posts: 15,189
    edited 2012-03-19 00:55
    darreno wrote: »
    jmg, I'm not sure I understand what you mean by the report files for the 5351. Here's what the summary output of the "clock builder" application.

    Here are the relevent lines, with the rest deleted

    PLL A
    Input Frequency (MHz) = 25.000000000
    VCO Frequency (MHz) = 800.000000000
    Feedback Divider = 32
    PLL B
    Input Frequency (MHz) = 25.000000000
    VCO Frequency (MHz) = 656.640000000
    Feedback Divider = 26 166/625

    Output Clocks
    Channel 0
    Output Frequency (MHz) = 0.100000000
    Multisynth Divider = 250
    R Divider = 32
    Multisynth Divider = 228
    R Divider = 32


    Note Silabs also have an option to have fractional post PLL dividers, which I think SiLabs call Multisynth Divider & R Divider
    - so the channel with no fractional numbers at all, would make a good beat choice for a channel chosen to have fractional
    Feedback Divider, or fractional Multisynth Divider
    - so you can then measure the effect of the 'closer average value' has on the peak jitter.

    Even a LV4046 would be useful here, as the sub 1ns phase change will show up on the Phase Detector output, as a level change, at rates shown by the Egyptian fractions - and a Narrow Pulse PhaseDet will have more mV/ns gain, than the XOR PhaseDet.
Sign In or Register to comment.