From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

>ADC Dynamic Characteristics Measurement Reference Design

Code and Documents

Attachment

Overview


This example measures the dynamic characteristics of an analog-to-digital converter (ADC) using National Instruments hardware and software. This example includes code for making total harmonic distortion (THD), total harmonic distortion plus noise (THD+N), spurious free dynamic range (SFDR), and signal-to-noise-and-distortion ratio (SINAD) measurements.

Background

ADC dynamic characteristic testing can be challenging and expensive, and the typical box instruments used for this purpose have a large footprint. A flexible solution can be implemented using PXI modular instruments that measures dynamic characteristics accurately, and at a faster rate and less cost compared to traditional rack-and-stack equipment.  

Figure 1: System Diagram for Dynamic Characterization of ADC

This example shows how to measure total harmonic distortion (THD), total harmonic distortion plus noise (THD+N), spurious free dynamic range (SFDR), and signal-to-noise-and-distortion ratio (SINAD) using modular instruments and LabVIEW. 

For this example we use a Texas Instruments single-ended 8-bit ADC running at 50MS/s as the device under test (DUT).

 

Hardware Configuration

This reference design uses an NI PXI-5421 to generate the sine wave and an NI PXI-6541 to acquire digital output from the ADC. Other system components include the ADC clock source (in this case supplied by the HSDIO device) and a low-noise power supply (NI PXI-4130) to power the ADC.

DUT Connections

Figure 2 shows how to connect the instruments to the ADC. 

Figure 2: DUT Connections

Complete the following steps to properly connect the NI PXI-4130, NI PXI-5421, and NI PXI-6541 to the ADC:

  1. Power the ADC chip by connecting SMU Channel 1 outputs to the ADC.
  2. Connect the ADC digital outputs to the HSDIO data input lines.
  3. Connect the HSDIO CLK OUT to the ADC clock input.
  4. Wire the Arbitrary Waveform Generator to the ADC analog input.

 

Configuring the Example Software

Download the reference design example program linked at the end of this document and run the AC Characteristics VI. 

Configure the example code using the front panel setup tab as described below:

Figure 3: Front Panel Setup tab

Configure each of the measurement parameters by completing the following steps:

AWG Parameters

  1. Select the resource name of your AWG module from the AWG pull down menu.
  2. Select the waveform type to generate from the Waveform pull down menu.  
  3. Specify the frequency at which to generate the waveform in the Frequency (Hz) field.
  4. Specify the amplitude of the waveform to be generated in the Amplitude (Vp-p) field. The amplitude is typically set to the full input voltage range of ADC.

Power Supply Parameters

  1. Select the resource name of your power supply module from the Power Supply pull down menu.
  2. Set the channel to 1 in the channel name field.
  3. Specify the voltage level with which to power the ADC in the Voltage Level (V) field.
  4. Specify the current limit in the Current Limit (A) field.

HSDIO Parameters

  1. Select the resource name of your HSDIO module from the HSDIO pull down menu.
  2. Specify the input channels that are connected to the ADC in the Channel List field.
  3. Specify the number of samples to acquire from the ADC in the # of Samples field.
  4. Specify the clock rate of the HSDIO device to the rate at which the ADC will run in the Clock Rate (Hz) field.  The HSDIO clock rate is equal to the ADC clock rate.
  5. Set the clock source to Strobe from the Clock Source pull down menu.

ADC Parameters

  1. Specify the input impedance of ADC in the ADC Impedance field.   Note: This parameter allows the AWG to adjust its voltage level so that it generates the requested amplitude for the input impedance of ADC.
  2. Define the ADC range in the ADC Range (pk-pk) field.   The range converts the acquired digital data from the ADC to analog data to analyze the dynamic characteristics of the ADC.

 

Example Software Overview

The reference design software is programmed using NI LabVIEW.  NI-FGEN, NI-HSDIO, NI-DCPower instrument drivers are required to run this code.  

The following block diagram shows the code behind the front panel.  The code is organized using a “railroad track” layout. The first track controls the power supply, the second track controls the AWG, and the third track controls the HSDIO.  The tracks are explained in parallel.

 

Figure 4: Example code block diagram

 

The following figure shows the block diagram for configuring the power supply:

 

Figure 5: Power supply configuration

