Global TMW:
Login  |  Register          Free Newsletter Subscription
Subscribe
Email
Print
Reprint
Learn RSS

Test fast clocks on the cheap

You can use an inexpensive digital tester to measure frequencies into the hundreds of megahertz.

Dan Bullard, Nextest Systems, and David Reynolds, Protest -- Test & Measurement World, 5/1/2005

 
   
 
For More Information

Read other articles from this issue:
Table of contents, May 2005

FEATURES
Built for the long haul
Test fast clocks on the cheap
Concurrent test
Spin, look, and measure
When you need to measure the frequency of a high-speed clock, you probably look for an expensive rack-mounted box to do it. Not so fast. Instead, try using the digital-capture capability on your cheap digital tester, along with a few DSP library functions. Here's how to do it.

Nyquist was just an alias

Sampling theory, most people believe, says that you must take samples at more than two times the highest frequency of interest, so if you want to capture a 160-MHz clock (for example), you must capture at greater than 320 MHz. This is not really what Nyquist said, however. You need to obey this rule only if you want to avoid aliasing. (And by the way, telecommunications pioneer Harry Nyquist's name is itself an alias. His family name was Jonsson, but Harry's father, Lars, changed it, because another Lars Jonsson lived just down the road, and mail delivery became a real problem.)

If you capture a 160-MHz clock with a 33.333-MHz sampler, such as the Nextest Maverick's digital capture instrument (DCI), the clock signal will indeed exhibit aliasing—that is, it will look like another, lower frequency. This could be a problem if you don't expect this to happen, but if you do, you can use aliasing to your advantage.

A 160-MHz clock will alias back to 6.666 MHz. (160 MHz is just 6.666 MHz below 33.333 MHz times five, or 166.666 MHz.) Figure 1a shows the various bands created in the frequency domain by sampling at sampling frequency fS equals 33.3333333 MHz. At the far right of Figure 1a is the band of 133 MHz (4x33 MHz) to 166 MHz (5x33 MHz). An instrument like the DCI doesn't allow you to actually see signals in these bands, but they do exist, and the proof of that is the alias that falls back into the Nyquist band, denoted here in yellow, running from DC to 16.666 MHz (fS/2).


