read_raw throws timeout error when communicating with tektronix oscilloscope using pyvisa package

1k views Asked by At

I am trying to read raw data using pyvisa which communicates with MDO3014 oscilloscope.

The code I have tried is as follows:-

import pyvisa
rm = pyvisa.ResourceManager()

usb = rm.list_resources()[0]
my_instrument = rm.open_resource(usb)
print(my_instrument.query('*IDN?'))
my_instrument.timeout = 25000

my_instrument.write('SAVE:IMAGe:FILEF PNG')
my_instrument.write('HARDCOPY:START')
raw_data = my_instrument.read_raw()

I am getting timeout error, the traceback of error logs is as follows:-

('USB0::0x0699::0x0408::C031378::INSTR', 'ASRL1::INSTR', 'ASRL3::INSTR')
TEKTRONIX,MDO3014,C031378,CF:91.1CT FV:v1.30

Traceback (most recent call last):
  File "waveform_capture.py", line 14, in <module>
    raw_data = my_instrument.read_raw()
  File "C:\Users\venugopal.venkatesh\.virtualenvs\python_oscilloscope-zAKD9iXY\lib\site-packages\pyvisa\resources\messagebased.py", line 405, in read_raw
    return bytes(self._read_raw(size))
  File "C:\Users\venugopal.venkatesh\.virtualenvs\python_oscilloscope-zAKD9iXY\lib\site-packages\pyvisa\resources\messagebased.py", line 442, in _read_raw
    chunk, status = self.visalib.read(self.session, size)
  File "C:\Users\venugopal.venkatesh\.virtualenvs\python_oscilloscope-zAKD9iXY\lib\site-packages\pyvisa\ctwrapper\functions.py", 
line 2337, in read
    ret = library.viRead(session, buffer, count, byref(return_count))
  File "C:\Users\venugopal.venkatesh\.virtualenvs\python_oscilloscope-zAKD9iXY\lib\site-packages\pyvisa\ctwrapper\highlevel.py", 
line 222, in _return_handler
    return self.handle_return_value(session, ret_value)  # type: ignore
  File "C:\Users\venugopal.venkatesh\.virtualenvs\python_oscilloscope-zAKD9iXY\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.
0

There are 0 answers