**Binary search, a decrease-and-conquer approach, plays an important role in testing today's low-pass filters. **

When testing a low-pass filter, generally you have to use an arbitrary waveform generator (Arb) to create test tones to pass through the filter to measure the relative gain or attenuation of each tone to find the cutoff frequency of the filter. You also can modify this approach several ways, such as using a multitone or even a wideband periodic white-noise signal to reduce test time and increase throughput.^{1 }

There is a downside to using an Arb. The highest frequency you can attain from an Arb is one-half the maximum sampling frequency (FS), which severely limits what devices you can test.

One of today's challenges in consumer device test is moving from standard definition television (SDTV) to the new high-definition television (HDTV) devices. Many existing mixed-signal testers are equipped with an Arb originally designed to test SDTV parts and may not be able to generate the 75-MHz out-of-band waveforms required for testing HDTV parts.

When faced with this problem, the following issues should be considered:

• An Arb can handle the filters• in-band tests but not the out-of-band tests.

• Digital pins can generate the out-of-band signals, but digital pins only can generate square waves.

• What is a square wave but a sine wave with a bunch of odd harmonics?

• HDTV filters are low-pass filters. What will that do to a square wave? It will remove the harmonics.

To an HDTV filter, a square wave becomes a sine wave due to the filtering effect of the filter. Once the DUT removes the harmonics, the waveform to the tester's analog capture instrument (ACI) is a sine wave. We can use standard DSP analysis techniques to find out what the filter did to the input waveform just as if it had been a sine wave. Also, the FFT can easily separate the fundamental amplitude from the remaining harmonics, so all we have to do is ignore anything that is not in the fundamental bin.

Most ACIs are paired with the Arb, and they generally have similar sampling frequency limitations. However, while you can t generate a waveform faster than one-half the sampling frequency with the Arb, you can sample waveforms faster than one-half the sample frequency of the ACI using aliasing.

With an ACI, you can sample anything even slightly beyond the bandwidth and let the signals alias. Most tests that exceed the capabilities of the Arb are relative attenuation or gain of the input signal to the output. These tests are specified at a single frequency and usually don't include more traditional tests like total harmonic distortion (THD) and signal-to-noise and distortion ratio(SINAD) that would prevent us from using a digitally generated square wave.

**Low Pass and Bypass**The first thing a test engineer must provide is a bypass path on the load board to allow the program to perform a calibration of the signals. As most HDTV filters are tested at 70 MHz or higher, there may be some roll-off by the ACI. Parasitic lumped capacitance, insertion loss, and other physical factors on the load board also will affect the actual magnitude that the ACI will capture at various frequencies.

If we capture the tone directly from the signal source, we can compare the magnitude of the bin of interest to the known amplitude of the source. From that we can derive a correction factor that we can apply to correct either the captured DUT signal or adjust the signal source. In practice, it is a good idea to do this with all signals that you will be testing for attenuation or gain. Usually such calibration will only need to be done once prior to the first device to enhance the accuracy of all your attenuation gain or measurements.

**Reflecting on Reflections**The typical digital pin's intrinsic impedance is 50-Ω. HDTV filters are intended to operate in a 75-Ω environment. Because we are using square waves as a signal source, we need to be very careful about reflections. As a result, in all likelihood, an impedance matching circuit must be incorporated on the load board.

Usually a 50-Ω resistor is placed as close as possible to the DUT and before any in-series DC blocking capacitors. As the ACI will, in all likelihood, be placed into the 50-Ω AC coupled mode, a 100-Ω resistor, again placed as close as possible to the DUT, will help limit any reflections on the output (**Figure 1**).

Since these resistors need to be as close as possible to the DUT, they probably will not be in the calibration path. The input 50-Ω resistor will form a 2:1 voltage divider, and the input voltages (VIH) will have to be adjusted accordingly. The 100-Ω resistor on the output also will form a 3:1 divider, and the magnitude of the captured bin will have to be adjusted prior to applying any calibration factors.

By calibrating many frequencies and then taking multiple measurements, we can even create a bode plot of the DUT's frequency response and determine the -3 dB cutoff frequency.

However, creating such a plot is quite slow due to the number of individual tests that must be run; it's far more inefficient than using a spectrum analyzer. Rather than sweeping our digital cycle to test each frequency, we can borrow something else from the digital side: the binary search.

Using a binary search technique, we can test two endpoints, or bounds, to make sure the filter attenuation point of interest, such as the -3 dB point, is inside those bounds and split the difference until you reach the resolution of the instrument. In this case, the resolution either will be the digital clock timing resolution or the Fourier frequency, whichever is greater.

**It's All Relative**Before we start the binary search, we need to establish a baseline measurement. The -3 dB point is measured relative to some in-band frequency, so the first thing you need to do is test the filter's gain at that frequency. Then, all measurements afterward can be made relative to that value. For example, for an HDTV filter, 1 MHz is well within the passband, so make one measurement at 1 MHz, store the result, and then use that in later calculations to figure out how far down the filter is at higher frequencies.

**Spectral Issues**You will need to set up the digital subsystem to generate a 50% duty-cycle clock at every frequency you might want to test. The duty cycle must be 50% to suppress even harmonics that could cloud the spectrum, especially once aliasing sends all the clock components bouncing around. Having twice as many aliases bouncing around isn't going to help us isolate the signal.

