Linux Users

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIB-USB-HS Only Seen (Sort of) by visaconf

Hi all-

I've been trying to work with a GPIB-USB-HS interface. I'm running on a vanilla Fedora 10 installation. Fedora 10 was the last Fedora to ship with a kernel < 2.6.29, which seems to break things left and right. Anyhow, with a little finesse I was able to install the NI4882-2.5.1f0 package and the NI-VISA-4.5.1f0 package.

All of the programs that were installed with the packages seem to execute, however, none of the gpib apps can find the GPIB-USB-HS interface. First thing to do, make sure the kernel sees the device:

$ lsusb | grep National

Bus 001 Device 015: ID 3923:709b National Instruments Corp.

Okay, so the kernel knows that it's connected and was able to get the identification info. What else does the kernel know about it?

$ cat /proc/bus/usb/devices | grep -B3 -A9 National
T:  Bus=01 Lev=01 Prnt=01 Port=03 Cnt=02 Dev#= 15 Spd=480 MxCh= 0
😧  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=3923 ProdID=709b Rev= 1.01
S:  Manufacturer=National Instruments
S:  Product=GPIB-USB-HS
S:  SerialNumber=0118AC54
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 5 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=250us
E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=250us
E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms

So it sees the endpoints, knows it's a full speed device, but apparently it doesn't know what driver to assign to it. Did the ni kernel modules get loaded?

$ lsmod

...

NiViPciK               84744  0

nipxirmk              124756  1
nidimk                345632  2 nipxirmk
niorbk                 98004  2 nipxirmk,nidimk
gpibprtk              258452  0
nipalk               1215376  9 NiViPciK,nipxirmk,nidimk,niorbk,gpibprtk
nikal                  45460  5 nipalk

...

looks like they did... okay what now... well how about I try the visa side? When I run visaconf as root, it finds two USB devices:

USB0::0x0483::0x2016::NI-VISA-4003::RAW

USB0::0x3923::0x709B::0118AC54::RAW

Interesting! I have no idea what that first item is, but the second item has the USB IDs and the serial number of the GPIB-USB-HS interface that I'm trying to use! Strange! So, the visaconf application sees it, the gpib applications don't, the kernel doesn't appear to assign a driver to it.

There is more than one device on the GPIB bus, so, simply sending commands to that particular resource doesn't seem like it would work since I should need to specify the GPIB address of the device I want to talk to...

Ultimately I'm trying to send commands to the GPIB bus from a program I'm writing in C++. So, just for kicks, I wrote up a quick little program to scan the USB connected VISA resources. It was based on an application note somewhere... although it may have been an Agilent app note... not sure.


int VISAController::Scan(){

    // find the default resource manager, ViSession defaultRM is defined in the parent class

    FindInterface();
    char myBuf[100];
    VISAInstrument * pInst; // custom class to keep track of VISA Instruments
    ViChar vibuffer[VI_FIND_BUFLEN];
    ViRsrc matches=vibuffer;
    ViUInt32 nmatches(0);
    ViFindList list;
    viFindRsrc(defaultRM, "USB?*INSTR", &list, &nmatches, matches);
    printf("VISA Controller scan found %d instruments\n", nmatches);   
    for (int inst=0;inst<nmatches;inst++){
        pInst = new VISAInstrument;
        viOpen(defaultRM, matches, VI_NULL, VI_NULL, &pInst->session);
        viPrintf(pInst->session, "*RST\n");
        viPrintf(pInst->session, "*IDN?\n");
        viScanf(pInst->session, "%t", pInst->identStr);
        printf("%s\n", pInst->identStr);
        Instruments.push_back(pInst); // Instruments is a vector of VISAInstrument pointers.
        viFindNext(list, matches);
    }
    if (nmatches) viClose(list); 

        return 0;
}

It's part of a larger program that I've used successfully before (in Windows anyway...). This is compiled with g++ using a -lvisa flag to link against the visa library that was installed with the NI-VISA package.

$ locate libvisa
/usr/local/lib/libvisa.so
/usr/local/vxipnp/linux/bin/libvisa.so
/usr/local/vxipnp/linux/bin/libvisa.so.7

$ ls -l /usr/local/lib/libvisa*
lrwxrwxrwx 1 root root 38 2010-01-21 09:58 /usr/local/lib/libvisa.so -> /usr/local/vxipnp/linux/bin/libvisa.so

Well, my little scan function doesn't find any devices at all. I plugged in a USB scope and a USB function generator, which showed up in visaconf, and ran the scan function again... still nothing. So the problem here isn't related to the GPIB interface.

Obviously there's more then one problem here. Can anyone offer some guidance? It would be much appreciated!!


Thanks,

Charles Parker

0 Kudos
Message 1 of 2
(5,860 Views)

In the 2.6.25 kernel all of the USB driver APIs became GPL only.  This means that NI-488.2 which is a proprietary licensed USB driver can no longer support the GPIB-USB-HS.  The only driver that I know of that will support the GPIB-USB-HS on kernels >= 2.6.25 is the open source Linux GPIB Package.

NI-VISA will claim all USB devices that do not currently have a driver as "RAW" devices.  Using this functionality you can then write a user-mode driver for your USB device provided you have the hardware specifications for the USB device and some driver writing experience.  This is why the device is recognized by NI-VISA, but I doubt you are looking to write a driver for the device so I don't think this is very useful to you.

Shawn Bohrer

Use NI products on Linux? Come join the NI Linux Users Community
0 Kudos
Message 2 of 2
(3,311 Views)