FG/AWGs

Posts related to function / arbitrary waveform generators:
8/27/12
What is Trueform Waveform Generation Technology?

Trueform waveform generation technology is an exclusive technology found in Agilent’s new 33500B Series waveform generators. Trueform technology provides sizable advantages over direct digital synthesis (DDS), the incumbent technology used in waveform generators. These advantages include significantly lower waveform jitter for less test uncertainty and a true representation of the selected waveform, not an approximation. In this blog post, we will look at Trueform and compare it to DDS.

Conceptually, the simplest way to generate a waveform is to store its points in memory and then read those points out one after another and clock them into a DAC. After the last point has been read, the generator jumps back to the first point again to begin the next cycle. This is sometimes called “point per clock” (PPC) generation. Even though this method seems like the most intuitive way to create waveforms, it has two big drawbacks. First, to change the waveform’s frequency or sample rate, the clock frequency has to change, and making a good low-noise variable-frequency clock adds cost and complexity to the instrument. Second, since the stepwise output of the DAC is undesirable in most applications, complex analog filtering is needed to smooth the steps out. Because of its complexity and cost, this technology is used mainly in high-end waveform generators.

DDS uses a fixed-frequency clock and a simpler filtering scheme, so it’s less expensive than the PPC method. In DDS, a phase accumulator adds an increment to its output in every clock cycle, and the accumulator’s output represents the phase of the waveform. The output frequency is proportional to the increment, so it’s easy to change frequency even though the clock frequency is fixed. The output of the accumulator is converted from phase data into amplitude data typically by passing it through some type of look-up table. The phase accumulator design allows DDS to use a fixed clock, but still execute waveforms at a perceived faster sample rate than the clock. So with DDS, not every individual point is being expressed in the resulting output waveform. In other words, DDS is not using every point in waveform memory, but it creates a really good approximation. But since it is an approximation, waveform data is changed in some way. DDS can skip and/or repeat aspects of the waveform in an unpredictable way. In best-case scenarios, this leads to added jitter; in worst-case scenarios, severe distortion can result. Small features in the waveform can be partly or completely skipped over.

Agilent’s new Trueform technology represents the next leap in waveform generation technology. Trueform provides the best of both worlds. It gives you a predictable low-noise waveform with no skipped waveform points like PPC technology, but at the price point of DDS technology. Trueform works by employing a exclusive virtual variable clock with advanced filtering techniques that track the sample rate of the waveform. In the following sections, we will look at some of the waveform generation advantages Trueform provides over DDS.

Improved signal quality
One of the key advantages Trueform provides over DDS is better overall signal quality. One of the best ways to show this is by doing a jitter measurement comparison with DDS. The following figures show a jitter measurement made on a 10-MHz pulse signal using a high-performance oscilloscope. The scope view is zoomed in on the rising edge of the pulse signal with the persistence setting of the scope turned on. The histogram function of the scope is used to measure the period jitter of the signals. The standard deviation measurement in each figure is circled in red and represents the signal’s RMS jitter. The Trueform pulse signal jitter measurement is shown in the below figure and the DDS pulse signal jitter measurement is shown in the next figure.

Trueform signal with < 5ps of RMS jitter
DDS signal with > 50ps of RMS jitter
In the above figures both the amplitude and time scales for the scope are the same. The Trueform pulse waveform has more than 10 times less jitter compared to the DDS pulse waveform. The substantially lower jitter that Trueform offers over DDS means less uncertainty in your tests. This is especially true when you consider edge-based timing applications like generating a clock signal, trigger signal or communication signal.

The waveform you create is the waveform you get
As we mentioned earlier, DDS uses a fixed clock and a phase accumulator so it cannot guarantee that every point or feature in a waveform will be played. The higher the frequency, the more gaps you will see in the output waveform compared to the ideal waveform. Trueform, on the other hand, plays every waveform point regardless of the set frequency or sample rate. This becomes critical when you are dealing with a waveform that may have a small detail that is critical to the test you are performing. As an example, we created an arbitrary waveform that consisted of a pulse with seven descending amplitude spikes on top of the pulse. The waveform was then loaded into a Trueform waveform generator and a DDS waveform generator. First the waveform was played at a 50-KHz frequency on each generator. The result was captured on a scope, shown in the below figure. The yellow trace is the Trueform waveform and the green trace is the DDS waveform.
Trueform on top in yellow and DDS in green

At 50 KHz, each generator was able to reproduce the waveform with seven spikes on top of the pulse. You can see that the Trueform spikes reached higher amplitude. In the below figure scope screen shot, the waveforms were played again, but this time at 100 KHz.

Trueform on top in yellow and DDS in green. Note that all the DDS spike points were skipped
At 100 KHz, the Trueform waveform generator played all seven spikes and the DDS generator did not play any of the spikes. In the below figure scope screen shot, the waveforms were played again, but the frequency was doubled again to 200 KHz.

Trueform on top in yellow and DDS in green. Note that DDS only shows 3 of the seven spikes

At 200 KHz, once again, the Trueform waveform generator shows all seven spikes in the waveform. The DDS generator went from playing no spikes at 100 KHz to playing three spikes at 200 KHz. Notice that the three spikes played in the 200 KHz waveform do not match the correct time location of any of the seven spikes that are in the actual waveform points. These waveform examples demonstrate that when working with waveforms that have fine detail, DDS cannot be trusted.

Agilent’s Trueform technology offers a new alternative that blends the best of DDS and PPC architectures, giving you the benefits of both without the limitations of either. Trueform technology uses an exclusive digital sampling technique that delivers unmatched performance at the same low price you are accustomed to with DDS.



8/21/12
Agilent Announces a New Family of Waveform Generators with Exclusive Trueform Technology

In this blog post we will look at Agilent's new family of waveform generators, the 33500B series. The new family is made up of 8 models that offer bandwidths from 20 to 30 MHz and offer one or two channels. The 33500B family features the exclusive Trueform waveform generation technology. Trueform technology plays every point in an waveform, unlike the incumbent direct digital synthesis (DDS) technology which only provides an approximation of a waveform (not every point is played). Also Trueform technology delivers waveforms with extremely low jitter typically around 4 ps of RMS jitter, which is more than 10x less jitter than a DDS generator. I will have more detailed info on Trueform in a future post. Here are some more 33500B series headlines:

  • Full bandwidth pulse and square waves
  • Sine waves with 5x lower harmonic distortion
  • IQ signal player option
  • Advanced modulation features such as sum modulation and channel to channel modulation
  • 16 bits of resolution with 1 mVpp to 10 Vpp amplitude
  • Noise function with variable bandwidth adjust and no repetition for over 50 years of continuous play
  • The ability to upload arbitrary waveforms and sequences without a remote connection

For the two channel version there is an IQ signal player option available. IQ signal waveforms can be played from the 33500B without the option, but the option adds an easy to use single user interface for setting up and controlling both channels at once. Also the option offers features such as channel skew adjust and balance control for adding non-ideal conditions to the signal to test the limits of your design. 

For an IQ example a 64 QAM baseband signal was created in software. It was then uploaded to and played by the 33522B waveform generator using the IQ signal player option. The resulting IQ baseband signal was captured by a high performance scope using vector signal analysis software, as shown in the below figure.


With Trueform technology the 33522B was able to deliver a 64 QAM baseband signal with only 0.3 % error vector magnitude! Notice too that the phase error is in milli-degrees and the magnitude error is in mV.

In my next post I will go into more detail on what Trueform technology is and do some comparison measurements with DDS. As always if you have any questions related to this post please feel free to email me and if you have something to add use the comments section below.


8/6/12
Squeezing More Bandwidth Out of Your Waveform Generator


In this post we will look at how you can get more waveform bandwidth out of your waveform generator, bandwidth that goes beyond it's spec'd bandwidth. Before we get started there are some prerequisites that your waveform generator must meet for this to work. First your waveform generator must allow you to set the sampling rate for the arbitrary waveform generator versus just the frequency. Low cost direct digital synthesis generators typically only let you set the frequency for an arbitrary waveform and not the sample rate since they are not actually playing every point of the waveform just providing a close approximation of the waveform. Second the waveform generator must have a sampling rate that is greater than the 2X the spec'd output bandwidth.

A waveform generator's output bandwidth is typically limited by the analogue bandwidth of its signal conditioning output stages (filtering, output amp, etc), not its sampling rate. The sampling rate of the waveform generator is typically set well above the Nyquist rate, a condition known as oversampling. We can use the higher sample rate to create waveforms above the analogue bandwidth of the waveform generator. As an example Agilent's 33522A has a sampling rate of 250 MS/s and an output bandwidth of 30 MHz. Its built-in sine wave function only goes up to 30 MHz, but by creating an arbitrary waveform sine wave we can take advantage of  the oversampling and go above 30 MHz. As an example a 50 MHz sine wave was generated with a 33522A and can be seen in the scope screen shot below.


