NI PCI card and Linux-GPIB - Page 1
Forum section: electronics / testgear

author: davorin
author_rank: Unknown
timestamp: June 19, 2016, 01:18:19 pm
content: HelloIs someone using a NI PCI card together with linux-gpib?Not sure if my card is broken or not....shows up with lspci, but fails to initialize...Code:0e:07.0 Communication controller: National Instruments Device a1a1 (rev 02)Code:root@debian:/home/me/linux-gpib-4.0.2# gpib_configfailed to bring board onlinefailed to configure boardmain: Operation not permittedThe kernel module is loaded though:Code:root@debian:/home/me/linux-gpib-4.0.2# lsmod | grep tnttnt4882 22337 0nec7210 18012 1 tnt4882gpib_common 30902 2 nec7210,tnt4882When configuring with "gpib_config", it fails with:Code:[ 832.939284] no NI PCI-GPIB boards found[ 832.939295] gpib: interface attach failed

author: TiN
author_rank: Super Contributor
timestamp: June 19, 2016, 03:05:47 pm
content: What is your /etc/gpib.conf ?

author: davorin
author_rank: Unknown
timestamp: June 19, 2016, 04:11:11 pm
content: The regular configuration for this card:Code:interface {minor = 0/* board index, minor = 0 uses /dev/gpib0, minor = 1 uses /dev/gpib1, etc. */board_type = "ni_pci"/* type of interface board being used */name = "gpib"/* optional name, allows you to get a board descriptor using ibfind() */pad = 0/* primary address of interface */sad = 0/* secondary address of interface */timeout = T3s/* timeout for commands */eos = 0x0a/* EOS Byte, 0xa is newline and 0xd is carriage return */set-reos = yes/* Terminate read if EOS */set-bin = no/* Compare EOS 8-bit */set-xeos = no/* Assert EOI whenever EOS byte is sent */set-eot = yes/* Assert EOI with last byte on writes *//* settings for boards that lack plug-n-play capability */base = 0/* Base io ADDRESS */irq = 0/* Interrupt request level */dma = 0/* DMA channel (zero disables) *//* pci_bus and pci_slot can be used to distinguish two pci boards supported by the same driver *//*pci_bus = 0 *//*pci_slot = 7 */master = yes/* interface board is system controller */}

author: Andy Watson
author_rank: Super Contributor
timestamp: June 19, 2016, 05:03:49 pm
content: I have a vague memory of having problems with a conflicting interrupt when I first started with GPIB card. Having a look at the conf file, I notice that IRQ=0 is commented out:Code:/* settings for boards that lack plug-n-play capability */base = 0 /* Base io ADDRESS *//* irq = 0*/ /* Interrupt request level */dma = 0 /* DMA channel (zero disables) */But it's a very long time since I installed the card, so I could be wrong - very

author: bingo600
author_rank: Super Contributor
timestamp: June 19, 2016, 06:05:32 pm
content: I have 2 suggestions , but both are just guesses.I use Agilent USB controllers.1:You might have a card with PCI ID :a1a10e:07.0 Communication controller: National Instruments Devicea1a1(rev 02)That id is NOT recognized in the current source , but according to the below post from the "linux-gpib mailinglist" , should be easy to add to the source.Code:Hej,newer NI PCIe can easily be included and work well ...regardsCarstendiff -crB linux-gpib-3.2.14/drivers/gpib/tnt4882/tnt4882.hlinux-gpib-3.2.14.ni_pcie2/drivers/gpib/tnt4882/tnt4882.h ***linux-gpib-3.2.14/drivers/gpib/tnt4882/tnt4882.h2007-04-0421:33:11.000000000 +0200 ---linux-gpib-3.2.14.ni_pcie2/drivers/gpib/tnt4882/tnt4882.h2010-02-2316:22:20.000000000 +0100 ****************** 35,41 ****PCI_DEVICE_ID_NI_GPIB_PLUS = 0xc811,PCI_DEVICE_ID_NI_PXIGPIB = 0xc821,PCI_DEVICE_ID_NI_PMCGPIB = 0xc831,!PCI_DEVICE_ID_NI_PCIEGPIB = 0x70cf};// struct which defines private_data for tnt4882 devices--- 35,42 ----PCI_DEVICE_ID_NI_GPIB_PLUS = 0xc811,PCI_DEVICE_ID_NI_PXIGPIB = 0xc821,PCI_DEVICE_ID_NI_PMCGPIB = 0xc831,!PCI_DEVICE_ID_NI_PCIEGPIB = 0x70cf,!PCI_DEVICE_ID_NI_PCIE2GPIB = 0x710e};// struct which defines private_data for tnt4882 devicesdiff -crB linux-gpib-3.2.14/drivers/gpib/tnt4882/tnt4882_init.clinux-gpib-3.2.14.ni_pcie2/drivers/gpib/tnt4882/tnt4882_init.c ***linux-gpib-3.2.14/drivers/gpib/tnt4882/tnt4882_init.c2007-10-2416:12:00.000000000 +0200 ---linux-gpib-3.2.14.ni_pcie2/drivers/gpib/tnt4882/tnt4882_init.c2010-02-2316:12:23.000000000 +0100 ****************** 525,530 ****--- 525,531 ----case PCI_DEVICE_ID_NI_PXIGPIB: case PCI_DEVICE_ID_NI_PMCGPIB: casePCI_DEVICE_ID_NI_PCIEGPIB:+case PCI_DEVICE_ID_NI_PCIE2GPIB:found_board = 1;break;default:****************** 723,728 ****--- 724,730 ----{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_NI_PXIGPIB)},{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_NI_PMCGPIB)},{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_NI_PCIEGPIB)},+{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_NI_PCIE2GPIB)},{ 0 }};MODULE_DEVICE_TABLE(pci, tnt4882_pci_table);This meansIe. in / drivers / gpib / tnt4882 / tnt4882.hIn the enum , add an extra linePCI_DEVICE_ID_NI_PCIE3GPIB = 0xa1a1,Code:enum{PCI_DEVICE_ID_NI_GPIB = 0xc801,PCI_DEVICE_ID_NI_GPIB_PLUS = 0xc811,PCI_DEVICE_ID_NI_PXIGPIB = 0xc821,PCI_DEVICE_ID_NI_PMCGPIB = 0xc831,PCI_DEVICE_ID_NI_PCIEGPIB = 0x70cf,PCI_DEVICE_ID_NI_PCIE2GPIB = 0x710e,PCI_DEVICE_ID_NI_PCIE3GPIB = 0xa1a1,PCI_DEVICE_ID_CEC_NI_GPIB = 0x7258};In / drivers / gpib / tnt4882 / tnt4882_init.cSearch for PCI_DEVICE_ID_NI_PCIE2GPIB , and add PCI_DEVICE_ID_NI_PCIE3GPIB the 2 found placesCode:switch(mite_device_id(mite)){case PCI_DEVICE_ID_NI_GPIB:case PCI_DEVICE_ID_NI_GPIB_PLUS:case PCI_DEVICE_ID_NI_PXIGPIB:case PCI_DEVICE_ID_NI_PMCGPIB:case PCI_DEVICE_ID_NI_PCIEGPIB:case PCI_DEVICE_ID_NI_PCIE2GPIB:case PCI_DEVICE_ID_NI_PCIE3GPIB:case PCI_DEVICE_ID_CEC_NI_GPIB:found_board = 1;break;default:found_board = 0;break;}AndCode:static const struct pci_device_id tnt4882_pci_table[] ={{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_NI_GPIB)},{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_NI_GPIB_PLUS)},{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_NI_PXIGPIB)},{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_NI_PMCGPIB)},{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_NI_PCIEGPIB)},{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_NI_PCIE2GPIB)},{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_NI_PCIE3GPIB)},{PCI_DEVICE(PCI_VENDOR_ID_NATINST, PCI_DEVICE_ID_CEC_NI_GPIB)},{ 0 }};According to the mailinglist post , this should do it.And would prob be my best guess , if it's PCI-ID related.The other was something Dave Penkler wrote , not so long ago.But i would not expect it to cause the symptoms above.2:What kernel do you use ?Quote/Bingo

