I have a script for capturing waveform data via USB, that at one point in time was working appropriately. However, recently it stopped working and multiple things/settings were changed making it hard to pinpoint the exact issue.
I am hoping that with luck, and some logs perhaps someone can help me figure out why I am having a timeout issue.
I am using NI-VISA for the driver, and I am using pyvisa/python to communicate with a Tektronix TBS2074B scope. For some reason, I am unable to use the :CURVE?" command and some others, without getting a timeout. I suspect my issue has to do with the configuration of the scope or how things are being transferred but I can't find anything on how to correct this.
Certain simple commands do work, like changing settings, or using '*IDN?' But I really want to be able to save the curve/raw wave data to a container in Python.
import pyvisa
rm = ResourceManager()
rm.list_resources()
scope = rm.open_resource('RESOURCE')
scope.query('*IDN?') # Works
scope.query('CURVE?') # Doesn't work - timeout occurs
As I have said, I have tried adjusting the timeout, but that doesn't seem to help. I think there is a configuration issue somewhere that I am unable to determine.
Here is the error message:
>>> scope.query('CURV?')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\ablem\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyvisa\resources\messagebased.py", line 648, in query
return self.read()
^^^^^^^^^^^
File "C:\Users\ablem\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyvisa\resources\messagebased.py", line 486, in read
message = self._read_raw().decode(enco)
^^^^^^^^^^^^^^^^
File "C:\Users\ablem\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyvisa\resources\messagebased.py", line 442, in _read_raw
chunk, status = self.visalib.read(self.session, size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ablem\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyvisa\ctwrapper\functions.py", line 2337, in read
ret = library.viRead(session, buffer, count, byref(return_count))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ablem\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyvisa\ctwrapper\highlevel.py", line 226, in _return_handler
return self.handle_return_value(session, ret_value) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ablem\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyvisa\highlevel.py", line 251, in handle_return_value
raise errors.VisaIOError(rv)
pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.
And here is the waveform configuration info:
>>> scope.query('WFMI?')
':WFMINPRE:BYT_NR 1;BIT_NR 8;ENCDG ASCII;BN_FMT RI;BYT_OR MSB;NR_PT 2000;PT_FMT Y;XUNIT "s";XINCR 1.0000E-9;XZERO -50.0000E-6;PT_OFF 0;YUNIT "V";YMULT 4.0000E-3;YOFF 0.0E+0;YZERO 0.0E+0;FILTERFREQ 200000000\n'
If anyone has any tips for troubleshooting this issue, it would be greatly appreciated.