At 20 MHz above the spec'd bandwidth some amplitude attenuation will occur on the sine wave signal. For the 50 MHz  signal the output measured amplitude was about half of the set output amplitude (-6 dB attenuation). But the signal fidelity of the 50 MHz signal was still well within spec. As shown in the figure below, the second harmonic was < -55 dBc (33522A spec is < -35 dBc). 


For what I will refer to as sine like waveforms achieving higher bandwidths by taking advantage of oversampling works well. For pulse and square like waveforms you are typically limited to the spec'd bandwidth of the waveform generator and if you try to go higher using an arbitrary waveform the result will  look like a sine wave not a square or pulse waveform.

Since achieving higher bandwidths from your waveform generator using oversampling works best for sine like waveforms, it can be used for waveform applications such as multi-tone signal generation, phase or frequency modulated carrier signals, or simulating baseband digital modulation that uses a raised cosine filter. Let's look at a simple multi-tone signal example. Using the 33522A waveform generator a mult-tone signal was generated that consisted of the following tones: 10 MHz, 20 MHz, 30 MHz, 40 MHz, 50 MHz, and 60 MHz. The resulting mult-tone signal was generated by the 33522A and captured on a signal analyzer as shown in the figure below.


As we would expect the amplitude of each tone drops as frequency is increased. This problem has an easy fix though. By using the marker function, the ratio of each tone can be measured against a reference tone, in this example the reference tone is the 10 MHz. The ratios were used to generate amplitude flatness correction factors in software. The new multi-tone signal with flatness correction was generated by the 33522A and measured with a signal analyzer, screen shot shown below.


Using the flatness correction we were able to generate a quality multi-tone signal with a tone that was twice as much as the 33522A's rated bandwidth! 

The bottom line is if multi-tone signal generation or another sine wave like application is what you intend to use your waveform generator for you could save a lot of money by choosing the waveform generator based more on its sample rate instead of its rated bandwidth. And then obtaining an evaluation unit to test how much more quality bandwidth you can squeeze out of it for your particular application, before making your purchase. If you have anything to add to this post please use the "Comments" section below. If you have any questions feel free to email me. 




6/18/12
Sending Binary-Block Waveform Data to an AWG using MATLAB

In this post we will look at how to send waveform points as a binary-block to an arbitrary waveform generator (AWG) using MATLAB. The reason for sending a waveform as binary data versus ASCII data is simple, the binary data is much smaller compared to the equivalent ASCII data. This cuts down on remote IO latency between the computer and AWG for faster performance. Also there is typically a limit on the size of a waveform that can be sent to an AWG remotely in ASCII so for large waveforms you may have to use binary data. Before continuing there are two previous GPETE blog posts that I would recommend to you related to this topic. The first is a post that covers how to connect to an instrument remotely using MATLAB, to go to this post click here. The second is a post that explains how you can get waveform data from a PC or a scope to a modern AWG without using a remote connection, to go to this post click here.

The MATLAB function that makes the binary transfer of waveform data points easy to do is the binblockwrite(). This function writes binary-block (binblock) data to an instrument. To learn more about the binblockwrite() function check out the MATLAB help page on the method by clicking here or type “help binblockwrite” into the MATLAB command line. Note that the binblockwrite function only be used if you have the Instrument Control Toolbox for MATLAB, which is needed anyway to control instruments remotely with MATLAB. For the binblockwrite function to work properly you need to know the endian format of your computer and the AWG. The term endian or endianness refers to the ordering of individually addressable sub-components within the representation of a larger data item (for more info click here). If the endian format of your computer does not match that of the AWG you will need to swap the endian format on the instrument using the proper command before you call binblockwrite.

Let’s lot at an example using MATLAB to send waveform points to Agilent’s 33522A function / arbitrary waveform generator using SCPI. In the below MATLAB example waveform data was converted to a binary-block and sent to the 33522A using a remote USB connection. The SCPI language used in the MATLAB code was for Agilent’s 33521A / 33522A function / arbitrary waveform generators. If you are using a different AWG chances are the command language will be different. The comments in green are describing what is happening in the code.

%opens and creates a visa session for communication with function generator
fgen = visa('AGILENT','USB0::0x0957::0x2C07::MY50000780::0::INSTR');
set (fgen,'OutputBufferSize',2000000);
fopen(fgen);

%Query Idendity string and report
fprintf (fgen, '*IDN?');
idn = fscanf (fgen);
fprintf (idn)
fprintf ('\n\n')

%Clear and reset instrument
fprintf (fgen, '*RST');
fprintf (fgen, '*CLS');

%Clear volatile memory
fprintf(fgen,'SOURce1:DATA:VOLatile:CLEar');

%create waveform
i = 1:1:100000;        % Set rise time (100000 points) */
z = (i-1)/100000;
   
fprintf(fgen, 'FORM:BORD SWAP'); %swap the endian forma
binblockwrite(fgen, z, 'float32''SOURce1:DATA:ARBitrary testarb, '); %send the data using binary to the instrument

fprintf(fgen, '*WAI'); %wait for operation to finish
fprintf('Download Complete\n\n')

%Set desired configuration of 33522A
fprintf(fgen,'SOURce1:FUNCtion:ARBitrary testarb'); % set current arb waveform to defined arb pulse
fprintf(fgen,'SOURce1:FUNCtion ARB'); % turn on arb function
fprintf(fgen,'SOURCE1:VOLT 2'); % set max waveform amplitude to 2 Vpp
fprintf(fgen,'SOURCE1:VOLT:OFFSET 0'); % set offset to 0 V
fprintf(fgen,'OUTPUT1:LOAD 50'); % set output load to 50 ohms
fprintf(fgen,'SOURCE1:FUNCtion:ARB:SRATe 100e6'); % set sample rate
%Enable Output
fprintf(fgen,'OUTPUT1 ON'); % turn on channel 1 output

% Read Error
fprintf(fgen, 'SYST:ERR?');
errorstr = fscanf (fgen);

% error checking
if strncmp (errorstr, '+0,"No error"',13)
   errorcheck = 'Arbitrary waveform generated without any error\n';
   fprintf (errorcheck)
else
   errorcheck = ['Error reported: ', errorstr];
   fprintf (errorcheck)
end

%Save Arb to USB stick, titled test arb
 %fprintf(fgen, 'MMEM:STOR:DATA "USB:\TEST ARB"');

%closes the visa session with the function generator
fclose(fgen);

The majority of the above code is setting up the connection, configuring the 33522A settings, and error checking (to download the 33522A’s programming guide that specifies its commands click here). The main two lines we are interested in for handling binary data are highlighted. The first highlighted line sends a command to the 33522A to swap its endian format to match the format of the incoming data. The second highlighted line is the binblockwrite function, which will convert and send the waveform as a binary-block to the 33522A. The four arguments used in the binblockwrite function are as follows:
  1. “fgen” is the object that refers to the 33522A.
  2. “z” is the array holding the waveform data.
  3. “float32” states the precision. This allows the function to set the number of bits written for each value and the interpretation of the bits. Besides floating-point values, character and integer formats can be used.
  4. “SOURce1:DATA:ARBitrary testarb, “ is the header that will be prefixed to the binary data. In this example it is the beginning of the command to send a binary waveform to the 33522A.
Note that the binary data is in the binary-block format defined by IEEE and the binblockwrite function automatically configures and prefixes the IEEE header to the binary data (the header states the length of the binary data).

The above example MATLAB code creates a simple ramp waveform named "testarb" with a amplitude of 2 Vpp and a frequency of 1 KHz (100 MS/s / 100 KS = 1 KHz). The example MATLAB file was run and the resulting waveform can be seen in the below scope screen shot.


In this post we looked at how to send waveform points to an AWG as a binary-block of data using MATLAB. MATLAB has a function called "binblockwrite" that makes sending binary data to an instrument easy. Before sending the binary data, you want to ensure the endian format of the data matches the AWG's endian read format. Feel free to copy the MATLAB code example used in the post or send me an email and I can send you the .m file. If you have any questions feel free to email me and if you have any personal incites to add use the "Comments" section below.

For more information on the 33522A function / arbitrary waveform generator click here



5/28/12
Creating Arbs Today is Easy!

In this blog post we will look at how easy it is to create arbitrary waveforms on a modern function / arbitrary waveform generator (AWG). I am always running into engineers, young and old alike, that try at all costs to avoid creating an arbitrary waveform (arb) for a test. When they hear the word arb they picture the tedious process of learning how to use some type of waveform software or, worst yet, having to write a program to generate your waveform and then remotely connecting to your AWG to upload the arb. With modern AWGs arb creation no longer has to be looked upon with doom and gloom.

Let's look at two easy examples for creating an arb and transfering it to an AWG. In the first example we will look how we can create an arb from scratch and transfer it to an AWG. In the second example we will capture a waveform from a scope and then transfer and recreate it with an AWG. In both examples two common elements will be used, a USB memory stick and the Comma Separated Value (CSV) file format.

Using Excel to Build Arbs
To build an arb from scratch most engineers turn to either an engineering programming environment, like Matlab, LabVIEW, or VEE, or a custom arb waveform software package that may or may not be free. These are great arb creation solutions, but they can be costly and time consuming if you do not use them on a regular basis. Another option that most engineers do not consider is Excel. Excel is a great tool for building custom arbs since it provides advanced mathematical functions built-in, it can handle large amounts of data (waveform points), and it is already on just about everybody's computer. The next question then is how do you get the waveform from Excel to the AWG? Excel and modern AWGs have something in common; the CSV file format. Excel can read CSV files and Excel spreadsheets can be saved as CSV files. Modern AWGs can read and create arbs from CSV files. To transfer the CSV to the AWG a USB memory stick with the CSV file can be plug into the AWG's front panel and then uploaded into waveform memory.

Let's look at an example. Using Excel an arb waveform was created that consisted of a sine wave summed with third harmonic noise and random noise. A screen shot of the Excel spreadsheet can be seen below. Notice the resulting arb is plotted and the built-in Excel functions used to create the waveform are circled in red.


The Excel spreadsheet was then saved as a CSV file. Using a USB memory stick it was then uploaded to Agilent's 33522A function / arbitrary waveform generator. The resulting arb was captured in the below scope screen shot.


As you can see Excel provides an easy no cost way to create an arb and the CSV file format provides a means to easily transfer the arb to an AWG. If you prefer to use a software environment to generate your arb or your arb needs are more advanced then what Excel can do, you can still skip the remote connection / instrument programming part. Most programming environments, like Matlab and LabView, have APIs for writing / reading CSV files. Simply have your program write the arb to a CSV file and "sneaker network" it to the AWG.

For the second example we will capture a digitized signal from a scope then transfer it to an AWG and turn it into an arb. In the past this was typically done using some type of arb waveform software package that would remotely connect to first the scope to grab the digitized signal and then to the AWG to create the arb. With today's scopes and AWGs the process has been streamlined. For our example an Agilent MSO-X 3054A scope was used to capture a Data Word from a Mil-Std-1553 signal. The captured waveform is shown in the below figure.


Shown below the Mil-Std-1553 signal in blue is 5F67, which is the hexadecimal decoded value of the Data Word. The AWG used in this example was again the 33522A function / arbitrary waveform generator. Here is how it works:
  1. Plug the USB memory stick into the front panel of the scope.
  2. Save the digitized waveform to the USB memory stick as a CSV file.
  3. "Sneaker network" the USB memory from the scope to the front panel of the AWG.
  4. Import the CSV to the AWG's memory. 
It is really that easy! To make this example a little more exciting the Mil-Std-1553 arb on the 33522A was modulated with a lower frequency pulse to simulate coupled transient noise into the signal channel. The modulated arb was captured in the screen shot below.



You can see the simulated transient noise in the figure at the beginning and middle of our arb. Notice at the bottom of the scope in red and blue that because of the transient noise the scope was unable to decode the Data word.

In this post we looked at how easy it is today with modern AWGs to create an arbitrary waveform. We looked at two cases, creating an arb from scratch with Excel and capturing a waveform with a scope. Both methods used the USB memory stick and the CSV file format to transfer the waveform to the AWG with no remote connections or programming. If you have any questions feel free to email me and if you have any personal incites to add use the "Comments" section below.

Click here to learn more about the 33500A series of function / arbitrary waveform generators



4/9/12
Simulating Power Line Communication Signals

Power line communication or power line carrier (PLC) is getting a lot more attention these days since it is used in many of the new green energy electronics such as smart grid devices, solar inverters, and home automation. PLC is communication technique that uses the power wiring in buildings or grid power transmission lines as its communication channel. In this post we will look how you can easily generate complex PLC signals for test purposes with a low cost function / arbitrary waveform generator (FG/AWG). For a more general overview on PLC click here.

Generating communication signals for testing typically requires costly test equipment like a signal generator for the carrier and a FG/AWG for the baseband. For PLC signals we can skip the costly signal generator and just use a modern FG/AWG. There are two main reasons we can skip the signal generator for simulating PLC signals. The first one is the carrier signal for PLC is typically less than 1 MHz so it falls well within the bandwidth capabilities of a FG/AWG. The second is modern FG/AWGs have advanced features for creating complex signals. These features include:

  • Large waveform memory for storing not only arbitrary waveforms, but also arbitrary signals.
  • Arbitrary waveform sequencing, which is analogues to a playlist on an MP3 player. It allows you to seamlessly combine multiple waveforms from memory to create a complex signal. Click here for more on waveform sequencing.
  • Optional second independent channel for creating an I and Q signal.
  • Advanced modulation capabilities such as waveform summing, modulating an arb with an arb, and for two channel FG/AWGs the ability to modulate the signal from one channel with the other channel.
Let's look at a couple of examples using Agilent's 33522A FG/AWG. Here is a simple example just using built-in waveforms. In the below screen shot from the 33522A, a BPSK signal with a 135 KHz carrier was created. For the baseband a built-in waveform known as a pseudo random bit stream (PRBS) was used. The PRBS waveform just delivers a close to random stream of 1s and 0s at a chosen bit rate, for this example 5.5 kbps was used. Of course an arbitrary waveform made up of real data could have been used for the basedband as well.


For the second example lets look at something a little more complicated. In this example a QPSK signal with a frequency hopped spread spectrum carrier was created using Matlab. The bit rate of the digital data was 10 Kbits/s. The signal lasts for 15 ms and consists of >500,000 data points. The waveform was transferred to the 33522A via a USB stick and a CSV file. Below is a screen shot of a portion of the signal.


In this example we used the FG/AWG's large waveform memory to output a large arb file (greater than 500K points) to create a 15 ms signal segment with the baseband modulation and the frequency hopping already in signal. This frees up the FG/AWG's modulation capabilities for other purposes such as simulating communication channel noise. Below is an example of using the modulation function to add some channel noise. The noise signal was a sharp pulse signal representing a large load transient on the power line. This was done on the 33522A by using the "sum" modulation feature. The source of the pulse noise signal was channel two on the 33522A.


In this post we talked about using a low cost function / arbitrary waveform generator for creating PLC signals. There are two main reasons why a FG/AWG makes a great solution for simulating PLC signals compared to a signal generator. The first is the carrier frequency of PLC signals is well within the capabilities of a FG/AWG. Second modern FG/AWGs have features like a large waveform memory, waveform sequencing, and advanced modulation capabilities. If you have any questions related to this post please email me and if you have anything to add use the comments section below.




1/31/12
Matlab Function for Creating Arbitrary Waveform Files

This post features a Matlab function called convertToArb( ) that converts a vector / array of data into a waveform format that can be loaded onto Agilent's 3352xA function / arbitrary waveform generators (33521A one channel and 33522A two channel). This function converts a row or column vector into a 3352xA format .arb file (a waveform file that can be loaded onto the 33522A or 33521A). The vector data should contain voltage values ranging from 10 V to - 10 V. The convertToArb( ) function will generate a .arb file in the current Matlab open directory. The file can then be imported to the 33521A or 33522A via a USB memory stick. You can copy the code for the function below or you can download the function from Matlab Central (link at the end).

function convertToArb(data,samplerate,fName)

%check if data is row vector, if so convert to column
if isrow(data)
    data = data';
end
    
%data=importdata(filetoread1);
numberofpoints = length(data);

%Get max and min values from waveform data
data_min=min(data);
data_max=max(data);

%range has to be the maximum absolute value between data_min and data_max
range=abs(data_max);
if(abs(data_min)>abs(data_max))
    range=abs(data_min);
end
    
%Data Conversion from V to DAC levels
data_conv=round(data*32767/range);

fName = [fName '.arb']; %add file extension to file name

%File creation and formatting
fid = fopen(fName, 'w');
fprintf(fid,'%s\r\n','File Format:1.10');
fprintf(fid,'%s\r\n','Channel Count:1');
fprintf(fid,'%s\r\n','Column Char:TAB');
fprintf(fid,'%s%d\r\n','Sample Rate:',samplerate);
fprintf(fid,'%s%6.4f\r\n','High Level:',data_max(1));
fprintf(fid,'%s%6.4f\r\n','Low Level:',data_min(1));
fprintf(fid,'%s\r\n','Data Type:"Short"');
fprintf(fid,'%s\r\n','Filter:"OFF"');
fprintf(fid,'%s%d\r\n','Data Points:',numberofpoints);
fprintf(fid,'%s\r\n','Data:');
%Write data to file and close it
fprintf(fid,'%d\r\n',data_conv);
fclose(fid);

The input arguments for the convertToArb( ) function are as follows:
  • 'data' is the vector containing the waveform points that you want to convert to a .arb file
  • 'samplerate' is the sample rate setting for the 33521A or 33522A. The total time of your waveform is equal to: samplerate * number of points in the file.
  • 'fName' is the name you want to assign to the .arb file that is created, for instance "myArb" will create a "myArb.arb" file.
The following example Matlab script uses the convertToArb( ) function to create a waveform that consists of three different sine waves summed together.

%example script to demonstrate function convertToArb(data,samplerate,fName) 
xAxis = 0:.001:1; %create x axis for plot
count = length(xAxis); %get size of waveform
yAxis = zeros(1,count); %allocate array

for i = 1:count
    %build waveform that consists of three sinewaves summed together
   yAxis(i) = sin((2*pi)*xAxis(i)) + (.5*sin((2*pi)*xAxis(i)*3)) + (.3*sin(pi*xAxis(i)));
end

%call function to convert it to .arb file named myArb.arb
convertToArb(yAxis,1e6,'myArb');

Below is the resulting waveform generated with the example script captured on a scope.






10/17/11
Matlab Program for Simulating ECG Waveforms with an Arbitrary Waveform Generator

Because of the popularity of my 2/21/11 post Simulating Complex ECG Patterns with an Arbitrary Waveform Generator I decided to create a Matlab program that allows you to create and customize electrocardiogram (ECG) waveforms that can be easily transferred to an arbitrary waveform generator (AWG). The program is called "ECG Waveform Simulator" and can be downloaded free of charge from Matlab Central (see link below). The program allows you to customize the "typical" ECG waveform by allowing you to modify amplitude, duration, and in some cases interval for the standard ECG waveform parts including the P wave, Q wave, R wave, S wave, T wave, and U wave. The program allows you to directly transfer the ECG waveform you created to an 33521A or 33522A AWG via a Ethernet connection or to store it on a CSV file that could later be uploaded to an AWG. This programmed combined with an AWG provides engineers involved with designing and testing ECG monitoring and measurement equipment an simple and flexible test solution.

One huge benefit of using modern AWGs, like the 33521A and 33522A, for simulating ECG waveforms is a feature typically referred to as arbitrary waveform (arb) sequencing. Arb sequencing allows the user to seamlessly create a complex waveform pattern combining multiple arbs stored on the AWG. It is analogues to creating a playlist on your MP3 player using various songs stored in the MP3's memory. Sequencing gives you the ability to create complex ECG patterns by combining multiple ECG waveforms. Below is a screen shot from a scope showing an example of three different ECG waveforms that I created using the ECG Waveform Simulator. The three waveforms were output using the sequencing capability on the 33522A AWG (notice the second waveform is played twice).


In the above sequence the first ECG waveform is played once, the second is played twice, and the third is played once. Of course we could have just as easily played the fist waveform 50 times, the second 10 times, and third 101 times. For more information on creating arb sequences with the 33521A or 33522A check out my post Creating Arbitrary Waveform Sequences.

Click here to download ECG Waveform Simulator from Matlab Central

Click here to check Agilent's AWGs



8/29/11
Simulating Jitter with an Arbitrary Waveform Generator Part 2

This is part 2 of a two part post on simulating jitter with an AWG, to check out part 1 click here. In part 1 we discussed what jitter on a digital signal is, namely mistimed edge crossings. With larger arbitrary waveform memory capacity and superb signal integrity, we discussed how modern AWGs make a great low cost solution for simulating complex jitter patterns on digital communication and clock signals for noise immunity and BER testing purposes. Finally we were introduced to the error function (ERF) which we can use to build digital pulses with edge events that we can easily and quantitatively vary to simulate jitter. In this post we will build on the ERF concept and put an algorithm together for adding complex jitter patterns to our digital pulses.

In the following examples we will use Matlab to build the arbitrary waveform, the Agilent 33522A dual channel AWG to output it, and the Agilent 54833D oscilloscope to view the waveform. Initially, we will build a 500 Kbps clock signal as an arbitrary waveform using Matlab and its built in ERF feature. We will be using a 250 MSa/s sample rate so the waveform points will be spaced 4ns apart. Let's first start out by building a waveform consisting of two pulses and adding a small value to the edge crossing time of the second pulse's falling edge to simulate jitter. The inner loop is where the pulse is created using a positive and negative ERF function. The first loop consists of two iterations to create two pulses. Notice the highlighted section in the negative ERF function. This term is what will cause the edge shift in the second pulse. Notice the term will be 0 for the first iteration and 150e-12 for the second, causing the edge to crossing to shift 150 ps.

pulse=[];
   for  r=0:1:1;
    for i = 5.04E-7:4E-9:2.5E-6;    
        y = erf((i-1E-6)/10E-9)+erf(-(i-2E-6+r*150E-12)/10E-9)-1;
        pulse=[pulse y];
    end
   end

The waveform was saved to a CSV and then loaded onto the 33522A AWG. The output waveform from the 33522A was then captured using the scope. The image below is a zoomed in view from the scope showing the falling edge of the two pulses. Notice that the shift between the pulses is ~ 150 ps (click image to enlarge).

We can use this method to produce pulses with any variety of edge crossing times and add them to our arbitrary waveform. In this way we can generate a clock signal with a precise amount of jitter on each pulse. We can add as many of these precisely defined pulses up to the limit of the waveform memory. In this example, I am using the Agilent 33522A with a waveform memory of 1 MSa and each pulse is defined by 500 samples allowing up to 2000 pulses per waveform. With the 33522A’s optional waveform memory of 16 MSa we could get up to 32k pulses per waveform.

Let’s use this capability to simulate the jitter we might expect from a power supply coupling to the clock line. For this example I will inject 200 ps of periodic jitter at 5 kHz.

    pulse=[];
   for  r=2*3.1415/100:2*3.1415/100:2*3.1415;
    for i = 5.04E-7:4E-9:2.5E-6;    
        y = erf((i-1E-6)/10E-9)+erf(-(i-2E-6+sin(r)*100E-12)/10E-9)-1;
        pulse=[pulse y];
    end
   end

Here is the result.

Just by looking at the color graded display of the oscilloscope capture you can see the periodic nature of the jitter. The sine wave spends more time near its maximum amplitude than it does near its zero crossing, this is shown on the oscilloscope as pink being the greatest density of samples, followed by blue and with green being the lowest density near the center. In this example we used a simple sine wave at a given frequency to define our jitter pattern. We could make the jitter pattern more complex by using a random number generator with a normal distribution to represent random Gaussian jitter or we could have added together multiple sine waves at various frequencies to represent multiple spurious coupled jitter sources.

So lets review and explicitly write out the algorithm we just went over for generating an arbitrary waveform that consists of a long series of digital pulses with an added jitter pattern to the edge crossings:
  1. Determine your signal rate, how many points per pulse, and how many pulses are in the waveform. These settings are highly dependent on the AWG you are working with and the jitter characteristics you want to simulate.
  2. Create a loop that builds your ideal pulse with a positive and negative ERF using the example above. Remember the rise / fall times of the pulse is limited by the AWG's sample rate.
  3. Add the jitter pattern function and jitter magnitude you want to simulate to the desired edge or edges of the signal. This is done by adding the jitter pattern and magnitude inside the ERF function.
  4. Create the outer loop which controls the number of digital pulses created and if necessary steps the jitter pattern variable through the appropriate values.
The examples and the algorithm discussed so far in this post apply mainly to clock signals. Of course the same concepts could be applied to simulate jitter on digital communication signals like SPI and CAN for BER and noise immunity testing. There is just the added complexity of plugging in 1s and 0s at the right spot in the waveform to simulate meaningful data.

I posted the code to a Matlab function that creates a user specified digital clock signal with jitter on it on Matlab central. Click here to download

To check out Agilent's AWGs click here


8/22/11
Simulating Jitter with an Arbitrary Waveform Generator Part 1

The Arbitrary Waveform Generator (AWG) is an instrument you will probably find on the bench of most electrical engineers. It allows you to produce a variety waveforms from built in functions like square and sine to arbitrary user defined waveforms. As AWG technology progresses, it opens the door for new applications. In this two part blog post we will look how to use an AWG to simulate jitter on digital clock and communication signals. This is extremely useful when doing noise immunity and BER testing on digital circuits.

AWGs have always been a great way to create serial data or clock signals as you have the ability to produce accurate signals with very precise edge placements. Usually you can place an edge crossing to better than 1/100th of the sample interval of the AWG. With this accuracy you are able to add sub-nanosecond timing error to clock or data signals to test your systems susceptibility to jitter. With basic AWG waveform memories now in the millions of points, you are now able to add jitter to longer pulse patterns in more interesting ways.