The Power Supply Configure VI initializes the SMU using the power supply and channel names specified in the front panel.  The VI also sets the output mode to DC Voltage” and enables voltage and current limit auto-ranging.  The VI then configures the output voltage level and sets the current limit to protect the DUT and the test fixture.  When the SMU configuration is complete, the Power Supple Configure VI enables the power supply output.

 

The following figure shows the block diagram for configuring the waveform generator:

Figure 6: AWG configuration

b-1 The NI-FGEN Initialize VI opens a session to the AWG.

b-2  The NI-FGEN Output Mode VI sets the output mode to Standard Function.

b-3  The NI-FGEN Configure Waveform VI configures the properties of the signal generator that affect standard waveform generation. These settings are the waveform, amplitude, DC offset, frequency, and start phase.

b-4  The NI-FGEN Export Signal VI routes the Started Event onto RTSI0/PXI_Trig0 line for to trigger the HSDIO device. The Start Trigger is sent on the RTSI/PXI_Trig line to the HSDIO device so that the HSDIO board starts acquiring data as soon the AWG starts generating data to the ADC.

b-5  The Load Impedance property sets the load Impedance that the AWG is going to source at its output. ADC is the load that AWG sources. The load impedance of the AWG is equal to the input impedance of the ADC.

 

The following figure shows the block diagram for configuring and arming the HSDIO:

 

Figure 7: HSDIO configuration

c-1  The Clocking ADC VI sets the clock rate of HSDIO board equal to the rate at which ADC is to be run for testing.

c-2  The NI HSDIO Init Aqusition Session VI creates a new acquisition session. 

c-3  The NI HSDIO Assign Dynamic Channels VI configures channels for dynamic acquisition or dynamic  generation.

c-4  The NI HSDIO Configure Sample Clock VI configures the Sample clock and allows you to specify the clock source and rate for the Sample clock.

Note: When using an external clock, a clock rate must be specified.  This value is used for configuring internal resources.

c-5  The NI HSDIO Configure Acquisition Size VI configures the size of the acquisition, including how many records are acquired and the minimum record size.

c-6  The NI HSDIO Configure Trigger VI configures the specified trigger.

c-7  The NI HSDIO Initiate VI commits the configuration to hardware and starts the acquisition.

 

The following paragraphs describe the steps for acquiring and analyzing the data, and terminating the instrument sessions:

Figure 8:  Initiate waveform generation

b-6  The NI-FGEN Initiate Generation VI initiates signal generation from the user selected waveform.  A trigger is sent to the HSDIO device that generation has started.

Figure 9:  Fetch waveform

c-8  The NI HSDIO Fetch Waveform VI transfers acquired waveform data from device memory to PC memory.

Figure 10: Close HSDIO 

c-9  The NI HSDIO Close VI closes the specified session and frees resources that it has reserved.

Figure 11: Stop waveform generation and close AWG

b-7  The NI-FGEN Abort Generation VI aborts any previous initiated signal generation.

b-8  The NI-FGEN Close VI closes the instrument I/O session, destroys the NI-FGEN session and all of its properties, and deallocates any memory resources NI-FGEN uses.

 

Figure 12: Disable and close Power Supply

a-2  The NI-DCPower Configure Output Enabled VI disables generation on the specified channel(s).

a-3  The NI-DCPower Close VI closes the session and deallocates the resources that NI-DCPower reserved.

 

Figure 13: Calculate dynamic characteristics

The Get Dynamic Characteristics VI performs the following functions:

A) Converts the A/D binary output data to analog values for analysis.

B)  Removes initial dead time caused by cable delay using software analog triggering

C)  Removes DC content from the spectrum and finds the appropriate start frequency for frequency analysis. 

D)  Calculates SFDR. Set the threshold to -160dB for better algorithm accuracy.

E)  Calculates SINAD.

F)  Calculates THD.

G)  Calculates THD+N.

H)  Converts the complex spectrum to a magnitude spectrum for display.

 

Related Links

Understanding Dynamic Hardware specifications  View PDF

Defining and Testing Dynamic Parameters in High-Speed ADCs

 

System Requirements for the Example Code

Required Software:

a)     NI LabVIEW 8.5 or later

b)     NI-HSDIO 1.4 or later

c)     NI-FGEN 2.5 or later

d)     NI Sound and Vibration Toolkit 6.0 or later

Hardware used in this paper:

a)     NI PXI-6541 (High speed digital pattern analyzer)

b)     NI PXI-5421 (High speed arbitrary waveform generator)

c)     NI PXI-4130 (Programmable DC power supply)

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors