|
Size: 5173
Comment:
|
← Revision 43 as of 2013-04-26 19:15:51 ⇥
Size: 5645
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| = GPIB issues = | = GPIB Intro = |
| Line 5: | Line 5: |
| [[netGPIB| This page explains the netgpib package]], a collection of python scripts/modules to communicate with network connected GPIB devices. |
|
| Line 6: | 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 10: | Line 12: |
| == 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. |
== Controlling GPIB instruments through network == This section describes how to setup and control GPIB instruments through network. |
| Line 14: | Line 15: |
| === Installation === ===== What you need ===== Linux kernel source (2.6.8 or above) python, python-dev fxload (from linux-hotplug project) lsusb (usbutils package) |
=== 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. |
| Line 21: | Line 20: |
| 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 |
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. |
| Line 25: | Line 24: |
| {{{ usbfs /proc/bus/usb usbfs defaults 0 0 }}} |
=== Hardware setup === ==== Prologix ==== Unpack the box. Connect the prologix to a local network using an Ethernet cable. Connect your PC to the same network. |
| Line 29: | Line 28: |
| ===== Installing linux-gpib driver ===== Before installing linux-gpib driver, create a group {{{gpib}}}, by {{{sudo vigr}}}. |
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 standard packages, and double clicking the netfinder.exe worked fine. |
| Line 32: | Line 31: |
| You want to add some users (e.g. controls) to {{{gpib}}} group so that those users can open GPIB devices. |
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. |
| Line 35: | Line 35: |
| Download the latest version from http://linux-gpib.sourceforge.net/ |
Alternatively, if you would rather use python than Wine, you can use these python scripts: [[attachment:pynetfinder.tar.gz]]. You can search for controllers with {{{python nfcli.py --list}}}, and set parameters with something like {{{python nfcli.py --eth_addr='00-21-69-01-03-99' --gateway='131.215.123.254' --ip_addr='131.215.123.65' --ip_type='static' --netmask='255.255.255.0'}}} |
| Line 38: | Line 38: |
| Expand the archive and execute the following, | The manual for the prologix converter is here: [[attachment:PrologixGpibLanManual.pdf]] |
| Line 40: | Line 41: |
| {{{ ./configure --enable-python-binding --with-linux-srcdir=/lib/modules/2.6.24-19/build }}} | ==== Linksys WET54G ==== You have to tell the WET54G which wireless network to connect. |
| Line 42: | Line 44: |
| where 2.6.24-19 should be replaced by your kernel version. | 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. |
| Line 44: | Line 47: |
| {{{ make; sudo make install }}} should install the driver. | 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. |
| Line 46: | Line 49: |
| ===== Installing firmwares ===== Download the proprietary firmwares from http://linux-gpib.sourceforge.net/firmware/ |
Setup the WET54G for the Martian network. The SSID is "40MARS". Security is off. Enable the MAC address cloning should be enabled. |
| Line 49: | Line 51: |
| Expand the archive and copy {{{agilent_82357a/*.hex}}} to {{{/usr/share/usb/agilent_82357a/}}}. If the target directory does not exist, make it. |
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] |
| Line 52: | Line 55: |
| ===== Configuration file and scripts ===== | ==== Assembly ==== Connect the Prologix box to a GPIB instrument. Then connect to the WET54G through an Ethernet cable. Confirm the connection by |
| Line 54: | Line 59: |
| Put the following file in {{{/etc/}}}. attachment:gpib.conf |
{{{ telnet 131.215.113.105 1234}}}, |
| Line 57: | Line 61: |
| Add the following lines to your {{{/etc/modprobe.conf}}} | 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. |
| Line 59: | Line 68: |
| {{{ alias char-major-160 gpib_common alias char-major-160-0 agilent_82357a alias gpib0 agilent_82357a }}} |
{{{++addr 10}}} will set the GPIB address of the instrument to which the Prologix box will talk with to 10. |
| Line 65: | Line 70: |
| Put the following files into somewhere in your PATH. | {{{++mode 1}}} sets the operation mode of the Prologix box. You will use mode 1 (controller) most of the time. |
| Line 67: | Line 72: |
| attachment:initGPIB attachment:getgpibdata.py |
=== 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/. |
| Line 70: | Line 77: |
| Be sure to set the permission of those files to executable. | Synopsis: netgpibdata.py [-f filename] [-d devicename] [-i ip_address] [-a gpib_address] |
| Line 72: | Line 80: |
| Change the group of /dev/gpib* to gpib and set the permission to group readable/writable. | 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. |
| Line 74: | Line 84: |
| {{{ chown root:gpib /dev/gpib*; chmod ug+rw /dev/gpib* }}} | 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 [[netGPIB|here]]. === Old USB way === If you want to talk to a GPIB device through USB ports, some information is here. [[USB-GPIB| Controlling GPIB devices through USB port]] |
| Line 77: | Line 98: |
| === 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
Linksys WET54G ethernet-wireless bridge for adding a wireless capability to the prologix box.
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.
Alternatively, if you would rather use python than Wine, you can use these python scripts: pynetfinder.tar.gz. You can search for controllers with python nfcli.py --list, and set parameters with something like python nfcli.py --eth_addr='00-21-69-01-03-99' --gateway='131.215.123.254' --ip_addr='131.215.123.65' --ip_type='static' --netmask='255.255.255.0'
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.
