Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instrument does not recover after timeout; all subsequent commands also time out #49

Open
ghost opened this issue Jan 9, 2019 · 0 comments

Comments

@ghost
Copy link

ghost commented Jan 9, 2019

When a read from my instrument hits the timeout, my session with that instrument does not recover.
All subsequent commands and reads also result in timeout.

For example:

>>> import usbtmc
>>> instr = usbtmc.Instrument(0x0699, 0x3000)
>>> instr.ask('*IDN?')
'TEKTRONIX, FCA3000, 379751, V1.28 25 Aug 2010 11:52'
>>> instr.ask('MEAS:FREQ?')  # instrument responds too slow
...
usb.core.USBError: [Errno 110] Operation timed out
>>> instr.ask('*IDN?')  # insrument should reply quickly
...
usb.core.USBError: [Errno 110] Operation timed out

I have seen this behaviour with a Tektronix FCA3000 and Thorlabs PM100D.
I'm using the latest version of python-usbtmc from Github.
Debian 9.6 - Python 3.5.3 - PyUSB 1.0.0 - libusb 1.0.21 - Linux 4.9.110

Looking at USB traces with Wireshark, I notice that after a timeout, python-usbtmc automatically sends an ABORT_BULK_IN sequence to the device. However the USBTMC specification requires that the host reads from the Bulk-IN endpoint as part of this sequence but python-usbtmc seems to skip that step.

I modified python-usbtmc to read the Bulk-IN endpoint during the ABORT_BULK_IN sequence. With this change, my instrument recovers from timeout and answers quickly to subsequent commands.
I will submit a pull request ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants