question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update to use read and query commands to communicate with RIGOL DG811 device

See original GitHub issue

I am unable to run read and query commands on Rigol Device. I can run the same query on NI VISA test panel and communicate successfully but I fail when I do it using pyvisa. Note: I don’t face any issues when I use write command. it is only when I use read and query commands.

I attach my code below for reference:

>>> import visa
>>> rm = visa.ResourceManager('C:/Program Files (x86)/IVI Foundation/VISA/WinNT/agvisa/agbin/visa32.dll')
>>> inst = rm.open_resource('USB0::0x1AB1::0x0643::DG8A220800316::0::INSTR')
>>> print(inst.query("*IDN?"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pyvisa\resources\messagebased.py", line 613, in query
    return self.read()
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pyvisa\resources\messagebased.py", line 427, in read
    message = self._read_raw().decode(enco)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pyvisa\resources\messagebased.py", line 400, in _read_raw
    chunk, status = self.visalib.read(self.session, size)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pyvisa\ctwrapper\functions.py", line 1584, in read
    ret = library.viRead(session, buffer, count, byref(return_count))
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pyvisa\ctwrapper\highlevel.py", line 193, in _return_handler
    raise errors.VisaIOError(ret_value)
pyvisa.errors.VisaIOError: VI_ERROR_IO (-1073807298): Could not perform operation because of I/O error.

Instrument details

Output of pyvisa-info

Machine Details: Platform ID: Windows-10-10.0.17763-SP0 Processor: Intel64 Family 6 Model 158 Stepping 9, GenuineIntel

Python: Implementation: CPython Executable: C:\Program Files (x86)\Python37-32\python.exe Version: 3.7.7 Compiler: MSC v.1900 32 bit (Intel) Bits: 32bit Build: Mar 10 2020 09:44:33 (#tags/v3.7.7:d7c567b08f) Unicode: UCS4

PyVISA Version: 1.10.1

Backends: ni: Version: 1.10.1 (bundled with PyVISA) #1: C:\Windows\system32\visa32.dll: found by: auto bitness: 32 Vendor: National Instruments Impl. Version: 20971520 Spec. Version: 5244928 py: Version: 0.4.1 ASRL INSTR: Available via PySerial (3.4) USB INSTR: Available via PyUSB (1.0.2). Backend: libusb0 USB RAW: Available via PyUSB (1.0.2). Backend: libusb0 TCPIP INSTR: Available TCPIP SOCKET: Available GPIB INSTR: Please install linux-gpib (Linux) or gpib-ctypes (Windows, Linux) to use this resource type. Note that installing gpib-ctypes will give you access to a broader range of functionality. No module named ‘gpib’

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
MatthieuDartiailhcommented, Jun 24, 2020

Could you send to me a screenshot of the other tabs of the VISA test panel ? Just in case there is some thing at odds with pyvisa defaults.

0reactions
mank4commented, Oct 17, 2021

I had a similar problem with the DG811 where the ResourceManager was not able to find the device. After checking that the device works using Rigols software, I noticed that python-usbtmc is at least able to send commands even though it is not able to receive commands. Recently I’ve upgraded device firmware from 1.08 to 2.06 and now pyvisa works well (read and write) under manjaro linux with the proper udev rules. Upgrading the firmware may also solve your problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RIGOL - User's Guide DG800 Series Function/Arbitrary ...
version of the manual from RIGOL website or contact RIGOL to upgrade the ... USB storage device: reads the waveform files or state...
Read more >
RIGOL - Programming Guide DG800 Series Function/ ...
This chapter introduces how to build the remote communication between the signal generator and the PC; how to control the signal generator remotely....
Read more >
DG800 High Resolution Arbitrary Waveform Generators ...
DG800 Series RIGOL Waveform Generators. 16 Bit High Resolution entry level waveform generation. 1 or 2 channel, 10-35 MHz touch screen generators with...
Read more >
New Rigol 16-bit function generators DG800/900 series
The way we talk about what you are asking about is really memory ... Thanks, I put the "hidden" commands from your list...
Read more >
Rigol DG800 Programming Manual
USB HOST USB DEVICE Figure 1-1 DG800 Communication Interface 1-2 1) Use the USB ... Sending the *OPC? command (query command) and reading...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found