Once the digital section is ready to go, the ACI needs to be set up. The easy way to do this is to compute the sample frequency for each test frequency by attempting to keep the fundamental frequency falling in the same place in the spectrum. We want to keep the fundamental frequency down low in the spectrum, relatively close to the DC bin. The reason for this is simple: Any odd harmonics that the filter doesn t cut off will end up being digitized and in our spectrum.

If we keep the fundamental frequency low in the spectrum, the odd harmonics should dissipate before aliasing back into the signal bin. Adding additional unwanted amplitude from aliasing to our signal would artificially inflate the signal leading to error.

Remember that while testing a low-pass filter, we are using low, middle, and high frequencies. The low frequencies will have harmonics that are still passed by the filter, and it's best to keep those at arms length by giving them some room to fall to the right of our fundamental. If the fundamental falls too far to the right in the spectrum, its harmonics will alias back, and that could be problematic when they add to our fundamental.

**Window Dressing**To make it easier, we capture noncoherently so we will need to apply a window before we do the FFT. Our favorite for this application is the Blackman because it has less spreading than some other windows. As a result, the code to reconstitute the amplitudes into a single bin is simpler and faster.

The window is created beforehand and never has to change as long as the number of samples doesn t change. After the capture, remove the DC offset from the captured waveform by subtracting the arithmetic mean from the waveform. Without this step, the DC in the waveform will smear in the spectrum, causing a lot of problems. Never forget this step!

Next, apply the window and then do the FFT and finally convert to magnitude. There is no need to convert to polar because we don't need the phase waveform and it takes time to calculate.

Now search the magnitude waveform for the maximum. If you set up your sample frequency to keep the fundamental in about the same bin regardless of the test frequency, just look in that area. We say about because this was a noncoherent capture. In others words, this is more like horseshoes than hunting. It's OK if you miss, just as long as you get close.

The magnitudes of the signal that passed through the filter will concentrate around the maximum bin. All that's left to do is to coalesce the relevant bins into a single answer. We do that by taking the rms of five bins: the maximum bin, the two to the right since a Blackman window has a spreading factor of 2, and the two to the left. This value is the amplitude of the signal that made it through the filter.

Repeat this using the binary search algorithm until you converge on the right answer.

**The Search Is On**The search begins by establishing two limit frequencies. The gain at one of these limits should be above the -3 dB threshold relative to the baseline reference measurement we just made, and the gain at the other limit should be below the -3 dB threshold. If the gains measured at both limits are roughly the same, then the -3 dB point probably is not between them. At that point, the search should be abandoned and you should issue an error message.

Once we have determined that the -3 dB point is between the two limits, set the next test frequency between the two limits and test again. Based on the amplitude found at this frequency, you can decide whether you need to go lower in frequency if the gain was lower than -3 dB or whether you need to go higher in frequency if the gain was higher than -3 dB. This is illustrated in **Figure 2**.

The next test frequency is calculated by dividing the difference between the two latest test frequencies by two and adding it to or subtracting it from the last test frequency. Eventually, the delta gets smaller and smaller as it repeatedly is divided by two until it reaches a value below the resolution of our search solution. Again, this is based either on the highest Fourier frequency of our sampling solution or resolution of the clocking hardware.

Once the delta goes below the resolution of your search, you need to stop searching and pick a number. Note that there is quantization error in the final test frequency; it may not be the best answer. Evaluate the last two answers. The result of the search should be the frequency that came closest to the target value of -3 dB.

In developing this technique, we added an option to create a false spectrum, essentially a made-up spectral plot with an artificial resolution that approximates the actual spectrum of the various sampling solutions that the program chose for us. There is no true spectrum because each test frequency had its own sampling frequency and, consequently, its own spectrum.

Nonetheless, we can approximate what a composite spectrum would have looked like and place the relative amplitude results of the search into that spectrum to help demonstrate this technique. You can clearly see the binary search in action. At the left-most side, you can see the 1-MHz reference signal at an amplitude of 1.0 V (**Figure 3**).

At 10 MHz, the lower limit, it comes out fairly close to 1 V as well. At the far right, around 45 MHz is the upper limit. It came out at around 0.4 V or -7.9 dB. The search algorithm then tested exactly in the middle at 10 MHz + ((45 MHz – 10 MHz)/2) or 27.5 MHz. The value there was around 0.74 V, about -2.6 dB. Since that is higher than -3 dB, it split the difference again and jumped up to 27.5 MHz + ((45 MHz – 27.5 MHz)/2) or 36.25 MHz.

**Conclusion**You don't need a spectrum analyzer or a UHF Arb to test HDTV filters. All you need is a mixed-signal tester with good digital subsystem, a wideband ACI, and knowledge of DSP to test these parts.

**Reference**Bullard, D., and Reynolds, D., It's All in the Noise,•

*Evaluation Engineering*, March 2004, pp. 12-16.

**About the Authors**Steve Holder is a marketing applications engineer at Nextest Systems. He has been involved in various aspects of semiconductor ATE since 1985. Nextest Systems, 10200 S.W. Nimbus Ave., Suite G4, Tigard, OR 97223, e-mail: [email protected]

*Dan Bullard is a senior member of the technical staff at Maxim Integrated Products. He has been in semiconductor test since 1984. Maxim Integrated Products, 7250 N.W. Evergreen Parkway, Hillsboro, OR 97124, e-mail: [email protected]*