Welcome | spec | C-PLOT | Support | Users | Contact
 
Contents -> nigpib  
spec Help pages

NAME

nigpib - National Instruments GPIB Controllers

DESCRIPTION

spec supports a number of National Instruments GPIB controllers on a variety of platforms. The support is available using either spec's built- in code, kernel-level drivers supplied by National Instruments or freely available open-source drivers. If the linux-gpib open-source driver from Source Forge is installed, GPIB controllers from other vendors can also be used with the spec's NI GPIB support.

NI GPIB on Linux With Built-In Support

The easiest configuration for using National Instruments PCII, PCIIA, AT-GPIB and PCI-GPIB cards and GPIB-ENET modules  with spec is the "built- in" support. (AT-GPIB and PCI-GPIB (rev 01) support available as of spec release 5.07.02-01, GPIB- ENET as of release 5.07.02-04, all PCI-GPIB as of spec release 5.7.02-06). The built-in support means no kernel-level driver is used, so there is no dependency on Linux kernel version. No additional software needs to be installed and no additional modules or libraries need to be linked with spec.

Configuration is along the following lines:

Interface Configuration

   GPIB DEVICE  ADDR <>MODE                        <>TYPE
0  YES        0x2b8             Nat Inst PCII (built-in)
0  YES        0x2e0            Nat Inst PCIIA (built-in)
0  YES        0x2c0          Nat Inst AT-GPIB (built-in)
0  YES          1:3         Nat Inst PCI-GPIB (built-in)
0  YES  host               Nat Inst GPIB-ENET (built-in)
For the ISA cards (PCII, PCIIA, AT-GPIB), the board's base address must be configured. The built-in support operates through user-level access to the I/O ports and registers. No interrupts are involved, and no DMA is used. For the ISA cards, the IRQ and DMA jumpers can be left open. All data transfers between spec and the controllers are done using polled I/O. For most applications, the built-in support works well.

For the PCI cards, the ADDR field can contain zero, or numbers identifying the PCI bus and slot number. The latter configuration is useful if more than one PCI-GPIB card is installed. If the ADDR is zero, the boards are assigned to the GPIB unit in the order in which they are discovered. PCI bus and slot numbers can be found using the Linux utility /sbin/lspci. Note, though, that utility displays hexadecimal numbers while spec's configuration uses decimal.

For the GPIB-ENET module, an IP address or resolvable host name must be entered as the DEVICE.

No GPIB drivers should be used or installed for any GPIB controllers that spec will be accessing using the built-in support. Installing such drivers may conflict with spec's use of the board.

NI GPIB On Linux With the NI Driver

National Instruments provides drivers for their PCI-GPIB and AT-GPIB/TNT cards and their GPIB-ENET device. Version of the drivers may be obtained at the National Instruments ftp site ftp.ni.com in the directory support/gpib/linux. Note, for the PC cards, spec currently only supports the 0.x series drivers that work with Linux kernels through release 2.4. The NI 2.x driver packages are not compatible with spec. To use 2.6 Linux kernels, the Source Forge driver, described below, is required. To use NI software with the GPIB-ENET module, the nienet-linux-1.1.tar.gz or nienet-linux-1.2.tar.gz packages must be used. The GPIB- ENET support works at user level and doesn't depend on kernel version. Again, the NI 2.x packages that also contain GPIB-ENET support are not compatible with spec.

The NI driver distribution contains instructions for installation, which should be followed. Note, though, there is no need to run the ibconf utility to configure the driver for spec for the PC cards (although ibconf must be used with the GPIB-ENET device to initialize the /etc/gpibrc file.) spec does all GPIB access from the board level device, normally /dev/gpib0. No other special device files are needed. spec also sets the device parameters, such as timeouts and end-of-string behavior, as needed at run time.

spec does need to be linked with the cib.o file included in the driver distribution. When running the spec installation script Install, enter the appropriate path for the file's location when presented with the following:

Choices for Extra object files are:

1) no    - no additional object files
2) other - your choice

If there are additional site-dependent objects files, such
as those provided by hardware vendors, enter the names here.

Choose Extra object files (no)?
If spec has already been installed, remove the file spec in the spec distribution directory before running the installation script to insure that the spec executable gets relinked.

When running the configuration editor, select either of the following options for the PCI cards:

Interface Configuration

   GPIB     DEVICE ADDR <>MODE                       <>TYPE
