Differences between revisions 33 and 42 (spanning 9 versions)
Revision 33 as of 2009-02-23 06:00:26
Size: 9328
Editor: YoichiAso
Comment:
Revision 42 as of 2012-01-03 23:02:38
Size: 5257
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= GPIB issues = = GPIB Intro =
Line 5: Line 5:
[[netgpib package|This page]] explains the netgpib package, a collection of python scripts/modules to communicate with network connected GPIB devices. [[netGPIB| This page explains the netgpib package]], a collection of python scripts/modules to communicate with network connected GPIB devices.
Line 8: Line 8:
 * [http://www.home.agilent.com/USeng/nav/-536900528.426029/pd.html Agilent Technologies 82357B USB/GPIB Interface]
 * [http://prologix.googlepages.com/  Prologix GPIB-Ethernet converter]
 * [http://www.linksys.com/servlet/Satellite?c=L_Product_C2&childpagename=US%2FLayout&pagename=Linksys%2FCommon%2FVisitorWrapper&cid=1134692497433 Linksys WET54G ethernet-wireless bridge] for adding a wireless capability to the prologix box.
 * [[http://www.home.agilent.com/USeng/nav/-536900528.426029/pd.html|Agilent Technologies 82357B USB/GPIB Interface]]
 * [[http://prologix.googlepages.com/|Prologix GPIB-Ethernet converter]]
 * [[http://www.linksys.com/servlet/Satellite?c=L_Product_C2&childpagename=US%2FLayout&pagename=Linksys%2FCommon%2FVisitorWrapper&cid=1134692497433|Linksys WET54G ethernet-wireless bridge]] for adding a wireless capability to the prologix box.
Line 28: Line 28:
Execute attachment:netfinder.exe. On linux, you can use Wine to execute this file. For example, on Ubuntu, I was able to just install Wine from Execute [[attachment:netfinder.exe]]. On linux, you can use Wine to execute this file. For example, on Ubuntu, I was able to just install Wine from
Line 36: Line 36:
attachment:PrologixGpibLanManual.pdf [[attachment:PrologixGpibLanManual.pdf]]
Line 86: Line 86:
 
Line 88: Line 87:
== Using Agilent 82357B USB-GPIB interface from Linux ==
82357B can be used from Linux using the linux-gpib driver. This section will explain how to install the driver
and use it from python and other languages.
This script is now a part of netgpib package. More information is available [[netGPIB|here]].
Line 92: Line 89:
=== Installation ===
===== What you need =====
Linux kernel source (2.6.8 or above)
python, python-dev
fxload (from linux-hotplug project)
lsusb (usbutils package)
=== Old USB way ===
If you want to talk to a GPIB device through USB ports, some information is here.
Line 99: Line 92:
Depending on your distribution, you may have to mount usbfs to /proc/bus/usb.
(In Fedora, it is automatically mounted).
If needed, you may want to add the following line to /etc/fstab

{{{
usbfs /proc/bus/usb usbfs defaults 0 0
}}}

===== Installing linux-gpib driver =====
Before installing linux-gpib driver, create a group {{{gpib}}}, by {{{sudo vigr}}}.

You want to add some users (e.g. controls) to {{{gpib}}} group so that those users can
open GPIB devices.

Download the latest version from
http://linux-gpib.sourceforge.net/

Expand the archive and execute the following,

{{{ ./configure --enable-python-binding --with-linux-srcdir=/lib/modules/2.6.24-19/build }}}

where 2.6.24-19 should be replaced by your kernel version.

{{{ make; sudo make install }}} should install the driver.

===== Installing firmwares =====
Download the proprietary firmwares from http://linux-gpib.sourceforge.net/firmware/

Expand the archive and copy {{{agilent_82357a/*.hex}}} to {{{/usr/share/usb/agilent_82357a/}}}.
If the target directory does not exist, make it.

===== Configuration file and scripts =====

Put the following file in {{{/etc/}}}.
attachment:gpib.conf

Add the following lines to your {{{/etc/modprobe.conf}}}

{{{
alias char-major-160 gpib_common
alias char-major-160-0 agilent_82357a
alias gpib0 agilent_82357a
}}}

Put the following files into somewhere in your PATH.

attachment:initGPIB
attachment:getgpibdata.py

Be sure to set the permission of those files to executable.

Change the group of /dev/gpib* to gpib and set the permission to group readable/writable.

{{{ chown root:gpib /dev/gpib*; chmod ug+rw /dev/gpib* }}}
[[USB-GPIB| Controlling GPIB devices through USB port]]
Line 155: Line 95:
=== Usage ===
When you connect the GPIB-USB interface to your USB port, the kernel modules should be loaded automatically.
If not, don't worry, the initGPIB script will load them.

First, execute initGPIB script. You have to have {{{sudo}}} privilege to run the script as a normal user.
This script will load the kernel modules, load the firmware twice (a work around for the buggy firmware of 82357B)
and execute {{{gpib_config}}}.

After initGPIB is completed, the "READY" LED on 82357B should be green.

Now connect 82357B to 4395A analyzer. On the 4395A keypad, go to [Local]->[SET ADDRESSES]->[ADDRESS:4395] and set it to 17.
Also set [ADDRESS: CONTROLLER] to 0.

Do a measurement.

Run {{{getgpibdata.py}}}.

The command will output the data transfered from the analyzer into the standard output. So you can redirect it to a file like,

{{{ %getgpibdata.py > data.txt }}}

Then {{{data.txt}}} will look like this,

{{{
+0.00000000000000E+000 +4.604457E-004
+6.25000000000000E+005 +3.845480E-005
+1.25000000000000E+006 +7.024327E-009
+1.87500000000000E+006 +1.066326E-009
+2.50000000000000E+006 +6.686992E-010
+3.12500000000000E+006 +2.618739E-010
...
}}}

The first column is frequency, the second is, in this case, the magnitude of the CH1 spectrum. If you have CH2 active, you will have the third column.
In the case of network analyzer mode, the second column is the real part of the transfer function and the third is the imaginary part.

=== How it works ===
GPIB devices are defined in {{{/etc/gpib.conf}}}. You have to specify the address of a device and assign an arbitrary name.
The name is used later to search for a device in python scripts.

{{{getgpibdata.py}}} is a simple python script. You can modify it to communicate with any kind of GPIB devices.

Here is the programing manual for Agilent 4395A.

attachment:4395A-GPIB-Manual.pdf


== Alternative way (GPIB scripting in Python) ==

Software needed:
 * [http://www.ni.com/visa/ National Instruments VISA driver] (?)
 * [http://sourceforge.net/projects/pyvisa/ Python GPIB library] ([http://superb-west.dl.sourceforge.net/sourceforge/pyvisa/PyVISA-1.1.linux-i686.tar.gz PyVISA-1.1.linux-i686.tar.gz])
 * [http://matplotlib.sourceforge.net/ Python MatPlotLib] ([http://superb-west.dl.sourceforge.net/sourceforge/matplotlib/matplotlib-0.90.0.tar.gz matplotlib-0.90.0.tar.gz])
 * attachment:scripts.tar.gz

GPIB Intro

This page will cover GPIB issues in the 40m lab. Test equipment with a GPIB interface (such as the SR785) may be scripted from a computer.

This page explains the netgpib package, a collection of python scripts/modules to communicate with network connected GPIB devices.

GPIB hardware we have

Controlling GPIB instruments through network

This section describes how to setup and control GPIB instruments through network.

Overview

The basic idea is to talk to a GPIB instrument through a TCP/IP network using the prologix GPIB-Ethernet converter. For some GPIB instruments, like spectrum analyzers, it is convenient to be able to move them around freely. For this purpose, we connect the prologix box to the Martian wireless network through an ethernet-wireless bridge.

After proper setup work, the GPIB-Ethernet converter works as a host in the Martian network. It waits for connections at TCP/IP port 1234. You can talk to the converter by telnet. Simple tasks can be done in this way. More complicated tasks can be accomplished by, for example, python scripts. A python script netgpibdata.py to download data from analyzers will be explained later.

Hardware setup

Prologix

Unpack the box. Connect the prologix to a local network using an Ethernet cable. Connect your PC to the same network.

Execute netfinder.exe. On linux, you can use Wine to execute this file. For example, on Ubuntu, I was able to just install Wine from standard packages, and double clicking the netfinder.exe worked fine.

netfinder.exe will search prologix converters on the local network and let you configure the network settings of the converter. Assign a free Martian IP address to the box. You may want to ask Rana to assign a suitable host name for the box. If a hostname is assigned, please update the name server database on linux1.

The manual for the prologix converter is here: PrologixGpibLanManual.pdf

Linksys WET54G

You have to tell the WET54G which wireless network to connect.

Connect the WET54G and your computer directly with an Ethernet cable. Manually assign 192.168.1.25 to your computer. The netmask is 255.255.255.0 and the gateway is 192.168.1.1.

Open a web browser and go to 192.168.1.226. A password prompt should come up. Enter admin for both username and password. You may want to change the admin password later.

Setup the WET54G for the Martian network. The SSID is "40MARS". Security is off. Enable the MAC address cloning should be enabled.

Check the MAC address of the WET54G wireless port. Register this MAC address to the Martian wireless router. You can access the router by going to 131.215.113.220 from a Martian machine. The setting is in [Wireless]->[Wireless MAC Filter]

Assembly

Connect the Prologix box to a GPIB instrument. Then connect to the WET54G through an Ethernet cable. Confirm the connection by

 telnet 131.215.113.105 1234,

where 131.215.113.105 should be replaced by the IP address assigned to the Prologix box. The above command works only from a computer connected to the Martian network.

Basic usage

First, telnet to a Prologix converter. You can send commands by entering ascii text. Any statements starting with ++ will be interpreted as a command to the Prologix box. Otherwise, the string you entered is forwarded to the GPIB instrument.

++addr 10 will set the GPIB address of the instrument to which the Prologix box will talk with to 10.

++mode 1 sets the operation mode of the Prologix box. You will use mode 1 (controller) most of the time.

netgpibdata.py

This script downloads data from spectrum analyzers through network. It is on the 40m svn repository. You can download it from https://nodus.ligo.caltech.edu:30889/svn/trunk/getgpibdata/netgpibdata/.

Synopsis: netgpibdata.py [-f filename] [-d devicename] [-i ip_address] [-a gpib_address]

filename is the name of the file, without extension, to which the data is saved. If you specify -f spectrumdata , the downloaded data will be saved to spectrumdata.dat and the measurement parameters will be saved in spectrumdata.par.

The device name can be specified by -d devicename. Currently SR785 and AG4395A (Agilent 4395A network analyzer) are supported.

ip_address is the IP address or hostname of the Prologix converter.

gpib_address is the GPIB address of the instrument to talk to.

This script is now a part of netgpib package. More information is available here.

Old USB way

If you want to talk to a GPIB device through USB ports, some information is here.

Controlling GPIB devices through USB port

GPIB (last edited 2013-04-26 19:15:51 by EricquinteroATligoDOTorg)