Jitter is defined as the deviation in or displacement of some aspect of the pulses in a digital signal. What is most often characterized is the Time Interval Error (TIE) which is the timing deviation of the edge crossing of the serial data signal relative to a clock. This can also be the timing deviation of a clock relative to an ideal clock.

Jitter and TIE can end up on a signal through a variety of mechanisms. For example, jitter can be the result of spurious coupling from a switching power supply to the digital systems clock signal. A designer would be prudent to test his systems vulnerability to such an occurrence. While there are many more expensive solutions for injecting jitter onto a clock signal, most AWGs are perfectly capable of simulating this kind of jitter.

You can change the edge crossing position of an arbitrary waveform very precisely in steps on the order of the sample period of the AWG (1/sample rate) divided by its vertical resolution in bits. You also want to pay close attention to the AWG's jitter spec, which specifies the amount of jitter error that the AWG will add to your "ideal" digital signal. Modern AWGs will have jitter specs < 100 ps, for instance Agilent's 33521/22A AWGs have a jitter spec of < 40 ps. Now we need a mathematical algorithm that allows us to easily create our digital pulses and allows us to easily manipulate the pulse edges to simulate jitter. Lets first start out with creating the pulses using the error function (ERF), which is the integral of the Gaussian or Normal Distribution. The ERF is defined and plotted as (click to enlarge):

The ERF gives a positive step from -1 to 1 with the zero crossing at t0. In the Gaussian distribution σis the variance or the measure width of the distribution. The correlation of σ to the width of the rising edge in the error function gives a 10-90 risetime of about 2σ. The negative step or falling edge is defined as the ERF function multiplied by -1. The only limitation is that σ needs to be greater than 2 AWG sample periods in order to ensure adequate oversampling.

That will do it for part 1. In part 2 we will see how we can use the ERF to simulate jitter on a digital signal. We will go over some examples using Matlab code and Agilent's 33522A. 

5/25/11
Modernization Makes Waveform Capture and Playback Easy

A good way to test your design under worst-case conditions is to capture a known good waveform on a scope, download it into an arbitrary waveform generator (arb) and then modify various signal parameters to emulate worst-case input conditions. In the past this required a scope and an arb remotely connected to a PC that was running custom software or some instrument specific software package. That has all changed with the features found in modern arbs and scopes. Now all you need is an arb, a scope, and a usb memory device. In this blog post we will run through an example of capturing and storing 10 bytes of a known good RS232/UART transmit serial bus signal using an Agilent 3000 X-Series scope. We will then transfer the stored waveform data into an Agilent 33522A function/arbitrary waveform generator for replay without touching a PC. We will then look at some example features found on modern arb’s to modify our serial bus signal to test a design under worst-case input conditions.

I am using a serial bus signal for example purposes only. You can apply the techniques here to easily and quickly test for worst-case conditions using virtually any kind of analog or digital signals.
Capturing a “Golden” Waveform on the Oscilloscope
The scope’s timebase is set to 1.000 ms/div to capture 10 bytes of 19.2 kbps RS232/UART serial bus traffic, as shown in the figure below.

After “windowing” on the portion of the waveform we want to capture, we save it as an “ASCII XY data (.csv)” to our USB memory device. The captured waveform was decimated down to 10K points. The saved waveform data can now be imported into various software packages including Microsoft® Excel spreadsheets, MATLAB, and numerous other waveform processing/editing applications. But most importantly, we can import this waveform data directly to our modern arb, which in this example is a 33522A. 

Downloading the “Golden” Waveform into the Arb
To import the saved waveform into the arb, we just need to move our USB memory device from the scope’s front panel USB port to the arb’s front panel USB port. From there a simple push button sequence on the arb’s front panel imports the CSV data and recreates the waveform in memory. The stored waveform consisted of 10,000 points that covered a time-span of 10 ms; this provided an effective/decimated oscilloscope sample rate of 1 MSa/s. The arb will take the time data from the CSV file and automatically set the sample rate of the arb to match it (in this example 1 MSa/s).

Modifying the Baud Rate and Amplitude and Adding Noise
Now that we’ve reproduced the original “golden” waveform, we can easily modify it in order to test for worst-case input conditions. Let’s assume that you know that your receiver responds correctly to the signal conditions of the “golden” waveform running at 19.2 kbps and with normal signal amplitudes and minimum noise. But what if you wanted to test your system running at a much faster baud rate (1.3824 Mbps) and perhaps with additional noise?

Let’s first change the baud rate of this RS232/UART signal to 1.3824 Mbps. Remember that the original baud rate was 19.2 kbps.  Since 1.3824 Mbps is 72 times faster than 19.2 kbps, we should change the arb’s sample rate to 72.0 MSa/s (1 MSa/s x 72). We can add random noise to the signal using the arb’s modulation features. Additive noise can be created using the Sum modulation feature, while noise in the form of jitter can be created using the PM modulation feature. To perform more advanced waveform editing of the signal some modern arb’s like the 33522A have built-in Waveform Editor. These waveform editors typically can be used to modify individual points on the arb or modify the arb using built-in and custom math functions.

The figure below shows an example of the modified test signal now running at 1.3824 Mbps with additive random noise. As you can see, the scope is showing multiple decoding errors under these modified worst-case input signal conditions.


Summary
In the past capturing a design’s waveform with a scope, modifying it for testing purposes, and finally playing it on an arb was a tedius time consuming activity. The combination of a modern scope and arb like Agilent’s 3000 X-Series oscilloscopes and Agilent’s 33500 Series function/arbitrary waveform generators provides a quick and easy way to capture, recreate, and modify digital and analog signals for thoroughly testing a design with worst case signal conditions. To obtain additional information about these instruments go to:




5/2/11
Agilent Releases BenchLink Waveform Builder Pro

Today (5/2/11) Agilent released its 33503A BenchLink Waveform Builder Pro Software. Waveform Builder Pro is the first full-featured waveform creation software for pulse/function/arbitrary waveform generators. The software enables engineers to take full advantage of the signal generation capabilities of the Agilent 33200 Series, 33521/22A, 81150/60/80A waveform generators and makes custom waveform creation fast and simple! This Microsoft Window-based program provides easy-to-use arbitrary waveform creation tools and libraries of advanced signals, waveform sequencing, equation editor, signal filtering and windowing functions.


This is pay for software ($750). I had a chance to test it out for a couple of hours. It is fairly easy to use compared to past waveform editor software I have used. It gives you a lot of waveform editing and math tools that you could only get in a software package like Matlab, but a lot easier to use and cheaper. Below are some key features on the 33503A BenchLink Waveform Builder Pro Software:
  • Standard waveform library provides quick access to common signals (sine, square, triangle, ramp, pulse, exponential)
  • Comprehensive library of built-in signals provides fast and easy access to complex signals
  • Free-hand, point, and line-draw modes to create custom shapes
  • Equation editor allows you create waveforms with exact polynomials
  • Advanced math functions provide additional flexibility for more complex signals
  • Sequencing editor allows you to build and arrange composite waveforms to optimize your design
  • Filtering and windowing functions allow you to smooth transitions between waveforms
  • Fast Fourier Transform (FFT) allows you to view the frequency characteristics of your signals
  • Complimentary Cumulative Distribution Function (CCDF) curves allows you to view the power characteristics of your signals

3/23/11
Creating Arbitrary Waveform Sequences on the 33521A and 33522A

This blog post explains and demonstrates how to create an arbitrary waveform sequence with Agilent's 33522A or 33521A function arbitrary waveform generators. Waveform sequencing is the ability to seamlessly transition (no discontinuities in the output) from one waveform in memory to another waveform somewhere else in memory. Waveform sequencing allows you to create complex easily reconfigurable waveforms by pasting together other simpler waveforms in memory. It is analogous to creating a custom playlist on your MP3 player. Some example sequencing applications include generating serial protocols, simulating the output of environmental sensors over a wide range of conditions, or simulating a biomedical signal such as an ECG signal over a wide range of conditions.
Currently there are two ways to create a arb waveform sequence: using SCPI commands or editing an existing sequence file (.seq file). I will cover both methods in this post. The example sequence we will create consists of three built-in arb waveforms so if you own a 33521A or a 33522A you have these waveforms on your instrument. The three waveforms used are: Negative Ramp, Lorentz, and Sinc. Lets start with the SCPI example. In the following SCPI example, all text preceded by "//" are comments explaining the command and are not part of the command (commands in blue). You can send these commands to the 3352xA either by putting them in your software code, using Agilent Connection Expert interactive IO feature, or using the interactive IO feature on the 3352xA's web interface.
The first four commands reset the 3352xA to a known condition and load an instance each waveform used in the sequence from  non-volatile memory to volatile waveform memory:

*RST //reset the 33522A or 33521A to known state
MMEM:LOAD:DATA "INT:\BUILTIN\NEG_RAMP.arb" //load negative ramp
MMEM:LOAD:DATA "INT:\BUILTIN\LORENTZ.arb"  //load lorentz
MMEM:LOAD:DATA "INT:\BUILTIN\SINC.arb" //load sinc
The following command creates our three waveform sequence. The "DATA:SEQ" part tells the 3352xA that this is a sequence command. The numbers "#3152" tell the 3352xA how long, in ASCII characters, the body of the sequence command is. In our example the "3" tells how long the character count number is ("1", "5", and "2" are three digits). The 152 tells the 3352xA that there are 152 characters in the body of the sequence command. "TESTseq" is the name of the sequence.

DATA:SEQ #3152TESTseq,"INT:\BUILTIN\NEG_RAMP.arb",0,once,lowAtStart,10,"INT:\BUILTIN\LORENTZ.arb",3,repeat,highAtStart,10,"INT:\BUILTIN\SINC.arb",0,once,lowAtStart,10

Lets look at the Lorentz waveform definition in the sequence: "INT:\BUILTIN\LORENTZ.arb",3,repeat,highAtStart,10,
The part in quotes gives the location and name of the waveform being used in the sequence. The "3" tells the 3352xA to play this waveform for 3 cycles. The "repeat" option tells the 33522A that we want to play this waveform more than one time. Notice the other two waveform definitions use the option "once" to play just a single cycle of the waveform. The "highAtStart" option tells the sync output to go high at the start of this waveform. The "10" tells the 3352xA at what point in the waveform to change the sync output (must be at least 4). Refer to the 3352xA Programming Reference guide for a complete list of the settings for defining a sequence. Okay now lets continue on with the rest of the commands we need to output our new sequence:

FUNC ARB  //put the 3352xA into arb waveform mode
FUNC:ARB TEXTseq  //load our sequence into channel 1
SOUR1:FUNC:ARB:SRAT 130e6  //sample rate to 130 MS/s
VOLT 1 VPP  //set the amplitude
OUTP1 ON  //turn on the channel 1 output

Now your 3352xA should be outputting the TESTseq we just created. We still have one more step to go. The sequence is only in volatile memory so if you shut off or reset the 3352xA the sequence will be erased. The following command stores the sequence in internal non-volatile memory. 

MMEM:STOR:DATA "INT:\TESTseq.seq"

Below is a scope screen shot of the sequence we just created. The waveform in green is the sync output of the 3352xA. Notice the Lorentz waveform is played three times and the sync output goes high at the start (point 10) of the Lorentz waveform.

A second way to create a sequence is to modify an existing sequence (.seq file) to create a new one. Whenever you create a new sequence via SCPI commands and store it in non-volatile memory it is stored as a .seq file. To modify it to create a new sequence copy the .seq file from the 3352xA to a USB memory stick.  Transfer it to a computer and open it with a text file editor like Windows Notepad. The .seq file that we just created is below:
File Format:1.10
Sample Rate:130000000.000000
High Level:0.500000
Low Level:-0.500000
Filter:"step"
Header:Arb Name, Repeat Count, Play Control, Marker Mode, Marker Point
INT:\BUILTIN\NEG_RAMP.ARB,1,"once","lowAtStart",10
INT:\BUILTIN\LORENTZ.ARB,3,"repeat","highAtStart",10
INT:\BUILTIN\SINC.ARB,1,"once","lowAtStart",10

Ignore the first line "File Format: 1.10." The next four lines are the amplitude, sample rate, and filter setting for the sequence. This can all be modified if you wanted to change the settings of the sequence. The next line is the header for the waveforms and settings in the sequence. Notice the waveforms and settings are defined the same way they were in the SCPI example. You can modify the waveform names, settings, or add another waveform to create a whole new sequence. You could also copy and paste the sequence text above into a .txt file, modify it, and save it as a .seq file to create a new sequence without any SCPI commands. Whatever you name the .seq file will be the name of the sequence. From there just copy it from the USB memory stick to the 3352xA internal memory and you have a new sequence.




3/2/11
Agilent introduces the M8190A Arbitrary Waveform Generator

On 3/2/11 Agilent introduced the creme da la creme of arbitrary waveform generators (AWG) with the M8190A. The M8190A offers ultra wide bandwidth and high resolution -- simultaneously. The M8190A offers sampling rates up to 8 GS/s at 14-bits of resolution and 12 GS/s at 16-bits of resolution.

The M8190A is a modular instrument for the AXIe standard. The AXIe standard was created in November of 2009. The three founding members are Aeroflex Corporation, Agilent Technologies Inc., and Test Evolution Corporation (for more info on AXIe click here). The M190A is targeted at applications such as radar, satellite comms, electronic warfare, ADC testing, and jitter margin testing. The following is a list of the M8190A's specs:

  • Variable sample rate from 125 MSa/s to 8 / 12 GS/s
  • Spurious-free-dynamic range (SFDR) up to 80 dBc typical
  • Harmonic distortion (HD) up to -72 dBc typical
  • Up to 2 GS arbitrary waveform memory per channel with advanced sequencing
  • Analog bandwidth 5 GHz (direct DAC out)




2/21/11

Simulating Complex ECG Patterns with an Arbitrary Waveform Generator

Using an electrocardiogram (ECG sometimes called an EKG) is an invaluable way to identify various physical ailments. Today there is a wide array of cardiac equipment that displays and interprets ECG signal patterns. Medical equipment designers need a flexible way to seamlessly generate accurate ECG signal patterns to verify and test their designs. In this post, I will discuss how to generate complex ECG signal patterns with an arbitrary waveform generator (AWG). Below in the figure is a 12-lead ECG waveform.


There are three methods to create and store an ECG on an AWG:
1. You can use a device such as a digitizer or oscilloscope to capture an actual ECG signal from a patient. Then you upload the digitized points to the AWG. With modern AWGs, there are many ways to accomplish this, including using a .csv file and a memory stick.
2. You can use mathematical software to create an ECG signal. There may be custom software for the AWG that can do this, or you could use a standard software package, such as MATLAB ®.
3. If your instrument has this capability, you can use your AWG’s built-in "typical" ECG waveform. The Agilent 33521A has a built-in ECG waveform.

Using an AWG’s arb sequencing capability to simulate complex ECG patterns
AWGs that have arb sequencing ability, like the 33521A function/arb waveform generator, can seamlessly transition from one arb waveform stored in memory to another without any discontinuities in the output. The figure below shows an example using the 33521A’s arb sequencing feature to combine three different ECG waveforms stored in different places in memory into one waveform.

The first ECG waveform cycle is meant to be an "ideal" ECG waveform. The other two were based on the first one but were changed in a systematic way using MATLAB software. Notice the second ECG
waveform has a flattened T wave. In the third ECG waveform, the T wave is inverted.
The 33521A’s sequencing capability provides flexibility for controlling when it sequences from one waveform to another. One way to control sequencing is to specify how many cycles each waveform is run before sequencing to the next. Sequences can also return to a waveform that was used previously in that sequence.
Combining the 33521A’s arb sequencing feature with its large arb memory, 1 million points per channel standard with 16 million optional, gives you the ability to simulate complex ECG patterns for thorough testing of cardiac monitoring equipment designs. For example, each ECG waveform shown in the above figure were created with about 500 points. You could store up to 2,000 different ECG waveforms of this size in the 33521A’s standard arb memory. The 33521A allows arb sequences to contain up to 512 steps, allowing you to create complex ECG patterns for thorough testing. You can control arb sequences on the 33521A asynchronously by using triggers to control waveform transitions instead of cycle counts. This provides you with the ability to continuously cycle a waveform for some undetermined time period until it receives a software trigger or external trigger or front-panel trigger. Once it receives the trigger, the 33521A transitions to the next waveform in the sequence. You can also mix the two ways of transitioning through a sequence, specifying a count and using triggers.

Free Matlab ECG simulation program
You can download and use an ECG simulator program created in MATLAB®. You can find the ECG simulator download and instructions at http://www.mathworks.com/matlabcentral/fileexchange/10858-ecg simulation-using-matlab or type “ECG MATLAB” into a search engine and it should be at the top of the results. The program creates ECG waveforms using multiple Fourier series summed together. A Fourier series is used for each distinct wave shape in the ECG waveform, such as the P wave, T wave, etc. The program allows you to adjust various ECG waveform parameters to simulate various cardiac conditions. You can then transfer the ECG waveform you created to a 33521A either by storing it in a .csv file and using a memory stick or remotely via Matlab's instrument toolbox feature.



12/9/10

Waveform Generation Technology Showdown: DDS vs PxP


