python-usbtmc: one instrument connects, the other is partially invisible

236 views
Skip to first unread message

Alexander Finch

unread,
Nov 11, 2017, 12:43:14 AM11/11/17
to python-ivi
Hello!

After much fighting with various USBTMC solutions, your python module worked a charm first time. I was able to connect to and *IDN? a B&K 8600 electronic load box. I was very happy.

Then I tried to do the same with another device, a B&K 9202 voltage supply. Less successful. It does not return from the ask() procedure. Interestingly, if the instrument is unpowered, it does fail immediately (Device Not Found exception), suggesting something is happening, but it's getting stuck. I have verified that the USB control setting on the instrument is enabled.

Both instruments appear in lsusb and have correct udev permissions. They are also both correctly identified in a list() function.

The following script (Python 3.5):

import usbtmc
print(usbtmc.list_devices())

instr_loadbox = usbtmc.Instrument(0xFFFF, 0x8800)
instr_supply =  usbtmc.Instrument(0xFFFF, 0x9200)

print("Load ID:")
print(instr_loadbox.ask("*IDN?"))

print("Supply ID:")
print(instr_supply.ask("*IDN?"))

Yields this output (with stack after ctrl-c):

[<DEVICE ID ffff:8800 on Bus 001 Address 016>, <DEVICE ID ffff:9200 on Bus 001 Address 011>]
Load ID:
B&K Precision, 8600, 602197010717120007, 1.34-1.39
Supply ID:
^CTraceback (most recent call last):
  File "./nova_sfft.py", line 19, in <module>
    print(instr_supply.ask("*IDN?"))
  File "/home/nova/.local/lib/python3.5/site-packages/usbtmc/usbtmc.py", line 629, in ask
    self.write(message, encoding)
  File "/home/nova/.local/lib/python3.5/site-packages/usbtmc/usbtmc.py", line 609, in write
    self.write_raw(str(message).encode(encoding))
  File "/home/nova/.local/lib/python3.5/site-packages/usbtmc/usbtmc.py", line 475, in write_raw
    self.open()
  File "/home/nova/.local/lib/python3.5/site-packages/usbtmc/usbtmc.py", line 349, in open
    self.clear()
  File "/home/nova/.local/lib/python3.5/site-packages/usbtmc/usbtmc.py", line 712, in clear
    time.sleep(0.1)
KeyboardInterrupt 
libusb: error [_get_usbfs_fd] File doesn't exist, wait 10 ms and try again
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/088/120: No such file or directory

There is no device with that bus/device id combo visible in sudo lsusb -v. Those last two lines don't always appear, so not sure what to make of that.

Other commands that do not have a response, sent using write(), also fail (they, like the *IDN?, work for the 8600 load box fine).

Have you any ideas what might be causing these two similar device to behave differently, despite the manufacturer and (apparent) implementation being the same? Are there any tests I can do to try and work it out?

Any advice much appreciated :)
Reply all
Reply to author
Forward
0 new messages