Since 160 MHz falls just 6.666 MHz below 166.666 MHz, it will alias back through the various bands (which you also can't directly observe), denoted as dashed red arrows. Eventually, an alias that you can see, 6.666 MHz, will appear in the Nyquist band. The reason the alias fell 6.666 MHz above DC is that it came from the upper half of the band, above 4.5 times the sampling frequency, so it folds back, appearing in reverse like an image in a mirror. The phase is reversed too, although for this purpose, that's not really important.

 
Figure 1.  Sampling a 160-MHz signal at (a) 33 MHz and (b) 25 MHz leads to ambiguities that (c) an orthogonal sampling rate, such as 25.66 MHz, removes.

Now that you can see 6.666 MHz in the Nyquist band, does this mean that you are capturing 160 MHz? Not exactly. If you do see 6.666 MHz in the Nyquist band, it could indicate 160 MHz, or it could indicate any one of the other frequencies listed across the top of Figure 1a (26.6, 39.9, 60, 73.3, 93.3, 106.6, 126.6, or 139.9 MHz). Concrete proof that 6.666 MHz in the Nyquist band came from capturing 160 MHz has to come by sampling again at a different sampling frequency.

Which alias is which?

If you sample the 160-MHz clock again with a sampling frequency that is different from the original 33.333 MHz, the aliases will fall in different places. If you see an alias fall in a place that also suggests that you captured 160 MHz, then it's pretty likely that you captured 160 MHz in both instances and you can rule out the possibility that any of the other frequencies was captured. The new sampling frequency can't be closely related to the original, however; otherwise they will have common factors that will cancel and arrive at lower frequencies than the 160 MHz. For example, if you sampled 160 MHz again with a sampling frequency of 25 MHz (the inverse of 40 ns) the true answer won't be so obvious (Figure 1b).

Sampling at 25 MHz means that 160 MHz shows up 10 MHz above 150 MHz (6 times 25 MHz), so it will alias down to be 10 MHz above DC back in the Nyquist band. The bad news is that because 33.333 MHz (the inverse of 30 ns) and 25 MHz (the inverse of 40 ns) share a common factor of 1/(10 ns), or 100 MHz, they end up with common alias products.

Comparing Figure 1a and Figure 1b, you can see the problem. Note that 60 MHz appears in both lists of alias frequencies (the numbers across the top). This means that if you see something appearing at 6.666 MHz when sampling at 33 MHz, and you see something appearing at 10 MHz when sampling at 25 MHz, the captured signal could be 160 MHz, but it could also be 60 MHz. Now, if you are pretty sure that you aren't going to see 60 MHz, this could be fine. But how many test escapes are you willing to explain to your customer when the clock on the device turns out to be defective?

Let's get orthogonal

For the second sampling that will confirm the actual captured signal, you need a sample frequency that will not be related in any way to the original sample frequency; that is, it should have no common factors. One way to achieve this is to use a PLL to offset the system clock so you can get away from the standard system-clock-period resolution.

In the Nextest Maverick, you can use the APG PLL for this purpose. You must pick a frequency that has few if any common factors with the 33.333-MHz sample rate. For this example, we picked what looked like a fairly obscure system clock rate of 77 MHz (the inverse of 12.987013 ns), for a period of 38.961039 ns (three times the system clock period). This gives a sampling frequency of 25.666666 MHz. Unfortunately, you can't switch in the PLL on the fly, so you'll have to do one capture, reset all the timing, and then do another capture, but since the capture time is pretty fast (about 1 ms for 1-kHz resolution), it doesn't add much to the test time.

Using this sampling frequency, the alias diagram should now look like Figure 1c, where 160 MHz falls exactly 6 MHz above 154 MHz (25.66 MHz times 6), so the alias ends up at 6.0 MHz in the Nyquist band. Note that the list of alias frequencies (across the top), are wholly different from the list generated by sampling at 33.333 MHz. This is crucial in making this technique work. You can confirm this yourself by once again looking at Figure 1a. There are no frequencies that appear in both alias lists (the top row of numbers) except the right answer, 160 MHz.

Remember, you'll need two different timing setups, two different patterns, and two different functional bursts. It's no good trying to switch timing sets on the fly, because most testers do not support switching time bases on the fly.

You'll need to set up your capture instrument to capture a single pin (the clock pin); the instrument will collect a sequence of 1's and 0's that represent the clock pin's transitions. Obviously, the comparator voltages need to be set to the 50% point of the clock, and an active load may be applied if the pin needs termination.

Once the functional test process has completed the capture, extract the digital data to move it into a waveform. Next, subtract 0.5 from the waveform, that way, a captured "1" represents a voltage of 0.5, and a captured "0" represents a voltage of –0.5. (We'll explain the reason for this later, under "Resolution and Nyquist issues.")

Be sure the waveform X scale is set to the actual sample rate of the capture, or you will never get the right answer. Some testers do this for you automatically; others cannot because the capture instrument is not intended for time based waveform capture.

Just what frequency is it?

Now that you have two waveforms captured at two different sample frequencies, how can you measure the frequency of the clock signals they hold? While it is tempting to count the number of transitions in the waveform and then divide by the UTP (unit test period), this method just won't work.

The waveform may contain a small number of "runt transitions"—extra edges that occur close to the comparator threshold induced by noise. These extra transitions will cause this technique to overestimate the clock frequency, causing false readings.

One technique for turning time-domain data into frequency-domain—the FFT—data also provides very high noise immunity. The FFT will treat the runt transitions as noise so they won't interfere with your measurements.

All you have to do is perform an FFT, convert to magnitude (ignoring the phase), and look for the highest amplitude signal. Since the data in the waveform is a square wave, there will be other components too (mostly odd harmonics), but by looking for the maximum value in the magnitude spectrum, you can find the location of the highest amplitude signal that has to be the fundamental of the clock that you captured.

 
Figure 2.  Nextest’s Mixed Signal Wavetool shows the frequency-domain version of a 160-MHz clock captured (a) at 33.333 MHz and (b) at 25.666 MHz.
Figure 2 shows the frequency-domain version of a 160-MHz clock captured first at 33.333 MHz and then at 25.666 MHz. The resolution of the frequency data in an FFT depends on two factors, the sample rate and the number of samples. The formula for the Fourier frequency isfF= fS/N. The example here has two sampling frequencies, so you have two resolutions:

33.333 MHz/32768 = 1017.25 Hz

and

25.666 MHz/32768 = 783.28 Hz

Your number of samples should be a compromise between test time and resolution. But being able to measure a 160-MHz clock with better than 1-kHz resolution is pretty good (approximately 6 ppm), especially given the fact that you can do this on a 33-MHz base-rate tester. The accuracy is half the resolution. If you want better, you'll pay for it, because the FFT time goes up pretty fast from here.

You could get 24.5-Hz resolution if you capture a million (220) samples, but an FFT on 1 million samples will bring even a dual Xeon computer to its knees for several seconds. Remember also that FFTs are most efficient when they operate on a power-of-two number of samples. Also note that this is one place a slower tester has an advantage—sampling slower gives you better resolution!

Stop at the intersection

Once you've measured the two alias frequencies, search the list of frequencies that the signal could be and see if you find an intersection. You'll need to write some code to look at the aliased frequencies to try to figure out where they intersect.

The best way to do this is to build a table having two rows containing the candidate frequencies for each of the sample rates. Search the rows for an intersection, or a match between the two lists (Table 1).

 

Because this example used two sampling frequencies that were orthogonal—that is, without common factors—there is no chance for overlap until you get above the gigahertz range. This is not likely to be a problem because the pin comparators on most cheap testers just don't have the bandwidth to go into the gigahertz range.

Once you have a match, you can infer that 6.666 MHz captured at 33.333 MHz and 6.0 MHz captured at 25.666 MHz are actually aliases of a 160-MHz clock. If it's not exactly 160-MHz, that will be apparent too, because the aliases will have drifted the same amount relative to their sampling frequencies, and will show up as 159.5 MHz or 160.2 MHz or whatever. In other words, this is not just a solution for a 160-MHz clock; this is a solution for just about any frequency you can capture with a digital pin comparator.

Resolution and Nyquist issues

You generally have to allow a little leeway when you look for matches in the two tables. This is done in case the frequency has drifted between the two captures, and to allow for the noncoherent nature of the capture. You have to avoid giving too much slop, however, because of a potential problem that could happen near the Nyquist and DC frequencies.

If the clock you are measuring gets very near a boundary, it's difficult to tell which side of the boundary the alias actually belongs to. For example, if you capture a 133.0-MHz clock with a 33.333-MHz sample clock, you'll see an alias appear at 333.333 kHz in the Nyquist band (333.333 Hz below 4 times 33.333 MHz). But that alias could also mean that you actually got a clock at 133.666 MHz (333.333 Hz above 4 times 33.333 MHz). If you allow for too much slop, you could pick the wrong number.

There are certain frequencies that are harder to measure than others, specifically K times one of the sample frequencies (where K is an integer). If the frequency you are measuring is exactly the same as one of the sample frequencies, most if not all of the samples will fall on either all high or all low. If they fall on all high, that's fine, the FFT will reflect that by putting a high value in the DC bin, and the software will find an intersection between DC and an alias of the frequency sampled at the other sample rate.

If, however, you failed to subtract 0.5 from your captured waveforms as we mentioned previously and you capture all lows, there will be no amplitude in the DC bin to detect. By subtracting 0.5 from the captured waveforms, you assigned a value of +0.5 to a solid high, and –0.5 to a solid low just in case the measured frequency falls into the DC bin due to aliasing. The polarity of the voltage doesn't matter to the FFT; it sees a magnitude of 0.5 either way.

You don't need to bolt an expensive box onto your cheap digital tester to measure a high frequency, even if it is far faster than your little digital tester can run. Just use the flexibility that's built into most testers to sample twice and beat Nyquist at his own game.



Author Information
Dan Bullard is a marketing applications engineer for mixed-signal products at Nextest Systems. He has previously worked at GenRad, Credence systems, and Schlumberger, and he began specializing in mixed-signal test in 1990. He works in Nextest's Portland Oregon Development Center.
David Reynolds is the director of software at ProTest. Previously, he was a principal software engineer for Credence Systems. He has 30 years of experience in the software industry. daver@protestinc.com.

 

For More Information

* On ATE, visit www.tmworld.com/ate

Email
Print
Reprint
Learn RSS

Talkback

We would love your feedback!

Post a comment

» VIEW ALL TALKBACK THREADS

Related Content

Related Content

 

By This Author

There are no other articles written by this author.

Sponsored Links



 
Advertisement
SPONSORED LINKS

More Content

  • Blogs
  • Podcasts

Blogs

  • Martin Rowe
    Rowe's and Columns

    August 11, 2008
    Grachanen wins NCSLI award
    At last week's NCSL International Workshop and Symposium, Chris Grachanen was awarded the NCSLI Educ...
    More
  • Martin Rowe
    Rowe's and Columns

    August 8, 2008
    Have you seen Test Ideas?
    The August print issue of T&MW features a new column called "Test Ideas." For this fir...
    More
  • » VIEW ALL BLOGS RSS

Podcasts

Advertisements





NEWSLETTERS
Click on a title below to learn more.

Test Industry News (3 Times Per Month)
Machine-Vision & Inspection (Monthly)
Communications Test (Monthly)
Design, Test & Yield (Monthly)
Automotive, Aerospace & Defense (Monthly)
Instrumentation (Monthly)
Resource Center E-Alert (Monthly)
©2008 Reed Business Information, a division of Reed Elsevier Inc. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy
Please visit these other Reed Business sites