In this post I wanted to compare direct digital synthesis (DDS) technology and point-by-point (PxP) technology for creating waveforms. DDS technology is currently the incumbent technology used in the majority of FG/AWG found in the market today. DDS technology was used in two of Agilent’s past FG/AWG families which included popular model numbers like the 33120A and the 33220A (still offered today). Agilent newest FG/AWG family, 33500 series, uses PxP technology for creating waveforms and currently is the only waveform generator in its class to feature this technology. For an overview on the new 33500 series check out my Aug 1st post 

Conceptually, the simplest way to generate an arbitrary waveform is to store its points in memory and then read those points out one after another and clock them into a DAC.  After the last point has been read, the generator jumps back to the first point again to begin the next cycle.  This is sometimes called “point per clock” (PPC) generation.  This method accommodates waveforms of virtually any length and every point gets expressed exactly once in each cycle of the waveform.  Even though this method seems like the most intuitive way to create arbs it has two big drawbacks.  First, to change the waveform’s frequency or sample rate, the clock frequency has to change, and making a good variable-frequency clock adds cost and complexity to the instrument.  Second, since the step-wise output of the DAC is undesirable in most applications, complex analog filtering is needed to smooth the steps out. Because of its complexity and cost this technology is only used in high end waveform generators.

DDS uses a fixed-frequency clock and only one or two filters, so it’s simpler and less expensive than PPC method.  In DDS, a phase accumulator adds an increment to its output in every clock cycle, and the accumulator’s output represents the phase of the waveform.  The output frequency is proportional to the increment, so it’s easy to change frequency even though the clock frequency is fixed.  The output of the accumulator is converted from phase into amplitude typically by passing it through some type of look-up table.  Since DDS is not using every point in waveform memory it creates a really good approximation. But since it is an approximation waveform data is changed in some way.  DDS can skip and/or repeat aspects of the waveform in an unpredictable way. In best case scenarios, this leads to added jitter (unless the waveform is sinusoidal), in worst case scenarios severe distortion can result.  Small features in the waveform can be partly or completely skipped over.

The 33500 series’s PxP technology delivers the features and performance of high-end PPC generators with the low cost and simplicity of DDS.  As with PPC, arbitrary waveforms are generated by reading points one by one from waveform memory.  There is no modification of the user’s waveform data as there is with DDS, so PxP reproduces waveforms more faithfully.  The 33500 series offers a choice of waveform filters – one for flat, one wide frequency response and one for optimum step response – but with PxP, filter cutoff frequencies automatically track the sample rate so the waveform doesn’t change shape as frequency is adjusted.  Finally, PxP has none of the jitter or waveform distortion that plague generators based on DDS. 
As an example of PxP vs DDS I created a pulse waveform using 1000 points. On the pulse I created 7 spikes of descending amplitude values. Each spike was created with a single waveform point. I loaded the waveform onto Agilent’s 33522A which uses PxP technology and onto Agilent’s 33220A which uses DDS technology like most FG/AWG on the market today. I operated the waveform at three different frequencies: 50 KHz, 100 KHz, and 200 KHz. I did a scope capture at each frequency which can be seen in the figures below (click to enlarge). The PxP waveform is in yellow and the DDS waveform is in green.




The screen shot on the top is 50 KHz waveforms and you can see all 7 spikes on each pulse. The middle screen shot shows the waveforms at 100 KHz and as you can see the DDS technology did not recreate any of the spikes. The last figure is at 200 KHz and this time the DDS technology was only able to create three spikes. Since 50, 100, and 200 are all multiples of the DDS generator’s clock speed the presence or absence of spikes was constant. At frequency settings that are not multiples of the clock the spikes that actually showed up in the waveform would be at different spots on the pulse each new cycle. This is what gives some DDS waveforms their unpredictable nature.
As an example of PxP technology’s low jitter, each 50 KHz signal was fed into a gapless sampling counter and 100 continuous frequency measurements were taken. The standard deviation of the PxP 100 measurements was 15 uHz and the standard deviation of the DDS 100 measurements was 280 uHz.
With these types of signal quality improvements over DDS technology at the same costs, I think we are at the beginning of a technology shift in the FG/AWG market from DDS to PxP. A shift initiated by whom else but Agilent. 






03/12/10

Creating a Differential Signal with a Function / Arbitrary Waveform Generator



Single-ended signals are referenced to a common level, such as ground, that they can share with other signals, so a single-ended signal requires only a single path or wire. Differential signals are made up of a pair of paths that are both dedicated to a single signal at any given time. One path is used at a higher potential than the other. Differential signals do add complexity, since they require two wires instead of just one, but they provide a number of performance advantages over single-ended signals.
Differential signal advantages include better signal-to-noise ratio, fewer timing errors, and less crosstalk. These advantages make differential signals common in applications such as ADC inputs, instrumentation amplifiers, measurement sensors (like accelerometers), and communication signals. When engineers design and test devices that use differential signals, simulating the differential signals for testing can be challenging. These challenges are caused by the fact that most function/arbitrary waveform generators (FAWGs) have single-ended outputs; instruments that can generate differential signals tend to be fairly costly. In this post I will explain two ways to create a low cost differential signal: using a FAWG with some custom hardware and using a 2-channel FAWG
One way to use custom hardware at the output of a single-ended source to create a differential signal is to use a differential amplifier circuit design as shown it the figure.

The resistors in the differential circuit were chosen to achieve a gain value of 1. I set the DC offset to 0 V. When building the circuit, be careful to keep signal paths and wiring as short as possible to keep parasitic reactive affects low for better signal integrity.
FAWG’s with two single-ended channels (isolated from ground) can have their channels combined into a single differential signal channel. To do this, you need to tie together the two "low" or "common" connections of each channel. The "high" of one channel must be used as the high signal path of the differential channel and the "high" of the other channel must be used as the inverse return wire or low signal path, as shown in the figure.

In addition to the two channels, it is also a lot easier to do this on a two-channel FAWG that has channel tracking capability, like Agilent’s 33522A two-channel function/arb waveform generator. This feature gives you the ability to create an inverted mirror image of the output signal from channel one onto channel two, which is exactly what is needed to create a differential signal. Also, this capability means you only have to set up the arb or built-in waveform on one channel and the inverted version of the waveform automatically tracks to the other channel. Without this feature you would have to setup an arb or built-in waveform on both channels and try to output them in sync using triggering.
As an example I measured and captured three signals with a differential input high-resolution digitizer. The example signal we used was a squarewave at 500 KHz. The figure below shows a digitizer screen shot of the signals. The three signals:
  1. Signal in yellow is a differential signal from the output of the differential amplifier connected to the single-ended FAWG
  2. Signal in green is the differential signal output created by the two channels from the 33522A
  3. Signal in purple is the output of the single-ended FAWG before the differential amplifier input



As you can see from the figure there is quite a bit of ringing on the differential signal created with the custom hardware. When I built my diff amp circuit I was careful to keep wiring as short as possible and I provided a large ground plane. Now with further time and engineer effort I could probably further improve the signal integrity of the circuit. But the point of this example is to show you can save test time and achieve better signal quality by using a 2-chan FAWG with tracking to create a differential signal. Also the cost of a 2-chan FAWG is still typically much cheaper than a differential output waveform generator.

















12/15/10

Creating a Chirped RF Pulse with an Analog Signal Generator and 2 Channel Function Generator




Last week I needed to simulate an chirped RF pulse signal for some testing I was doing. Chirped pulse signals are often used in radar and electronic warfare applications as a pulse compression technique. Not having created a signal like this before I sent a quick email to an RF/Microwave AE colleague of mine asking how they did it. They sent me a quick reply back saying I should use Agilent's VSA software and a vector signal generator. The problem is I did not have a license for the VSA software and I did not have a vector signal generator (vector sig gens can easily be double the price of an analog). With limited time to get the test done I had to figure out a way to do it with my N5183A MXG analog signal generator. Now a chirped RF pulse is a pulse modulated RF carrier, but the carrier is swept (for more info check out this Wikipedia page Chirp). My MXG did have pulse modulation and FM (to sweep the carrier) built-in. I used these functions to create a chirped RF pulse signal. The problem with my chirped RF pulse signal was there was no easy way to sync the pulse modulation and FM so from pulse to pulse the sweep was always starting at a different value. To fix that problem I used the 33522A 2-channel function / arbitrary generator that has the ability to sync its outputs, meaning I could control the phase relationship between the channel 1 waveform and the channel 2 waveform. I set the MXG's pulse modulation source and FM source for external. Channel 1 of the 33522A served as the pulse modulation source. I wanted to linearly sweep the carrier so I set channel 2 of the 33522A, my FM source, for a linear ramp waveform. You can see my setup in the image below:

A positive sloped ramp gives you a low to high frequency sweep and a negative sloped ramp gives you high to low frequency sweep. The sweep speed of the chirp is set by the rate of the slope. The frequency range of the sweep is set by the FM deviation setting on the MXG. You can see the function generator outputs on the scope screen in the image. The start of the pulse modulation on the MXG (bottom left) is controlled by the rising edge of the pulse waveform from channel 1 of the 33522A. If you notice in the image, the ramp waveform is already approximately halfway through its ramp up cycle by the time the pulse is triggered. This was done intentionally in fact you can control where the carrier sweep starts and stops inside the pulse by adjust the phase of the ramp in relation to the pulse output. On the bottom right, the N9020A MXA signal analyzer shows the resulting chirped RF pulse in the frequency domain. Below the 33522A in the image, the 53230A universal counter's microwave channel is also being used to measure the pulse characteristics including: pulse width, pulse repetition rate, and carrier frequency.
The analog signal generator and 2-channel function generator method for creating chirped RF pulse signals filled my testing needs and was much lower cost then turning to a vector signal generator.





11/4/10
Create an Electronic Message Board with an Arb Generator and a Scope



As a fun project I recently created a Matlab program that allows you to use a 2 channel arb and a scope in XY mode as a electronic message board. Below is a link to download the Matlab files if you would like to try it out. It is a great way to display away messages when you are not at your desk / lab station or to show school pride or to brag about your favorite team’s performance. The included figure (click to enlarge) shows my school pride displayed on a scope using an electronic message created with the XY_Text_Writer program. The program works by inputting a message (up to 26 characters including spaces). It takes the message and generates XY amplitudes corresponding to points in vectors. The vectors are moved around and mathematically manipulated to form each character. Using those amplitude vectors it generates an X and Y waveform. The program uses the LAN connection to download and output the waveforms from the 33522A. With the scope in XY mode the two waveforms coming out of channel 1 and 2 of the 33522A are converted to electronic messages on the scope display. 
In the "XY_Text_Writer" download zip file you will find all the Matlab files that you need plus a user guide that explains how to setup the equipment and run the program in Matlab. Below is the link to download:


Now if you do have a 2 channel arb but it is not the 335220A 2 channel arb you can possibly still use the program with a few modifications. Instead of sending the arb points to the 33522A you would send them to a .csv file that you could upload to your arb generator, here is how:

  1. In the "XY_Text_Writer.m" file comment out the  "vec2arbstring()" functions and the "arbs_2_33522A()" function.
  2. put the 'x' and 'y' vectors into a single 2D matrix like so z=[x;y]
  3. Then use the following function to generate a .csv in your current directory: dlmwrite(csv_name, z', 'coffset', 0, 'roffset', 0). Notice the 'z' matrix is transposed.
  4. From there you just have to load the waveform from the .csv file to your two channel arb. Set the output Z of the arb to match the input Z of the scope. Start the output amplitude at about 5Vpp for each arb channel and adjust as needed. Set the arb to run at a sample rate of 300 to 400 KSamples/s.



9/1/10
Some More on Waveform Summing Using the 33521A and 33522A


On the Aug 6th post (click here to go to Aug 6th post) I promised to follow-up with some more information on Agilent’s new 33521A and 33522A 30 MHz FG/AWGs waveform summing capability. The function can be accessed through 3352xA’s modulation menu. The sum feature allows you to mathematically add one waveform to another to easily create more complex waveforms. For instance you could do a ARB + sine wave or gaussian noise + square wave. The summing feature allows you to define the frequency and amplitude ratio (up to 100%) of the summing waveform. As an example, the scope screen shot shows a 10 KHz square wave with a 100 KHz triangle wave summed at 10% amplitude (kind of looks like Bart Simpson’s head). A great example application for the summing functionality is testing a circuit's noise immunity. For instance you could simulate a clock signal and add noise to it to see how it affects signals derived from the clock. Or you could add a 60 Hz sine wave to a custom arb waveform to simulate power line noise.
I recently got a question from a 33521A customer asking how the waveform specs, such as jitter or harmonic distortion, change when using waveform summing. I think this customer was assuming that we use some type of analog method to do the summing. The answer is the waveform specs don’t change at all. The reason is because the summing is performed mathematically in the chip that creates the waveform points so you can think of the summing feature as an easy way to create an arb. 


8/12/10
Waveform Sequencing Capability is now in the GP Realm



As Moore’s law continues to chug along FPGAs, memory, ASICs, and the like continue to get faster and cheaper. This has led to a steady trickle down affect of features, speeds, and specifications that in the past were only found in high price instrumentation move into general purpose (GP) instrumentation. One recent example being waveform sequencing capability. Waveform sequencing is the ability to seamlessly transition (no discontinuities in the output) from one waveform in memory to another waveform somewhere else in memory. Waveform sequencing allows you to create complex easily reconfigurable waveforms by pasting together other simpler waveforms in memory. It is analogous to creating a custom playlist on your MP3 player. Some of Agilent’s recent product releases that provide waveform sequencing capability include the N6705A DC Power Analyzer (see image) and the just released 33521A and 33522A 30 MHz function / arbitrary waveform generators. The N6705A has a high power current or voltage arbitrary waveform generator in it with waveform sequencing capability. The 33521A and 33522A sequencing ability allow you to transition from one waveform to another using either cycle counts or triggers. For example let’s say I have waveform A, B, and C stored in my 33521A’s memory. I could create a complex waveform using a sequence that repeated waveform A 27 times, then runs waveform B continuously until a trigger is received, and then runs waveform C 2 times. Below is a link to a video staring yours truly that demonstrates the waveform sequencing capability of the 33521A and 33522A.




8/6/10
Capturing, Transferring, and Manipulating Arbitrary Waveforms on the 33521A and 33522A


Back on my Aug 1st post I mentioned one of my favorite things about Agilent’s new 3352xA family of 30 MHz Function / Arbitrary Waveform Generators is how easy it is to create and manipulate waveforms. In this post I will build on that statement.  Let’s say you have a digital or analog waveform that you want to recreate on the 33521A or 33522A. All you need to do this is a USB thumb drive and a scope that can save signals in a .csv file, like Agilent’s 7000B series of scopes. In the past this required a computer, connecting both instruments to the computer, and special software. Not anymore! Below is a link to a video that shows how quick and easy it is to transfer a waveform from a scope to the 33521A or 33522A.

33500 Series Scope Capture and Transfer

Now that we have our arbitrary waveform on our 33521A or 33522A we may want to manipulate it to test the fault tolerance or noise immunity of a DUT. We can easily manipulate an arb using the built-in waveform editor as shown in the following video.

33500 Series Scope Waveform Edit

Besides just using the waveform editor we can also manipulate our waveform using different modulation schemes. For instance you could use the “Sum” feature under the modulation menu to add Gaussian noise or a simple sine wave to simulate power line noise to the signal. Hopefully I will get to more on the “Sum” feature in a later post.


8/1/10
Agilent's New Family of 30 MHz Function / Arbitrary Waveform Generators: single channel 33521A and dual channel 33522A

Today August 1st Agilent is introducing its new family of 30 MHz Function / Arbitrary Waveform Generators. There is a one and two channel version, the 33521A is the one channel and the 33522A is the two channel version. They really raise the bar in the function / arbitrary waveform generator instrument class and here is a quick run down of some of their key features:
- 30 MHz sine, square, and pulse bandwidth
- 250 MSa/s 16 bit true point-by-point arbitrary waveform generation
- Dual-channel mode with independent or coupled channels
- 1 MSa waveform memory standard, 16 MSa memory (optional)
- Arbitrary waveform sequencing capability
- < 40 ps jitter and less than .04% total harmonic distortion - All the standard modulation capability you would expect plus waveform summing I have been biting my tongue waiting to blog about this awesome product family! Over the last couple months I have had the privilege to use and test the 3352xA family since its early days as a prototype. One thing I love about the 3352xA family is how easy it is to create complex waveforms. First off there is the 250 MSa/s 16 bit arb with 1 Msa memory standard to create complex arbs. Besides that there is a long list of other features that allow you to create and manipulate waveforms. I am not going to get into them here but I will in future posts. Besides being rich in features, the 3352xA is just a 'sexy' fun instrument to use. It was comparable to my first computer or smartphone where I just couldn't take my hands off of it and had to explore and test every feature. It comes with a large, color, graphical display and has a hardkey / softkey setup (like a scope) that makes it easy to navigate its many features. Now the case could be made that I am a little bias since I work for Agilent so I encourage you to check it out yourself by following the link below or contacting your Agilent rep. Agilent's new 3352xA line of 30 MHz function / arbitrary waveform generator


6/4/10
Why is the Voltage Double the Value I Set on the Function Generator??

One question that comes up a lot from junior engineers when measuring the output of a function/arbitrary waveform generator (FAWG) with a scope or DMM is "why is the measured voltage double the value I set on the FAWG?" The quick answer to that question is there is an impedance mismatch that is causing the discrepancy. Below is a link to a YouTube video created by a colleague of mine that quickly and clearly answers that question.









33220A: The voltage is double the value I set....WHY?