EEVblog Electronics Community Forum

Products => Test Equipment => Topic started by: matthuszagh on May 15, 2022, 12:00:51 am

Title: Unable to read from HP-IB device using Agilent E5810A and python-vxi11
Post by: matthuszagh on May 15, 2022, 12:00:51 am
I'm trying to setup a collection of old HP-IB instruments for programmatic access, but I'm having some trouble reading data from devices. Sending data works fine. I'm using an Agilent E5810A LAN/GPiB gateway as the HPIB interface.

I've tried two methods: the first is simply to login to the e5810a web interface using the local IP and the "Find & Query Instruments" tab. The second is to use the python-vxi11 package. Both methods yield the same results. For example, here's the output when using python-vxi11:

Code: [Select]
>>> import vxi11
>>> e5810_ip = "192.168.4.43"
>>> e5810 = vxi11.InterfaceDevice(e5810_ip)
>>> e5810.find_listeners()
[22]
>>> hp3457a = vxi11.Instrument(e5810_ip, "gpib0,22")
>>> hp3457a.write("RESET")
>>> hp3457a.write("NPLC,100")
>>> hp3457a.write("DISP,OFF")
>>> hp3457a.write("DISP,ON")
>>> hp3457a.write("NPLC,10")
>>> hp3457a.ask("STB?")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nix/store/3582hv8bqn3b6rv7gs0llxpakwpj2ncj-python3-3.9.9-env/lib/python3.9/site-packages/vxi11/vxi11.py", line 743, in ask
    return self.read(num, encoding)
  File "/nix/store/3582hv8bqn3b6rv7gs0llxpakwpj2ncj-python3-3.9.9-env/lib/python3.9/site-packages/vxi11/vxi11.py", line 731, in read
    return self.read_raw(num).decode(encoding).rstrip('\r\n')
  File "/nix/store/3582hv8bqn3b6rv7gs0llxpakwpj2ncj-python3-3.9.9-env/lib/python3.9/site-packages/vxi11/vxi11.py", line 701, in read_raw
    raise Vxi11Exception(error, 'read')
vxi11.vxi11.Vxi11Exception: 15: IO timeout [read]

All the write commands appear to work as expected. Using the web interface is similar, but I just enter the contents between the quotes in the entry line and then use send or query instead of write or ask, respectively.

Several other observations:

- using the "Read STB" button of the E5810A web interface works: it reads data fine. So, it seems like I'm doing something wrong with my queries, rather than there being a hardware fault. I also get the same results for another instrument, which also suggests the problem is with something I'm doing.
- the 3457A seems to beep when I give it a bogus command (e.g., write("badcmd")). But the timeouts don't beep.

I expect I'm missing something simple here, but I don't see it. Any help appreciated, thanks!
Title: Re: Unable to read from HP-IB device using Agilent E5810A and python-vxi11
Post by: Venturi962 on May 15, 2022, 01:51:25 am
HP 3457A is a bit different in that it doesn't assert GPIB EOI after a Reset (you can check a list of all the settings that the Reset command sets in the Operating Manual), this will cause timeout issues as it looks like the transmission hasn't ended.  To test out if that is the issue, after you issue the RESET, write 'END ALWAYS' and then try to ask/query the 'ID?' command.
Title: Re: Unable to read from HP-IB device using Agilent E5810A and python-vxi11
Post by: matthuszagh on May 15, 2022, 03:02:08 am
HP 3457A is a bit different in that it doesn't assert GPIB EOI after a Reset (you can check a list of all the settings that the Reset command sets in the Operating Manual), this will cause timeout issues as the it looks like the transmission hasn't ended.  To test out if that is the issue, Aater you issue the RESET, write 'END ALWAYS' and then try to ask/query the 'ID?' command.

That worked, thanks!