0  YES /dev/gpib0                      Nat Inst with cib.o
0  YES /dev/gpib0             Nat Inst with cib.o (shared)
For the Ethernet device, choose from the following:
Interface Configuration

   GPIB  DEVICE ADDR <>MODE                               <>TYPE
0  YES   gpib0                    Nat Inst GPIB-ENET with cib.o
0  YES   gpib0           Nat Inst GPIB-ENET with cib.o (shared)
The "shared" version allows the GPIB interface to be shared among more than one instance of spec running on the same platform. spec uses kernel semaphores and shared memory to coordinate access to the driver. If only one instance of spec is using the GPIB interface, then one can avoid a little overhead by selecting the non-shared configuration.

Using Both GPIB-ENET and PCI Cards With NI Drivers

If using the NI driver for the PCI-GPIB (not necessary, if the above-described built-in mode is used), it would normally not be possible to use both the PCI-GPIB card and the ENET-GPIB device at the same time. Both devices require linking with different NI cib.o files, which results in a name-space conflict. However, there is a workaround for spec, at least for NI driver releases 0.8.6 and earlier.

The spec distribution contains a script called makeCIB in the distribution directory that will create a file called CIB.c. Such a file is a modified version of the National Instruments cib.c, with the function names starting with ib replaced with names starting with IB, and the 488.2 functions (unused by spec) eliminated. See the comments in the makeCIB file for more information on creating the CIB.c file.

Beginning with release 0.8.4, NI has dropped the cib.c file from the driver package. However, the version of cib.c from early driver packages (0.8.3, for example) can be used.

One then links spec with both this new CIB.o file and the cib.o file included with the GPIB-ENET distribution. In the spec configuration file, you select the "with CIB.o" device for the PC card GPIB interfaces.

Using the Source-Forge GPIB Driver

The Source Forge Linux GPIB project GPIB drivers work with spec using the "Nat Inst with cib.o" configuration options described above. The package distribution is available at the project's home at http://linux-gpib.sourceforge.net along with documentation. (The Source Forge GPIB project is the successor to the deprecated linux-lab GPIB project used with spec prior to the release of a driver by National Instruments.)

To install the linux-gpib driver you need first to have the Linux kernel source installed. To properly configure the sources to match the running kernel, change to the appropriate /usr/src/linux- directory and run the commands:

make mrproper
make oldconfig
make dep
Note, the Linux kernel is something of a moving target. Instructions for building compatible modules change often. Check the "how-to" files associated with the linux- gpib driver for current instructions.

Next, you can go the directory with the extracted linux- gpib sources and execute the commands:

./configure
make
make install
Finally, to link the linux-gpib library with spec, go to the spec distribution directory. Enter the complete path name of the library, such as /usr/local/lib/libgpib.so, as an "extra object file" option to the spec Install script. (The spec linking won't work with a -lgpib type of argument due to the idiosyncrasies of the spec linking.)

Be sure to configure appropriate entries in /etc/gpib.conf for the card(s) to be controlled by spec. Entries should be configured along the lines of

interface {
      minor = 0
      board_type = "ni_pci"
      name = "gpib"
      pad = 0
      master = yes
}
for the National Instruments PCI-GPIB card. Important points are that the interface should be configured as the master, the primary address of the master should be zero as in pad = 0, and the value in the name field will be the string that must appear in the DEVICE field in the spec configuration editor, as in the following:
Interface Configuration

   GPIB     DEVICE ADDR <>MODE                       <>TYPE
0  YES       gpib                      Nat Inst with cib.o
(Even though the text reads "Nat Inst with cib.o", it is the correct configuration for using the Source Forge linux- gpib driver with a libgpib.so libary!)

Next, make sure the new driver is loaded with the command:

modprobe tnt4882
Also, be sure to run the gpib_config utility after installing the driver.

If all works, the following lines can be added to /etc/modules.conf so that the driver is loaded automatically when needed, and you won't need to use modprobe or gpib_config after rebooting:

alias char-major-160 gpib_common
alias char-major-160-0 tnt4882
post-install tnt4882 /usr/local/sbin/gpib_config --minor 0
Note, the Source Forge GPIB library supports GPIB cards from vendors other than National Instruments, and those cards should also be usable with spec.

[Help File Index]


... Meeting the software needs of scientists since 1985 ...

Return to CSS home page ...
Last Formatted Jun 20, 2009
Last Updated 03/16/09
Send comments, queries, suggestions to info@certif.com

© 1995-2003 Certified Scientific Software. All rights reserved