Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Feb 23, 2007

NI CompactDAQ Under the Hood – Three Technologies That Drive USB Performance

12 ratings | 3.83 out of 5
Print

Overview

Over the past decade, USB has emerged as a viable, if not preferred, bus option for PC-based data acquisition systems. Two of the most desirable features for any data acquisition (DAQ) system are high data throughput and ease of use. NI CompactDAQ, the latest in USB data acquisition, addresses both of these through analog input data transfer rates up to 3.2 MS/s in a USB-based platform with plug-and-play, hot-swappable module installation. This paper begins with an overview of USB architecture and then takes an in-depth look at the three technologies that deliver the simplicity and performance of NI CompactDAQ:

  • NI Signal Streaming – new patent-pending technology for high-speed simultaneous streaming of analog input, analog output, and digital I/O over USB
  • Integrated Module Controller – innovative design for module autodetection, hot swappability, and communication
  • NI-STC 2 – system timing controller that provides high-speed digital I/O, triggering and synchronization between several modules and chassis.

For an overview of NI CompactDAQ features, view the NI CompactDAQ Overview paper.

Overview of USB Architecture and Transfer Mechanism

Figure 1 shows a high-level view of the components involved in USB data transfer for a data acquisition device. With USB, data transfer is always initiated by the USB host (Figure 1). The application software requests a data transfer from the device by queuing up request IRPs (information request packets). These requests are handed down to the USB driver, which further breaks them into packets and transactions (sequence of packets). The packets are passed on to the USB host controller to be sent to the receiving device. The USB host controller is the hardware that controls USB communication in a PC.



Figure 1. Components in USB Data Acquisition

USB protocol permits four different types of transfers – control, bulk, isochronous, and interrupt (polled). According to their definitions, a control transfer uses three transactions whereas bulk, isochronous, and interrupt transfers use one or more transactions between the host PC and the device. In the following section, we will discuss how the NI Signal Streaming technology takes advantage of USB bulk transfers to minimize device set-up time for acquisitions.

The host PC organizes the device communication over USB in different time slots, called frames. Each frame is 1 ms long for full-speed USB 2.0 devices and 125 µs long for Hi-Speed USB devices. Within each frame, transactions between the host PC and the USB device occur. Figure 2 shows examples of input and output USB transactions.

[+] Enlarge Image
Figure 2. A typical USB transaction involves a token packet followed by a data packet and ends with a handshake packet


In a transaction, the host controller starts with a token packet to initiate data transfer. This token packet provides the address of the device being targeted, the direction of the data as well as the specific data source being addressed on the device. This specific data source is called a USB endpoint. Examples of USB endpoints in a data acquisition device are analog input, analog output or digital input. Following the token packet, the device responds with a data packet if data is available and the host ends the transaction with a handshake packet.

When a transaction is unsuccessful because of transmission errors or data unavailability, the host reschedules the transaction for the next available time slot. These reschedules can cause major delays in data delivery and severely limit data acquisition and generation rates. National Instruments Signal Streaming technology minimizes these retries by implementing data highways between the data acquisition and the USB sections of the device.

NI Signal Streaming


With the widening adoption of USB for data acquisition, many companies are working to close the performance gap between USB and other peripheral computer buses such as PCI and PXI. Two requirements that arise when using USB for data acquisition are the ability to move large buffers of acquired data to PC memory and to perform single-point control of slower physical processes. The new NI Signal Streaming technology in NI CompactDAQ addresses these concerns by:
  • Implementing DMA transfer between the data acquisition and USB sections within the device to ensure data availability for all requests from the host compute
  • Moving part of the driver down to the device level to minimize control communication across the USB
This new technology dramatically improves overall throughput across the USB and minimizes acquisition set-up time. Apart from this, NI signal streaming also optimizes the device responsiveness to the user’s application by responding more rapidly to data requests, thus lowering the device latency.


High-Speed Data Transfer through Direct Hardware Connections on the Device



[+] Enlarge Image

Figure 3. Each DAQ I/O DMA channel streams data directly to/from an endpoint on the USB interface to achieve high throughputs

Traditionally, a controller located on the device handled the transfer of data between the DAQ or I/O section and the USB interface. This traditional interrupt-driven method involves a controller, typically with limited speeds between 30 to 100 MHz as compared to standard 2 to 4 GHz PC processors and causes major delays, decreasing responsiveness and limiting device performance. National Instruments Signal Streaming technology replaces this traditional transfer with local DMA channels that connect the USB interface to the DAQ interface (see Figure 3).

Each DAQ I/O DMA channel on the figure represents a specific DAQ function (i.e. analog input) and is mapped to a corresponding endpoint on the USB interface. With this mapping, each DAQ I/O directly streams data to or from its corresponding USB endpoint buffer without the interaction of the local controller. This transfer mechanism ensures that data is transferred to or from the USB bus as soon as it is available, and thus that the device responds to a maximum number of requests from the host.

USB endpoints are serviced independently by the USB protocol. Therefore, the DMA mapping implemented within the device is virtually carried across the USB to provide up to four high-speed signal streams for different DAQ functions on the device. Thus, there can be up to four high-speed data transfers occurring between the host and NI CompactDAQ device, with each stream not affecting the performance of others. This is an important milestone in USB data acquisition because you can stream data in both input and output directions simultaneously at data transfer rates up to 3.2 MS/s.

Minimize Acquisition Set-Up Time with Signal Streaming Software
Another important part of the NI Signal Streaming technology is its low-level software, which enables the device to minimize nondata USB communication. NI CompactDAQ has the circuitry to receive function calls from the host and perform system set-up operations such as writing to registers. NI CompactDAQ uses a message-based architecture as opposed to a register-based architecture. In register-based architecture, the host sends many individual register read/write commands to the device over USB, whereas in message-based architecture, a single higher-level message containing commands is sent to the device. With this added feature, the host can send one function and leave register-write operations to the device, thus minimizing nondata transfers over USB.



Figure 4. New Message-Based Architecture in CompactDAQ

NI CompactDAQ also uses the bulk transfer mode for these function calls. As mentioned in an earlier section, bulk transfer uses one transaction as opposed to control transfers, which use three transactions to complete a transfer. Now, for example, if it takes 10 transfers to set-up a device for data acquisition, a device that uses control transfer protocol will take 30 frames for this task, which is equal to 30 ms for a full-speed device. On the contrary, NI CompactDAQ, with bulk transfer protocol and message-based architecture, takes action on the message as soon as it is received (within a few microseconds inside a frame), thus reducing the set-up time considerably (from milliseconds to microseconds).

An example where this technology improves system performance is analog input single-point acquisition. When using single-point acquisition, each point acquired requires a fair amount of set-up time, such as writing to control registers. Traditionally, the host computer controls all this setup over the USB, lengthening set-up time. With NI Signal Streaming technology, the local NI CompactDAQ controller can configure the device for single-point acquisition by receiving a function call from the host. The host computer no longer needs to set up each device register with each request for a single sample. Recent tests showed tremendous performance increases in single-point acquisition rates for devices using NI Signal Streaming technology, with up to 1,600 percent increase in single-point acquisition rates.


Percent Increase in Single-Point Performance
Analog Input1600
Analog Output250

Table 1. National Instruments Signal Streaming technology improves single-point acquisition performance

Improved Device Latency through Faster Responses
NI Signal Streaming technology also improves the device responsiveness. Traditionally, an acquisition set for a certain number of points, say 10,000, would collect all 10,000 points before the user could access any subset of the data. NI Signal Streaming technology enables the device to release data as it is acquired. Each signal stream is equipped with a mark register which tells the device how many subset samples to release to the user. When that number is reached, the available samples are sent to the host application and the transfer is terminated. Another transfer is scheduled simultaneously on the host to acquire the rest of the samples. For example, if the user requests 10,000 points and wants the first sample as soon as it is available, the mark register is set to 1 and the first sample that comes in is sent to the user thus terminating the transfer of the 10,000 samples. Simultaneously, another transfer is scheduled to acquire the remaining 9,999 samples.

Integrated Module Controller


Typical data acquisition applications require communication with a wide mix of sensors and actuators as well as various measurement methods, such as multiplexed or simultaneous-sampling architectures. Data acquisition users consistently request that new products and platforms make managing multiple measurement types and modules even easier. USB-based DAQ devices, by default, provide an easy, plug-and-play experience; however, making measurements from multiple subsystems and at different acquisition rates, not to mention synchronizing modules, can cause substantial performance challenges for these devices. PCI DAQ boards generally use a signal routing bus (RTSI bus) between boards for timing, synchronization, and other system communication while PXI modules use the available PXI backplane. NI CompactDAQ has the integrated module controller, which serves a similar purpose on this USB data acquisition platform. The integrated module controller, an innovative design for module autoconfiguration and hot-swappability, also provides multimodule synchronization.

NI CompactDAQ offers modules for many measurement types including voltage measurement and generation, temperature measurement, accelerometer and microphone measurement, digital I/O, bridge completion, counters and relays. Each individual module is designed to provide the highest performance in its class. For example, dynamic signal measurements, using NI 9233 IEPE module, are the most accurate with delta-sigma analog-to-digital converters (ADCs), whereas multiplexed analog input measurements, using NI 9205 analog input module, offer higher channel density at lower cost while still maintaining accuracy. Even though these individual modules differ considerably from each other in their architecture, you can use them simultaneously in a single system, thanks to the integrated module controller.



Figure 5. NI Integrated Module Controller

