More on Equivalent Time Sampling with the ADALM1000

As was discussed in a previous blog, a new version of the ALICE 1.1 desktop software suite for ADALM1000 (as of 7-5-2017) now includes an option that implements a form of equivalent time sampling or ETS. In this blog I will be going into more details about how this is done and the limitations of using it.

Periodic waveforms

The key to understanding how this "magic" works is to realize that many of the kinds of signals that an oscilloscope user might like to measure are periodic. That is, they have a fixed pattern or shape that repeats periodically. Indeed it is almost impossible to see any other type of signal with an ordinary (non-sampling) analog oscilloscope. A digital oscilloscope like ALM1000 can of course capture and store any non-periodic waveform at the base real time sample rate. Often the analog signal chain and the ADC used in a scope like the ALM1000 have more usable bandwidth than one half the sample rate.

Sub-sampled waveform capture

If you display a buffer of raw data captured from a signal with a higher frequency than even one tenth the sample rate (10 samples per cycle), you will still see a waveform; just not much detail. If the sampling frequency is not exactly an integer fraction (or multiple) of the input frequency each sample represents a unique point somewhere along the repeating waveform. For example if we look at the following figure we see a case where the sample frequency is slightly slower than the input frequency, by a factor of 19/20. So from the top graph we see that 20 unique points are obtained from 20 different cycles of the input signal. If these sample points are then assembled in the proper order we get the graph on the bottom. Sub-sampling with a ratio of 19/20.

In this simple example the points are just plotted in the order they are taken. If, on the other hand, the ratio of the input frequency and the sample rate were the other way around, 20/19, then each sample would come earlier in each cycle and it would look like time was going backward if the points were plotted in the same order. To make time increase the order of the points would need to be reversed. This sub-sampling has the same effect as a down conversion mixer shifting the input to a lower frequency, even DC for certain ratios like 1, or 2 or 3 etc.

This technique assumes that either the sample rate or the input frequency or both are adjustable such that a known ratio can be calculated. In the case of the ALM1000 we have only the fixed sample rate of 100 KSPS to work with.

Fortunately it is possible to use a different approach. Instead of trying to set the exact ratio, the fixed 100 KSPS sampling rate is used and if we know the frequency of the input signal an actual ratio is then calculated. With this known ratio it is very easy to find out which sample within the record has what delay (or its position) within the input waveform period.

As an example lets again use a simple ratio where the input frequency is 39/20 times the sample rate or there are 1.95 cycles per sample. It means than every following sample is delayed by 1 full cycle and 0.95*T, where T is the time index in the record, relative to the current one. If we do the calculations shown in the following table where we multiply the cycles per sample by the time index and then take just the fraction part in the last column. If we multiple this fraction of a cycle by the length of the record we have the position to place that sample in a new re-sorted sample record.

 Sample Index relative sample time relative sample position 0 0.00 * T 0.00 T 1 1.95 * T 0.95 T 2 3.90 * T 0.90 T 3 5.85 * T 0.85 T 4 7.80 * T 0.80 T 5 9.75 * T 0.75 T 6 11.70 * T 0.70 T

To implement this idea in ALICE we use two variables. One is the dividend of the fraction of the sample rate we are targeting. For example if we want to observe input frequencies just above (or below) 1/6 of the sample rate (multiples of 16,666.67 Hz), we use 6. Another is what I call an offset for lack of a better term. A number of possible values can be used for this, ALICE starts at -25 and adjusts this factor to get a record length based on the time/Div setting. But never using a record length larger than the 95,000 sample limit.

First we need to calculate how many samples (length of the record) will be needed to capture the right number of input waveform cycles. As we have already pointed out there are only certain fractions of the fixed sample rate that we can use.

Record Length = (Dividend * Sample Rate) / (10,000 * Offset)

For example for a divide factor of 6 and an Offset of -25 we get a record length of 24,000 samples or 240 mSec. This means that the lowest frequency we can shift an input waveform to and see one complete cycle would be 1/240 mSec or slightly more than 4 Hz. The idea is to shift the input to somewhere between 100 Hz and 5 KHz for optimal display, the lower the frequency the higher the effective sample rate will be.

Now we need to calculate the factor we need to multiply the fractions of a cycle or each time index (right hand column in the table) by.

Index multiplier = int(Record Length * (Sample Rate + Offset ) / (Sample  Rate))

This may seem all very complicated and it is. That is why the software does all the calculations and plots the results for you.

Divide factors from 1 to 75 are allowed in the program. A spread sheet attached to this blog calculates the base frequency for various divide factors and multiples of them so you can more easily find the right value for a given input frequency.

The ETC controls in ALICE.

To control all this ALICE has an ETS widow. The real time sample rate of 100000 is shown at the top as a reminder. Next is a check box to turn on and off ETS. Next you enter the Divide factor, in this case 4 was used. From the divide factor entered ALICE picks an offset and record length to best display the input signal. The base or minimum frequency is shown, in this case 1/4 of the sample rate or 25,000 Hz. This is the frequency that will be shifted to DC. The user can then enter the frequency multiplier. Multiply factors from 1 to 75 are allowed in the program. The multiplied value is displayed. This does not really change anything in how ALICE displays the signal. It is handy to use this value when setting the frequency of the input source. There is a button to load this value to the SparkFun MiniGen AD9837 based DDS function generator if one is connected. The software adds 20 Hz to the value if the Forward button (under Sample Data Order) is checked or it subtracts 20 Hz if Reverse button is checked. ETS controls

As was pointed out earlier if the input frequency is above or below the Base frequency (the frequency shifted to DC) the order of the samples will be either forward or reversed in time. These controls allow the user to pick which way to order the data.

There is a major complication in the case of the ALM1000 and how the A and B channels are sampled. The A channel samples first every 10 uSec (100KSPS) and channel B samples second, 5 uSec later, between the channel A samples. This is not so big a deal in real time sample mode and ALICE handles this when drawing the traces. But in ETS mode this 5 uSec difference causes the channel B data to shift all over with respect to channel A depending on the frequency of the input and to what frequency it is down shifted to. Think of this 5 uSec difference with respect to the equivalent time sampling rate which might be many MHz.

To adjust for this difference there is a place to enter a shift factor for channel B. This shift factor is in sample points. The best way to adjust this is to connect both channels to the same signal and adjust the value until the two waveforms are on top of each other. A positive number shifts the trace to the right and a negative one shifts it to the left. Either might be necessary depending on the Forward or Reverse data order. Then move channel B to the other signal you wish to observe.

For example, let's try this using a 32.768 KHz watch crystal and some CMOS inverters to make an oscillator and capture the output and an inverted output using an ALM1000. The ETS controls are set as shown, with the divide factor set to 61 which gives a base frequency of 1639.34 Hz. A multiplication factor of 20 gives a target frequency of 32.7869 KHz which is very close to the 32.768 KHz of the crystal. The Reverse button is set because 32.768 KHz is less than 32.7869 KHz. The CH B time shift is adjusted such that the A and B waveforms are aligned when both are connected to the same signal. EST settings for 32.768 KHz oscillator

The record length is 39354 samples so the screen update rate is slower than RTS at the same Time/Div setting at about twice per second.

The outputs of two inverters driven from the oscillator are shown in this screen shot. The 32.768 KHz is down shifted to about 1.1 KHz for an equivalent time sample rate of about 3 MSPS. ETS plot of 32.768 KHz crystal oscillator

So in conclusion with equivalent time sampling a relatively low sample rate digital scope like ALM1000 can provide results similar to higher cost instruments that have much higher real-time sampling rates when used with periodic signals.

global EnableMinigenMode; EnableMinigenMode = 1