Linux Users

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Install GPIB driver NI-488.2 on Ubuntu 8.04

This is a very short tutorial that gives some hints on how I got a fully working gpib interface on Ubuntu 8.04. You do not need it if you are working with  Kernel 2.4 (see tutorial Ubuntu 7.10)

However due to the poor support of NI for the linux community, the default package is broken using deprecated Kernel functions (see below).

I describe below short cuts that worked for me. This is more the chronlogy of trial and errors getting around difficulties and there might be a more direct strategy.

I explain the installation up to a working python visa setup.

Attention: I did not make an exhaustive list of the deb package required.

sudo apt-get install linux-headers-vers kernel

STEP 1: install nikal for kernel 2.6

sudo alien nikali-1.9.0-f0.noarch.rpm
sudo dpkg -i nikali_1.9.0-1_all.deb
cd /usr/local/natinst/nikal/src/
sudo ./configure
sudo make
sudo make install
sudo modprobe nikal

STEP 2: install NI software for GPIB

cd /bin
sudo ln -s bash sh
tar zxvf NI-488.2-beta-2.5.1b1.tar.gz
sudo ./INSTALL --nodeps


You will get errors linked to Kernel 2.6 using deprecated command
SA_SHIRQ -> IRQF_SHARED
SA_INTERUPT -> IRQF_DISABLED

cd /usr/local/natinst/nikal/src
rm -rf objects
go to STEP 1
(sudo ./UNINSTALL in case of  problems)

The results should now work:

sudo modprobe nipalk
sudo modprobe gpibprtk

sudo echo '/usr/local/natinst/nikal' > /etc/natinst/nikal/nikal.dir

STEP 3: install the gpib driver for kernel 2.6

upload linux-gpib
http://linux-gpib.sourceforge.net/
get the Kernel 2.6 source version

(read the INSTALL)

tar zxvf linux-gpib-3.2.11.tar.gz
./configure
make
sudo make install

STEP 4: install PyVISA

http://pyvisa.sourceforge.net/

sudo alien PyVISA-1.3-1.noarch.rpm
sudo dpkg -i pyvisa_1.3-2_all.deb


NI Visa

tar zxvf NICVISA_.TZ 
sudo alien nivisa*
sudo dpkg -i nivisa_4.5.0-1_i386.deb

simple python test program

import visa
keithley = visa.instrument("GPIB::12")
print keithley.ask("*IDN?")

I am logged as an alias. If you need to contact me for more details send email at olivier.klein at cea.fr

Cheers,

Olivier

0 Kudos
Message 1 of 35
(21,828 Views)

Hello Oliver, Many thanks for the excellent writeup! I have one hitch while doing the installation. This is for the NI-VISA drivers...I was able to compile and install NI-KAL successfully.  When I try to convert the nipak* RPMs to DEB format...alien throws an error. It is unable to convert it properly and this while performing the dpkg -i nipal* it is unable to install.  I tried to convert it using the command: sudo alien nipal-* --scripts  How did you convert the nipal RPMs to a DEB format?   Thanks!  -Anshul

0 Kudos
Message 2 of 35
(7,403 Views)

After step 2 I have found this error:

********************************* NOTE *********************************
Using kernel headers found in /lib/modules/2.6.24-24-generic/build.
If this does not correspond to the location of the 2.6.24-24-generic headers,
then define KERNELHEADERS in your environment to point to the location
of the kernel headers, define KERNELTARGET as the version of the
kernel for which to compile, and then rerun ./configure.
********************************* NOTE *********************************

I'm using a ubuntu 8.04 with kernell 2.6.24-24-generic and the gcc compiler version (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu3)

What must I do?

Thanks

0 Kudos
Message 3 of 35
(7,403 Views)

Hey Vicente,

That isn't an error, it just showing which kernel headers will be used to build the kernel modules.  In your case you are using the 2.6.24-24-generic kernel and it says it is going to use the kernel headers for 2.6.24-24-generic so everything is fine.

In other words you don't need to do anything.

Shawn

Use NI products on Linux? Come join the NI Linux Users Community
0 Kudos
Message 4 of 35
(7,403 Views)

Ok, after this note it appears the next message

Kernel has reparent_to_init(): no
Number of arguments for do_munmap(): 3
pte_offset function: /bin/grep: /lib/modules/2.6.24-24-generic/build/include/asm/asm-x86: No such file or directory
pte_offset_kernel()
Levels in page table: 4
Kernel has remap_pfn_range: yes
USB altsetting name: cur_altsetting
Kernel has usb_get_intf(): yes
Kernel has intf_cache member in usb_host_config: yes
Kernel has ep[] members in usb_device: yes
Kernel exports usb_set_configuration(): no
Units of USB_CTRL_GET_TIMEOUT: msec
Kernel has owner member in usb_driver: no
Kernel has put_page_testzero(): yes
Kernel has mutex method: yes
Kernel has kthread: yes
Kernel has config.h: no
Kernel has ioctl32.h: no
IRQ handlers have pt_regs: no
Kernel has work_struct and delayed_work: yes

Storing configuration in Makefile.in
If the values stored are incorrect they can be changed before running make.

Uninstalling NI-KAL (nikal): done
/bin/rm -rf objects
Updating NI-KAL:
NI-KAL update failed.

/bin/cp nikal.c objects/nikal.c
/bin/cp nikal.h objects/nikal.h
make -C /lib/modules/2.6.24-24-generic/build SUBDIRS=/usr/local/natinst/nikal/src/objects modules
make[1]: se ingresa al directorio `/usr/src/linux-headers-2.6.24-24-generic'
  CC   /usr/local/natinst/nikal/src/objects/nikal.o
/usr/local/natinst/nikal/src/objects/nikal.c: En la función ‘nNIKAL100_registerPCIDriver’:
/usr/local/natinst/nikal/src/objects/nikal.c:2802: error: ‘nLinux_pciDriver’ no tiene un miembro llamado ‘enable_wake’
/usr/local/natinst/nikal/src/objects/nikal.c: En la función ‘nNIKAL100_reserveInterrupt’:
/usr/local/natinst/nikal/src/objects/nikal.c:4114: error: ‘SA_INTERRUPT’ no se declaró aquí (primer uso en esta función)
/usr/local/natinst/nikal/src/objects/nikal.c:4114: error: (Cada identificador no declarado solamente se reporta una vez
/usr/local/natinst/nikal/src/objects/nikal.c:4114: error: para cada funcion en la que aparece.)
/usr/local/natinst/nikal/src/objects/nikal.c:4114: error: ‘SA_SHIRQ’ no se declaró aquí (primer uso en esta función)
make[2]: *** [/usr/local/natinst/nikal/src/objects/nikal.o] Error 1
make[1]: *** [_module_/usr/local/natinst/nikal/src/objects] Error 2
make[1]: se sale del directorio `/usr/src/linux-headers-2.6.24-24-generic'
make: *** [objects/nikal.ko] Error 2

ERROR: make of nikal kernel module failed, not installing kernel module.
   updateNIDrivers should be called again after fixing the problem.
   Logging failure...
   Include the file /tmp/niSystemReport.out.gz when contacting
   National Instruments for support
.

The author's manual says something related on:

You will get errors linked to Kernel 2.6 using deprecated command
SA_SHIRQ -> IRQF_SHARED
SA_INTERUPT -> IRQF_DISABLED

But I don't know what I must do.

What must I change and where?

Thanks

0 Kudos
Message 5 of 35
(7,403 Views)

Alright those are actual errors

Fortunately they are fixed if you use the latest NI-KAL, which is currently NI-KAL 1.10.

Shawn Bohrer

National Instruments

Use NI products on Linux? Come join the NI Linux Users Community
0 Kudos
Message 6 of 35
(7,403 Views)

Hi

I'm trying to install a GPIB-USB-HS on my laptop.  I'm running Ubuntu 9.10.  I was following a couple of the tutorials from the forums, but eventually got to the following:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$ sudo ./updateNIDrivers

Configuring for linux kernel version 2.6.31-20-generic.

********************************* NOTE *********************************
Using kernel headers found in /lib/modules/2.6.31-20-generic/build.
If this does not correspond to the location of the 2.6.31-20-generic headers,
then define KERNELHEADERS in your environment to point to the location
of the kernel headers, define KERNELTARGET as the version of the
kernel for which to compile, and then rerun ./configure.
********************************* NOTE *********************************

Kernel has reparent_to_init(): no
Number of arguments for do_munmap(): 3
pte_offset function: pte_offset_kernel()
Levels in page table: 4
Kernel has remap_pfn_range: yes
USB altsetting name: cur_altsetting
Kernel has usb_get_intf(): yes
Kernel has intf_cache member in usb_host_config: yes
Kernel has ep[] members in usb_device: yes
Kernel exports usb_set_configuration(): no
Units of USB_CTRL_GET_TIMEOUT: msec
Kernel has owner member in usb_driver: no
Kernel has put_page_testzero(): yes
Kernel has mutex method: yes
Kernel has kthread: yes
Kernel has config.h: no
Kernel has ioctl32.h: no
IRQ handlers have pt_regs: no
Kernel has work_struct and delayed_work: yes
Kernel supports fault method in vm_operations_struct: yes

Storing configuration in Makefile.in
If the values stored are incorrect they can be changed before running make.

.: 13: Makefile.in: not found
/bin/rm -rf objects
Updating NI-KAL:
NI-KAL update failed.

/bin/cp nikal.c objects/nikal.c
/bin/cp nikal.h objects/nikal.h
make -C /lib/modules/2.6.31-20-generic/build SUBDIRS=/usr/local/natinst/nikal/src/objects modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.31-20-generic'
  CC   /usr/local/natinst/nikal/src/objects/nikal.o
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: "init_mm" [/usr/local/natinst/nikal/src/objects/nikal.ko] undefined!
  CC      /usr/local/natinst/nikal/src/objects/nikal.mod.o
  LD   /usr/local/natinst/nikal/src/objects/nikal.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.31-20-generic'
Installing NI-KAL (nikal): Starting NI-KAL failed!
make: *** [install] Error 1

ERROR: make of nikal kernel module failed, not installing kernel module.
   updateNIDrivers should be called again after fixing the problem.
   Logging failure...
   Include the file /tmp/niSystemReport.out.gz when contacting
   National Instruments for support.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I can send the file, but when I tried to use the support link, that also failed.  It's been a poor technology day all around !

I'd appreciate any advice.

0 Kudos
Message 7 of 35
(7,403 Views)

This is related to another thread "NI-KAL for 2.6.31+ Kernels" (http://decibel.ni.com/content/message/15133#15133). Currently, we're still working on porting NI-KAL to this kernel. The changes we have to make is non-trivial. Sorry..

0 Kudos
Message 8 of 35
(7,403 Views)

You've actually got two problems.  The first is that the NI-KAL hasn't been updated to work on 2.6.31 yet.  The second problem is that even when NI-KAL is updated you still won't be able to use your GPIB-USB-HS device because NI-488.2 no longer supports USB devices on kernels 2.6.25+.

My advise is to use the open source GPIB drivers which do support the GPIB-USB-HS device and work on new kernels.

--

Shawn

Use NI products on Linux? Come join the NI Linux Users Community
Message 9 of 35
(7,403 Views)

Dear Shawn

Thank you for that link.  This looks very hopeful and I installed the drivers with synaptic (which always makes me feel happier).

I then installed pyvisa, and when I tried to import it says:

"OSError: /usr/local/vxipnp/linux/bin/libvisa.so.7: cannot open shared object file: No such file or directory"

I've seen other references to the need for this file, and I think it must come from a correct installation of the NI driver?  Eg http://www.neuralwiki.org/index.php?title=GPIB_and_Python

I'm feeling like such a ludite!  Do you have any suggestions?

0 Kudos
Message 10 of 35
(7,403 Views)