Experimental Notes on the National Instruments NI 4462, and data-capture under Linux, using C.

Introduction

The National Instruments NI PCI-4462 is a 4-channel differential-input 24-bit data-capture PCI card. The signal:noise ratio is genuinely impressive: (118 dB dynamic range, and 6 gain settings for input ranges from ±316 mV to 42.4 V). It can sample at up to 204.8k samples/second on all 4 channels in parallel, and may beexternally triggered. Although it is normally used in LabView under Windows, there is a a C-library, DAQmx. The underlying ADC is a pair of AK5394A delta-sigma ICs.

The NI4462 can not do jitterless triggering, fast turarnound between tasks, sampling-at-will (one sample per falling-edge clock input), or disable the internal hardware/software low-pass filter. We didn't know that when we purchased it!

We solved the installation problem, wrote some programs for it, and learned about, documented, and (sometimes) worked-around its quirks. It's all released below; software is GPLv3+ (with the necessary exemption for libdaqmx).

Modifications

Kernel: NI provide a binary-blob Linux kernel driver which only supports old 32-bit kernels. We hacked it to run under kernel 2.6.29 (supplied with Mandriva 2009.1, the only kernel/distro that could simultaneously support both the NI4462 and the motherboard's ethernet chip). Here's what we did. A particular "highlight" is that the NI Kernel Abstraction Layer (nikal.c) relies on init_mm, a symbol which was unexported after 2.6.28; a workaround is to patch nikal.c, with the following:

struct mm_struct *init_mm_hack = ( struct mm_struct * ) 0xc04e41a0; // grep init_mm /proc/kallsyms
#define init_mm (*init_mm_hack) //Never compile this on a different kernel

100MHz Clock export: There is no "officially supported" way to export the constant free-running master 100MHz clock (nor the 10/20 MHz clocks) from the NI4462. However, with a soldering iron and a FIN1001/FIN1002 pair, this is possible. For details, see this post and this photo.

Sample clock export: It's much easier to export the sample-clock, or the trigger, using the RTSI interface; details are in my experimental notes below.

Programs

These are the main programs written to use the NI4462. There are also soeme utilities and experiments described in the README.txt:

Experiments

Here are my Lab Notes. These can be used to form the missing counterpart to the manual. All the data and plots is included in the tarball below. Some highlights include:

Bugs

An ideal 200kHz ADC should take one instantaneous measurement (per channel) every falling-edge of the clock-input. It should accept any arbitrary and irregular pattern of trigger pulses, subject only to the constraint that the trigger pulses be at least 5us apart. The measurement should be an average of the signal over the previous ~1us (so that for example, a sharp spike that ended 10us ago does not affect this sample. Any low-pass filtering should be configurable. For our application, the NI4462 has 3 major problems:

In summary, we really need the NI4462 to be built on a 24-bit version of the AD7677, or LTC2378-20!

Installation

Notes

This was originally written as part of my PhD Infrared Camera system. It should be applicable for wider usage.
Other programs in the same release may also be useful, especially the pulseblaster, arduino, and mathematics sections.

Download

ni4462.tgz
GIT repository

Documents

Some selected files, from the tarball:
README.txt
NOTES.txt
ni4462_test.1
ni4462_characterise.1
ni4462_voltmeter.1
ni4462_speak_noise.1

Navigation

Return to all programs, site home.