January 31, 2021 Test Equipment

Rigol DG1022 - Control with Python (pyvisa)

Communication problems using the USB interface of the Rigol DG1022 function generator

Rigol DG1022 - Control with Python (pyvisa)

Last night I was ready to end it all and buy a new function generator. It was not that I was not happy with my Rigol DG1022 or that I needed something with better specs. Despite trying for a long time I could not communicate using python.

So I thought I would try one last time.

The problem

My problem was that both Keysight's Connection Expert and Rigol's UltraWave worked fine with the USB connection. So I knew there was nothing wrong with the drivers or firmware. Also python with pyvisa could open a connection, send SCPI commands but did not receive anything from the device.

Whenever I tried something like the following I would get a timeout error.

The solution

The solution was quite simple. I used the write and read methods (instead of query) with a little delay before the read. I cannot explain why this works but it does. Here's an example: