Synchronizing USB Data Acquisition - From One Device to Multiple Systems

Publish Date: Oct 01, 2012 | 1 Ratings | 1.00 out of 5 |  PDF


The Universal Serial Bus (USB) provides a simple, reliable medium for interfacing to data acquisition devices. By leveraging the versatility of USB, along with its plug-and-play capabilities, National Instruments has taken USB beyond peripherals. By implementing features like NI signal streaming and adapting M Series technology, National Instruments has made USB DAQ ready. One very powerful feature of National Instruments USB data acquisition is the ability to synchronize measurements by utilizing the NI-DAQmx driver. This document discusses the types of synchronization available, the signals used, as well as synchronization across functions, devices, and systems.

Table of Contents

  1. Synchronization Signals
  2. Synchronization Types
  3. Conclusion


National Instruments Multifunction USB DAQ devices can perform analog input and output, digital input and output, and counter/timer operations.  With bi-directional streaming of up to 1.25 MS/s for analog input and 2.8 MS/s for analog output, USB DAQ can support high performance applications while leveraging off of its plug-and-play capabilities. Digital data can be transmitted through static update lines (software timed) or correlated lines (hardware timed). Counters/timers are used to count pulses or clock cycles to determine frequency, period or pulse width measurements.  More information about multifunction input and output can be found in the Measurement Fundamentals tutorial linked at the end of this document.

With high performance multifunction capabilities, synchronizing data with USB is a key component of most data acquisition applications. Without any knowledge of the relationship between samples in time, raw data would lose much of its value. Large data sets can be aligned by synchronizing the first sample and the interval between subsequent samples. National Instruments USB Data Acquisition devices utilize the high-performance, easy-to-use and multithreaded NI-DAQmx driver to obtain synchronization down to the nanosecond range.  This paper will go over the synchronization signals available in USB and how these signals are used in the three types of synchronization: multi-function, multi-device and multi-system.


1. Synchronization Signals

There are two important groups of signals used in synchronization: timing and triggering. Timing signals usually repeat in a defined, periodic manner and are used as clocks to determine when a single data operation should occur. Triggering signals are external stimuli that initiate one or more instrument functions. Triggering signals are usually single events that are used to control the execution of multiple data operations.

Timing Signals

A variety of timing signals are used in synchronization. These signals can be categorized based on the type of acquisition or generation. For analog input, the AI Sample Clock controls the time interval between samples. Each time the AI Sample Clock ticks (produces a pulse), one sample per channel is acquired. The AI Convert Clock is the clock on a multiplexed device that directly causes ADC conversion. The sampling interval is started on the AI Sample Clock tick and then the AI Convert Clock is used to convert the analog signal coming out of the multiplexer. An example of this operation can be seen in the figure below.


Figure 1: Sample Clock vs. Convert Clock

For analog output, the AO Sample Clock is the clock that controls the time interval between samples. Each time the AO Sample Clock ticks (produces a pulse), one sample per channel is generated. For digital operations the DI Sample Clock and DO Sample Clock are used to determine when data is moved into the waveform acquisition FIFO and out of the waveform generation FIFO respectively. For counter operations, the Counter Timebase is the clock connected to the source terminal of a counter.

The clock signals can be derived from several onboard timebases.  M Series USB DAQ devices have an 80MHz onboard oscillator that is divided down to create a 10MHz reference clock, as well as 20MHz and 100 kHz timebases. In addition, external signals can be routed to digital lines to be used as clock sources.  For more information about M Series Clock Derivation, refer to the attached M Series Synchronization document.


Triggering Signals

Triggering signals can be categorized  based on the function they perform for simultaneously starting generation or acquisition. Triggers are named after the action they cause:

  • A start trigger begins acquisition or generation.
  • A pause trigger pauses an ongoing generation or acquisition.
  • A reference trigger establishes a reference point in an input operation which can be used to determine pre-trigger (before the reference) or post-trigger (after the reference) data.
  • An arm start trigger is only supported in counter operations.  This trigger is sent first and enables the start trigger to synchronize multiple counter operations.

Multifunction input and output support different types of triggers as specified in the following table:

Table 1: Multifunction Trigger Support

Digital operations do not directly support triggering.  However, they can use a sample clock that is triggered.  This allows digital operations to be timed from a signal that has a start or pause trigger.  Counter output can also be set to retriggerable so that the specific operation will occur every time a trigger is received.


Back to Top

2. Synchronization Types

There are three different types of synchronization. In general, these types can be abstracted based on the physical level at which they occur. At the lowest level, multi-function synchronization occurs within a single device. The next level is multi-device synchronization which occurs between data acquisition modules. Finally, at the highest level multi-system synchronization occurs between groups of devices.

[+] Enlarge Image

Figure 2: Synchronization Types

Multi-function synchronization is the alignment of signals for multiple data acquisition or generation tasks. This is generally accomplished on a single device by routing one signal to the circuitry of different functions, such as analog input, analog output, digital input/output (I/O) and counter/timer operations. Multi-function synchronization is important when trying to synchronize a small number of mixed-signals, like analog data clocked with digital lines, PID control loops, or the frequency response of a system. The NI-DAQmx driver makes this process quick and easy by automatically routing signals based on the user configuration.

Multi-device synchronization involves coordinating signals between USB M Series Multifunction DAQ devices. Synchronization between devices requires an external connection to share the common signal, but allows for a high degree of accuracy between measurements on multiple devices. Multi-device synchronization allows for expanded channel counts; by synchronizing multiple devices the effective channel count for a measurement task increases multiplicatively. NI-DAQmx provides special VIs to enable the distribution of the clock across these devices.

Multi-system synchronization allows multiple NI CompactDAQ chassis to share a single timing or triggering signal. This synchronization allows for the expansion of multiple chassis into a single, coordinated structure. Multi-system synchronization allows for measurements of different types to be synchronized. For example, a thermocouple on one system can be synchronized with a pressure transducer and a solid state relay on another system to form a complete test fixture. The methods used in multi-device synchronization can be scaled to synchronize multiple systems using NI-DAQmx.

Multi-Function Synchronization

NI-DAQmx allows onboard clock routing to synchronize multiple data acquisition or generation operations. A single timing or trigger signal can be shared between multiple operations on the same device to ensure that the data is synchronized. These signals are shared by simple signal routing functions that enable built in connections on the DAQ device.

A few things need to be considered when routing signals on a USB Multifunction DAQ device. The physical connections on the device and the NI-DAQmx configuration of these connections are both important aspects of this implementation. The Measurement & Automation Explorer (MAX) provides a helpful visual tool when attempting to route signals. The Device Routes tab in MAX displays the available signal routes for given USB Multifunction DAQ device. By selecting the device in MAX, the device attributes appear in the window to the right of the Configuration Tree. The Device Routes tab at the bottom center of this window displays the routes for the device. The green squares represent direct connections that can be routed on the device. Examine Figure 3 below for an example of the Device Routes interface.

[+] Enlarge Image

Figure 3: Device Routes in MAX

Once a physical connection is determined, the NI-DAQmx driver allows the user to quickly and easily use this connection to synchronize operations. The example program shown in Figure 4 demonstrates how to synchronize an analog input task with an analog output task by sharing both the start trigger and the sample clock.

[+] Enlarge Image

Figure 4: Multi-function Synchronize Analog Input and Analog Output

This example performs the following operations:

  1. The DAQmx that is configured for the Analog Output task uses /Dev1/ai/SampleClock as the input to the source terminal. Given that this device is listed as Dev1 in the MAX, this operation routes the analog input sample clock to the sample clock source of the analog output task.
  2. The rate is shared between DAQmx Timing.vis for the analog input and analog output tasks to ensure that the generation of each analog level is precisely synchronized to the acquisition of an analog sample.
  3. In a similar manner, the DAQmx associated with the analog output shares the trigger line that is used for the DAQmx in the analog input task.

By routing the sample clock and the start trigger, DAQmx and DAQmx are able to ensure that the analog input operation and the analog output operation begin at the same time and share a clock to create synchronized analog acquisition and generation.

Another useful application of synchronization is the use of a counter output as the sample clock of an analog acquisition. This operation is shown in Figure 5. This can be useful because the analog acquisition task does not directly support a retriggerable start trigger. However, since the counter output can be set to retriggerable, it can be used as the sample clock for analog input. This workaround then creates a retriggerable analog acquisition. In the diagram the Ctr0InternalOutput signal is selected as the source for the DAQmx Timing (Sample Clock).vi associated with the analog acquisition. The operation automatically routes the output of the counter to the sample clock of the analog acquisition internally on the device. This is how the acquisition can be synchronized to the counter generation.

[+] Enlarge Image

Figure 5: Multi-function Synchronize Counter for Retriggerable Analog Input

Multi-Device Synchronization

Multi-device synchronization also utilizes the signal routing capability of NI-DAQmx, but provides the additional ability to share signals between USB Multifunction DAQ devices. The NI-DAQmx driver allows signals to be routed internally within the device, but also provides the option to route signals to Programmable Function Interface (PFI) lines which can be accessed externally to the device. By physically connecting these lines, functions on multiple devices can be synchronized.

The example below in Figure 6 synchronizes the two analog acquisition tasks on two separate devices by synchronizing the start trigger of each to an external source and sharing a sample clock.

[+] Enlarge Image

Figure 6: Multi-device Synchronize Analog Inputs

This is accomplished through the following steps:

  1. Both devices use DAQmx to configure a PFI line for the start trigger source. In this case both Dev1 and Dev2 are using their PFI0 line.
  2. The external trigger signal is physically connected to the PFI0 lines to allow both devices to synchronize the start of their acquisition.
  3. The sample clock for the first device’s analog acquisition is exported to Dev1/PFI1 by using the DAQmx Export to route the AI sample clock to a PFI line.
  4. The PFI1 line on the first device is then physically connected to the PFI1 line on the second device.
  5. The second device routes that PFI line to the AI sample clock to synchronize the analog acquisition samples with the first device.

To synchronize two devices, the external connections must reflect the software configuration. The block diagram in Figure 7 shows the software configuration for synchronizing analog inputs on two USB Multifunction DAQ devices. The diagram in Figure 8 below shows the physical connections that would be necessary to route the signals as outlined in the block diagram. The external trigger is connected to PFI0 on both devices. The AI sample clock from the first device is routed to the second device by connecting PFI1 on the first device to PFI1 on the second device.

[+] Enlarge Image

Figure 7: Multi-device External Connections

Multi-System Synchronization

Multi-system synchronization leverages the methods used in multi-device synchronization to allow multiple CompactDAQ chassis to share timing and triggering signals. However, there are some additional concerns when synchronizing across systems, including different conversion times for analog signals to digital data. There are also some considerations regarding the position of modules in the chassis. The NI-DAQmx driver allows many CompactDAQ chassis to be synchronized and act as one measurement and test unit.

Scanned Acquisition
Different CompactDAQ modules may have different Analog to Digital Conversion (ADC) methods, which may slightly alter sample timing. Some CompactDAQ modules, like the NI 9201, feature scanned sample modes, where analog inputs are multiplexed to a single ADC. These modules use the sample clock to begin the acquisition and the convert clock to cycle through the channels and perform the ADC on each channel.

Simultaneous Acquisition
Other CompactDAQ modules use simultaneous acquisition, which takes an individual sample on each channel at each edge of the sample clock. There are two forms of simultaneous sampling: Simultaneous Sample and Hold (SSH) and Multi-ADC simultaneous sampling.

  1. Simultaneous Sample and Hold (SSH)  is like multiplexed sampling, except that it uses a buffer on each channel before the multiplexer. In this way, each sample is acquired simultaneously on the edge of the sample clock and is held in this buffer. The samples are still passed through the ADC according to the convert clock, but there is no difference between the times at which the samples were stored in the buffer. The NI 9215 utilizes SSH.
  2. Multi-ADC simultaneous sampling involves a dedicated ADC unit for each input channel. All of the ADCs then perform their conversion at the edge of the analog input sample clock. The NI 9229 uses multiple ADC units for its conversion.

To synchronize multiple CompactDAQ chassis, signals must be exported and imported in a method similar to multi-device synchronization with the following stipulations:

  • Signals are routed with the chassis PFI lines (only accessible in slots 5 and 6)
  • A digital I/O module like the NI 9401 should be placed in slots 5 and 6 to get access to the PFI lines
  • Signals are either exported as the master or imported as the slave for synchronization


Back to Top

3. Conclusion

The USB standard is a robust and reliable communication protocol with a variety of uses. By leveraging this standard and combining it with M Series and CompactDAQ technology, National Instruments USB Multifunction DAQ devices provide a powerful platform for test and measurement. Synchronization is one example of how the convenience of the USB standard can be combined with the versatility of the NI-DAQmx driver to expand the functionality of a USB Multifunction DAQ device. NI-DAQmx allows for synchronization across functions, devices and systems to more accurately relate signals in a measurement system.

Related Links

NI USB Data Acquisition Products
NI CompactDAQ
Measurement Fundamentals
M Series Synchronization with LabVIEW and NI-DAQmx
NI Signal Streaming: Sustaining High-Speed Data Streams on USB
C Series Support in NI-DAQmx
Example: NI-DAQmx: NI CompactDAQ Module Synchronization



Back to Top

Bookmark & Share


Rate this document

Answered Your Question?
Yes No