Each NI CompactDAQ slot has a dedicated microcontroller for module communication. As soon as a module is inserted in any slot, the EEPROM (electronically erasable programmable read-only memory) on the module is read by the microcontroller to identify the module. NI-DAQmx driver then downloads, from the host PC, the module-specific firmware onto the RAM for that slot. The microcontroller and firmware then handle all subsequent communication with the module. In this way, the integrated module controller automatically identifies various modules and communicates with them, eliminating manual user involvement for module configuration. Each time you insert or remove a module, the action is automatically detected and the system configuration is updated.

The integrated module controller also routes the appropriate sample clock and trigger signals to modules for synchronization and timing. An example of this is the case of multiple analog input modules, each with potentially different sampling rates. The integrated module controller synchronizes all of the installed analog input modules using a single sample clock by oversampling the slower modules as required. This technology, although not generally evident to the user, was essential in providing the any-module-in-any-slot architecture. The result is a USB-based DAQ system capable of up to 256 channels of mixed-channel DAQ measurements.

NI-STC 2


The NI-STC 2 is a custom-designed application-specific integrated circuit (ASIC) that controls the system timing, synchronization, and data routing functions of all input and output DAQ operations. In NI CompactDAQ, the NI-STC 2 provides numerous features including:
    ¨ Sophisticated AI and AO timing engine
    ¨ Triggering
    ¨ Up to four DMA channels on the device for high-speed signal streaming
    ¨ PFI, static DIO and hardware-timed DIO lines
    ¨ Advanced counter/timer features



Figure 6. NI-STC 2 on NI CompactDAQ


The NI-STC 2 provides a powerful timing engine for analog input and output, the same timing engine used on NI M Series devices, the world’s most accurate multifunction data acquisition devices. The NI STC-2 on NI CompactDAQ facilitates the NI Signal Streaming technology by exposing the DAQ I/O channels to be directly mapped to the USB endpoints. The NI-STC 2 also interacts closely with the integrated module controller to provide necessary triggering signals to the modules.
    The NI-STC 2 has 16 static DIO lines (available in all eight slots) and 16 PFI Lines (available in slots 5 and 6). Apart from this, the NI-STC 2 includes up to 32 hardware-timed digital I/O lines (in slots 1 through 4), which can input or output digital patterns at rates up to 10 MHz. Each signal can be individually configured as a digital input, static output, or waveform output. NI-STC 2 has dedicated FIFO buffers for digital input and output, each of which can use the dedicated data-streaming channel to move data to and from the FIFO and PC memory. Groups of lines can be used to generate or measure patterns up to 32 bits wide. This pattern I/O capability is useful for applications such as reading bar codes or reading ADCs for component characterization, and is required for any application requiring more than a few milliseconds of timing accuracy.
      The digital lines can also be correlated in time with other hardware-timed operations such as analog input, analog output, and counters, to synchronize multiple operations on the device. To correlate signals, the NI-STC 2 internally routes an external or internal signal to provide a single clock source for the correlated signals.
        NI-STC 2 also provides an extensive range of counter/timer features including quadrature encoder measurement, pulse train and frequency generation, pulse width modulation, edge and event counting and frequency and period measurements.

        Software – LabVIEW and NI-DAQmx


        Software is extremely important with NI CompactDAQ, as it is with any computer-based data acquisition system. Developers familiar with creating DAQ applications using LabVIEW and NI-DAQmx will find that NI CompactDAQ uses the exact same API used for programming as other National Instruments PCI, PXI, or USB devices. Developers not familiar with National Instruments software will find that tools included with NI-DAQmx, such as DAQ Assistant, make the learning process as short and straightforward as possible. LabVIEW is an industry-standard graphical programming environment for test, measurement, and control applications and NI-DAQmx is the most widely used and versatile data acquisition driver software available today.


        [+] Enlarge Image

        Figure 7. DAQ Assistant in LabVIEW

        In addition to providing a LabVIEW API, NI-DAQmx also provides interfaces compatible with other NI application development environments, such as LabWindows/CVI and Measurement Studio, and programming languages, such as ANSI C, C++, VB 6, and Microsoft .NET languages.

        NI CompactDAQ is a simple, flexible data acquisition system. NI-DAQmx and LabVIEW truly complement the benefits of these hardware innovations by providing software tools with ease of use and flexibility to match the hardware.

        Summary


        With advancements in PC and silicon technologies, communication busses, such as USB are providing higher and higher bandwidths for data acquisition. NI CompactDAQ has introduced the latest hardware and software technologies in USB data acquisition including, NI signal streaming, the integrated module controller, and the NI-STC 2. With these technologies, combined with NI-DAQmx, data acquisition application developers can take advantage of this increased bandwidth to develop simple, complete, and powerful data acquisition systems.


        Related Links:
        NI CompactDAQ Home
        NI CompactDAQ Advisor
        NI CompactDAQ Overview
        USB Data Acquisition
        Data Acquisition Home
        12 ratings | 3.83 out of 5
        Print

        Reader Comments | Submit a comment »

         

        Legal
        This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).