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 system are high data throughput and ease of use. NI CompactDAQ hardware addresses both of these through analog input data transfer rates up to 6.4 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-STC3 – system timing controller that provides high-speed digital I/O, triggering, and synchronization among several modules and chassis.
For an overview of NI CompactDAQ features, view the NI CompactDAQ Overview paper.
2. 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, learn how NI signal streaming technology takes advantage of USB bulk transfers to minimize device setup 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.
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 a data transfer. This token packet provides the address of the device being targeted, the direction of the data, and 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.
3. NI Signal Streaming
With the increasing 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 computer
- 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 setup time. Apart from this, NI signal streaming 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
Figure 3. Each data acquisition 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 data acquisition 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 data acquisition interface (see Figure 3).
Each data acquisition I/O DMA channel on the figure represents a specific data acquisition function (for example, analog input), and is mapped to a corresponding endpoint on the USB interface. With this mapping, each data acquisition I/O channel 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 so that the device responds to the 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 seven high-speed signal streams for different data acquisition functions on the device. Thus, up to four high-speed data transfers can occur between the host and NI CompactDAQ device, and no stream affects the performance of the other streams. 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 6.4 MS/s.
Minimize Acquisition Set-Up Time with Signal Streaming Software
Another important part of NI signal streaming technology is its low-level software, which enables the device to minimize nondata USB communication. NI CompactDAQ hardware has the circuitry to receive function calls from the host and perform system setup operations such as writing to registers. It uses a message-based architecture instead of a register-based architecture. In a register-based architecture, the host sends many individual register read/write commands to the device over USB, whereas in a 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. For example, if it takes 10 transfers to set up a device for data acquisition, a device that uses control transfer protocol takes 30 frames for this task, which is equal to 30 ms for a full-speed device. But 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 setup time considerably (from milliseconds to microseconds).
Improved Device Latency through Faster Responses
NI signal streaming technology also improves device responsiveness. Traditionally, an acquisition set for a certain number of points, say 10,000, collected all 10,000 points before you 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 you request 10,000 points and want 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 you, thus terminating the transfer of the 10,000 samples. Simultaneously, another transfer is scheduled to acquire the remaining 9,999 samples.
4. Integrated Module Controller
Typical data acquisition applications require communication with a wide variety of sensors and actuators as well as different 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 data acquisition 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 data acquisition 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 and current measurement/generation, temperature, accelerometer and microphone measurements, isolated measurements, digital I/O, bridge completion, counters, and relays. Each module is designed to provide the highest performance in its class. For example, dynamic signal measurements, using either the NI 9233 IEPE module or NI 9234 IEPE (software-selectable) module, are the most accurate with delta-sigma analog-to-digital converters (ADCs), whereas multiplexed analog input measurements, using the NI 9205 analog input module, offer higher-channel density at lower cost while maintaining accuracy. Even though these individual modules differ considerably 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 on the module is read by the microcontroller to identify the module. The 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, which have 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 data acquisition system capable of up to 256 channels of mixed-channel data acquisition measurements.
NI-STC3 timing and synchronization technology delivers a new level of performance to National Instruments data acquisition (DAQ) devices. This technology is the driver behind the advanced digital, timing, triggering, synchronization, counter/timer, and bus-mastering features.
For data acquisition with NI CompactDAQ, NI-STC3 technology improves on the earlier NI-STC2 technology by adding more timing engines for the analog and digital subsystems. This improvement, combined with the expanded DMA streams from NI signal streaming technology, enables NI CompactDAQ to run up to seven hardware-timed tasks simultaneously, including up to three separate analog input tasks. This functionality makes programming easier, more intuitive, and better optimized for use with multicore processors.
Figure 6. Added timing engines means you can run analog input modules at different rates.
For digital I/O,NI-STC3 technology features 16 static DIO lines and 16 PFI (programmable function interface) lines. For faster digital I/O, NI CompactDAQ chassis with NI-STC3 technology can run up to 64 hardware-timed digital I/O lines, which can input or output digital patterns at rates up to 10 MHz. You can configure each signal as a digital input, static output, or waveform output. You also can correlate the digital lines in time with other hardware-timed operations, such as analog input, analog output, and counters, to synchronize multiple operations on the device. Finally, NI CompactDAQ chassis with NI-STC3 technology feature four advanced 32-bit counter/timers for applications that involve quadrature encoders, PWM, finite pulse generation, frequency and period measurement, or event counting.
The NI cDAQ-9174 and cDAQ-9178 chassis feature NI-STC3 technology.
6. Software – LabVIEW and NI-DAQmx
Software is extremely important with NI CompactDAQ, as it is with any computer-based data acquisition system. One of the most common data acquisition applications is simply logging acquired data to disk or a database for future analysis. National Instruments provides three levels of data‐logging software that you can customized to meet your specific application needs. With easy configuration and customizable data presentation, LabVIEW SignalExpress is a premier choice for interactive data logging. For basic data acquisition and presentation, LabVIEW SignalExpress LE offers a free option. To expand on the options in the nonprogramming environment that LabVIEW SignalExpress provides, you can use LabVIEW graphical development software to obtain complete control over functionality and customization of all aspects of your application.
Developers who create data acquisition applications with LabVIEW and NI-DAQmx can take advantage of NI CompactDAQ instantly because it uses the exact same programming API as other National Instruments PCI, PXI, or USB devices. Developers not familiar with National Instruments software can use the tools included with NI-DAQmx, such as the DAQ Assistant, to 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 the NI-DAQmx driver supports not only LabVIEW, but a variety of text based programming languages as well.
Figure 7. The DAQ Assistant in LabVIEW
In addition to providing a LabVIEW API, NI-DAQmx features interfaces compatible with other NI application development environments, such as LabWindows™/CVI and Measurement Studio, and programming languages, such as ANSI C, C++, Microsoft Visual Basic 6.0, and Microsoft .NET languages.
NI CompactDAQ is a simple, flexible data acquisition system. NI-DAQmx and LabVIEW complement the benefits of these hardware innovations by providing software tools with ease of use and flexibility to match the hardware.
With advancements in PC and silicon technologies, communication buses such as USB are providing 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 NI-STC3 technology. With these technologies, you can take advantage of this increased bandwidth to develop simple, complete, and powerful data acquisition systems.
The mark LabWindows is used under a license from Microsoft Corporation. Windows is a registered trademark of Microsoft Corporation in the United States and other countries.