bigwig is using a National Instruments PCMCIA-GPIB under Ubuntu 6.06 with kernel 2.6.17-11-generic in a PCI-PC Card adaptor. The PCMCIA-GPIB card is based on the same hardware as NI's ISA cards, so is an old-fashioned 16 bit PCMCIA card, not CardBus. The PCI-PC Card bridge must be able to support non-CardBus cards - that used is part number CS13868 from CPC, which claims to be Pro-Signal model PCI1410 though it's not called Pro-Signal on the box.

When working, lspci describes the adaptor as:

02:0c.0 CardBus bridge: ENE Technology Inc CB1410 Cardbus Controller (rev 01)

Initially it wouldn't find any PC Card buses. This turned out because there's a PCI-PCI bridge in the machine and the kernel wasn't scanning all the PCI buses. Adding pci=assign-busses to the kernel boot line (in GRUB's /boot/grub/menu.lst) made the PC Card bus show up. It also broke X.org because the video card had been renumbered - had to edit /etc/X11/xorg.conf to amend its PCI address.

The PCI-PC Card bridge under Linux 2.6 uses the yenta PC Card drivers. pccardctl (aka lspcmcia) should show the card:

atm26@bigwig:~$ sudo pccardctl ls
Socket 0 Bridge:        [yenta_cardbus]         (bus ID: 0000:02:0c.0)
Socket 0 Device 0:      [ni_gpib_cs]            (bus ID: 0.0)
atm26@bigwig:~$ sudo pccardctl ident
Socket 0:
  product info: "National Instruments", "PCMCIA-GPIB", "Rev. B", ""
  manfid: 0x010b, 0x4882
atm26@bigwig:~$ sudo pccardctl status
Socket 0:
  5.0V 16-bit PC Card
  Subdevice 0 (function 0) bound to driver "ni_gpib_cs"
atm26@bigwig:~$ sudo pccardctl info
PRODID_1="National Instruments"
PRODID_2="PCMCIA-GPIB"
PRODID_3="Rev. B"
PRODID_4=""
MANFID=010b,4882
FUNCID=255

The device ni_gpib_cs is the GPIB driver I've installed. NI haven't released any Linux drivers for the PCMCIA-GPIB card, so I had to use the Linux GPIB project.

The versions packaged by Ubuntu are old and don't work. It's worth installing the Ubuntu packages anyway (they provide the right files in /etc/udev and /etc/pcmcia), but to make it work I had to download source of the most recent release version (3.2.09). Initially I tried to bodge this into Ubuntu's modules-assistant framework (by replacing the source tarball supplied by the Ubuntu package) but, while it compiled, it caused a kernel panic. So it was better to install it from scratch.

To build, untar the GPIB source and ensure you have the relevant linux-headers package for your kernel version installed. This will grab it:

$ sudo apt-get install linux-headers-`uname -r`

Then enter the GPIB source directory, configure and build:

$ sudo ./configure --enable-pcmcia
$ sudo make
$ sudo make install

You'll also need to define the device in /etc/gpib.conf. I have:

interface {
        minor = 0       /* board index, minor = 0 uses /dev/gpib0, minor = 1 uses /dev/gpib1, etc. */
        board_type = "ni_pcmcia"        /* type of interface board being used */
        name = "violet" /* 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 */
}

These are mostly the default options. There are two board types, ni_pcmcia and ni_pcmcia_accel - the first seems to work for me.

Rebooting gives the following kernel log:

[17179585.828000] ACPI: PCI Interrupt 0000:02:0c.0[A] -> Link [LNKB] -> GSI 10 (level, low) -> IRQ 10
[17179585.828000] Yenta: CardBus bridge found at 0000:02:0c.0 [1524:1412]
[17179585.828000] Yenta: Using CSCINT to route CSC interrupts to PCI
[17179585.828000] Yenta: Routing CardBus interrupts to PCI
[17179585.828000] Yenta TI: socket 0000:02:0c.0, mfunc 0x00801202, devctl 0x44
[17179586.060000] Yenta: ISA IRQ mask 0x0000, PCI irq 10
[17179586.060000] Socket status: 30000010
[17179586.060000] pcmcia: parent PCI bridge I/O window: 0xd000 - 0xdfff
[17179586.060000] cs: IO port probe 0xd000-0xdfff: clean.
[17179586.060000] pcmcia: parent PCI bridge Memory window: 0xfd900000 - 0xfd9fffff
[17179586.060000] pcmcia: parent PCI bridge Memory window: 0xf1600000 - 0xf16fffff

[17179586.760000] pccard: PCMCIA card inserted into slot 0
[17179586.944000] cs: memory probe 0xfd900000-0xfd9fffff: excluding 0xfd900000-0xfd90ffff 0xfd9f0000-0xfd9fffff
[17179586.944000] pcmcia: registering new device pcmcia0.0
[17179586.980000] cs: IO port probe 0x100-0x3af: clean.
[17179586.984000] cs: IO port probe 0x3e0-0x4ff: excluding 0x4d0-0x4d7
[17179586.984000] cs: IO port probe 0x820-0x8ff: excluding 0x820-0x887
[17179586.984000] cs: IO port probe 0xc00-0xcf7: clean.
[17179586.984000] cs: IO port probe 0xa00-0xaff: clean.

[17179587.940000] Linux-GPIB 3.2.09 Driver
[17179588.340000] gpib: registered ni_isa interface
[17179588.340000] gpib: registered ni_isa_accel interface
[17179588.340000] gpib: registered ni_nat4882_isa interface
[17179588.340000] gpib: registered ni_nat4882_isa_accel interface
[17179588.340000] gpib: registered ni_nec_isa interface
[17179588.340000] gpib: registered ni_nec_isa_accel interface
[17179588.340000] gpib: registered ni_pci interface
[17179588.340000] gpib: registered ni_pci_accel interface
[17179588.340000] gpib: registered ni_pcmcia interface
[17179588.340000] gpib: registered ni_pcmcia_accel interface
[17179588.340000] ni_gpib_probe(0xc15a6800)
[17179588.340000] ni_gpib_config(0xc15a6800)

The last two lines show the PCMCIA-GPIB driver working correctly. If you don't reboot you can also try:

# modprobe tnt4882

which should pull in all the GPIB kernel modules.

Next it's necessary to run gpib_config without parameters to configure the card from /etc/gpib.conf. If you don't do this, when you try to access the board the kernel log returns:

[17179900.344000] gpib: (debug) request module returned 256
[17179900.344000] gpib: no gpib board configured on /dev/gpib0

Once that's working you can then run ibtest to talk to a device on the GPIB bus.

System log shows:

[17180203.072000] gpib: (debug) request module returned 256
[17180203.072000] ni_pcmcia_attach(0xe0a9bb00)
[17180203.072000] ioport1 window attributes: 0x10
[17180260.568000] gpib: (debug) request module returned 256
[17180260.568000] gpib0: exiting autospoll thread
[17180260.572000] ni_pcmcia_detach(0xe0a9bb00)
[17180260.572000] ni_pcmcia_attach(0xe0a9bb00)
[17180260.572000] ioport1 window attributes: 0x10

Note I've had a kernel completely seize when attempting to remove the PCMCIA card - I don't know if this is a fault with the GPIB or PC Card driver.

There are various ways to set the permissions to allow other users to access the device - see INSTALL in the source distribution.

CompArch/HardwareLab/LinuxPCMCIA-GPIB (last edited 2007-11-22 19:07:33 by TheoMarkettos)