author: davorin
author_rank: Unknown
timestamp: June 19, 2016, 08:34:05 pm
content: You're great (o;Just replaced the PCI ID and:Code:[ 8761.478581] mite: 0xf8304000 mapped to f7e3a000[ 8761.478605] mite: daq: 0xf8300000 mapped to f83f0000[ 8761.478647] tnt4882: irq 20Code:root@debian:/home/me/linux-gpib-4.0.2# ibterm -d 5 -s 96Attempting to open /dev/gpib0pad = 5, sad = 96, timeout = 10, send_eoi = 1, eos_mode = 0x0000ibterm>*IDN?HEWLETT-PACKARD,6632B,0,A.01.04Still wonder why the MacOS9 driver from NI didn't recognize the card....Anyway...good starting point for an ethernet2gpib solution based on this cheap card (o;

author: bingo600
author_rank: Super Contributor
timestamp: June 20, 2016, 02:17:11 pm
content: @DavorinNice to know it workedDid you add a new ID , or just replace one of the existing ones with a1a1 ?Could you post the board definition section , fromgpib.confhere for future reference ?That might help others/Bingo

author: davorin
author_rank: Unknown
timestamp: June 20, 2016, 02:24:52 pm
content: HelloI was lazy...just replaced the ID (o;My gpib.conf is posted above...nothing special there....Code:interface {minor = 0/* board index, minor = 0 uses /dev/gpib0, minor = 1 uses /dev/gpib1, etc. */board_type = "ni_pci"/* type of interface board being used */name = "gpib"/* optional name, allows you to get a board descriptor using ibfind() */pad = 0/* primary address of interface */sad = 0/* secondary address of interface */timeout = T3s/* timeout for commands */eos = 0x0a/* EOS Byte, 0xa is newline and 0xd is carriage return */set-reos = yes/* Terminate read if EOS */set-bin = no/* Compare EOS 8-bit */set-xeos = no/* Assert EOI whenever EOS byte is sent */set-eot = yes/* Assert EOI with last byte on writes *//* settings for boards that lack plug-n-play capability *//*base = 0*//* Base io ADDRESS *//*irq = 0*//* Interrupt request level *//*dma = 0*//* DMA channel (zero disables) *//* pci_bus and pci_slot can be used to distinguish two pci boards supported by the same driver *//*pci_bus = 0 *//*pci_slot = 7 */master = yes/* interface board is system controller */}Now let's see if I can modify the php module easily as it hasn't been updated since 2003 and only works for php4...

author: bingo600
author_rank: Super Contributor
timestamp: June 20, 2016, 02:46:13 pm
content: Quote from: davorin on June 19, 2016, 08:34:05 pmWhat was the price of the card ?Too bad the old RPC code has been purged from linux-gpib , ense that would have been a nice starting point for a remote ether-gpib gateway.I'd still say a Raspi->USB-GPIB based ether gateway would be my preferred solution, fanless & < 10 watt/Bingo

author: davorin
author_rank: Unknown
timestamp: June 20, 2016, 03:00:04 pm
content: Think I paid around Euro 40 for it....was sold as broken..or as is.... (o;Well...digging now into language/php/gpib.cto see if this pass by reference can easily be fixed....god I hate those ZEND macros (o;I would prefer doing everything remotely...a webserver with the php-gpib module would be great....Using a cheap Fujitsu thin-client PC for US$ 18 with the NI PCI card in it now....At least I can switch on/off all my devices via http with a simple OSX Xojo application (o;

author: davorin
author_rank: Unknown
timestamp: June 20, 2016, 03:07:15 pm
content: Hmm....that was easy....well...the ibrd function for php5 (o;Code:<?php$string="";$u=ibfind("power1");ibwrt($u,"*IDN?");ibrd($u,$string,10000);echo$string;?>Just commented out in gpib.c in function ZEND_FUNCTION(ibrd):Code://if (!PZVAL_IS_REF(z)) {//zend_error(E_WARNING, "Not a reference");//RETURN_NULL();//}Code:klingler@debian:~/linux-gpib-4.0.2/language/php$ php -vPHP 5.6.22-0+deb8u1 (cli) (built: Jun 13 2016 07:55:54)Output:Code:klingler@debian:~/linux-gpib-4.0.2/language/php$ php test.phpHEWLETT-PACKARD,6632B,0,A.01.04

author: bingo600
author_rank: Super Contributor
timestamp: June 20, 2016, 03:43:54 pm
content: Quote from: davorin on June 20, 2016, 03:00:04 pmI'd be interested in that module (relays ?) & sw for my linuxIs that a Pollin NetIO ?/Bingo

author: davorin
author_rank: Unknown
timestamp: June 20, 2016, 03:48:27 pm
content: It's called IP Powerbar....think they are also produced under another name...like NetIO 230C....but all have different firmware (o;They are cheap for a 4-port power outlet...but the chinese controller reset circuitry sucks badly....short outage in AC causes it to beep endlessly ;-)I use the HTTP CGI interface to switch individual outlets on/off...sad there is no HTTP call to get current status....might be to do with the limited flash space...Also no SNMP *sniff (o;

author: bingo600
author_rank: Super Contributor
timestamp: June 20, 2016, 03:53:06 pm
content: Ahh ....Then i have some 8-Chan APC PDU's : Apc-AP7921-Powerswitch-blackThey support HTTP/SNMP , but they're pricey/Bingo

author: davorin
author_rank: Unknown
timestamp: June 20, 2016, 03:55:36 pm
content: Only a APC 3 phase 2m tall Rack-PDU here I got sponsored for my network inventory web application (o;No switchable ports though...just current measuring with SNMP...

author: davorin
author_rank: Unknown
timestamp: June 21, 2016, 02:22:13 pm
content: Ordered now a cheap Core2Duo PC for EUro 29 with shipping with PCIe and PCI slot for testing my NI PCI card...Well..there is also some FPGA board lying around with PCIe interface...might be a good starting point for doing an own GPIB implementation in Verilog on Lattice FPGA (o;

author: bingo600
author_rank: Super Contributor
timestamp: June 21, 2016, 05:08:41 pm
content: Quote from: davorin on June 21, 2016, 02:22:13 pmAhh ... I remember your fpga siteI'm still a VHDL beginner/Bingo

author: davorin
author_rank: Unknown
timestamp: June 21, 2016, 07:04:06 pm
content: Yeah...have to bring it back online....just extended the registration period for fpga.ch today few days before expiration...Wasn't aware that besides go daddy name cheap is also evil...they just pull the domain name instead of releasing it to public and put it to auction...And I prefer Verilog over VHDL...as I'm coming for the electronics world I like the "wire" statement in Verily (o;

author: davorin
author_rank: Unknown
timestamp: July 11, 2016, 04:13:47 pm
content: Well a little off-topic...but just received an older NI PCI card....works out of the box on my old Apple G4 MDD running MacOS 9.2.2 (o;

author: davorin
author_rank: Unknown
timestamp: February 06, 2017, 11:00:18 am
content: This is even way far more off-topic (o;Using now my Amazon echo box to power on/off my measurement equipment...And now next project is to control the GPIB devices with Alexa (o;