# How to use SCPI over RS232 with a Rigol Programmable load?

I have a Rigol DL3021 programmable load. I'd like to control it as part of an automated test setup, over SCPI from a Linux box.

Their programming manual assumes you're on a Windows machine and wants their software to be installed as a prerequisite. Luckily there's an open source VISA implementation called pyvisa which I've had success with over USB. I'm able to detect the device and send it commands. On a side note it seems a bit finicky, but I am new to SCPI and it is perhaps my fault.

Regardless, if I could, I'd like to control it directly over RS232 with SCPI commands. I am ok with writing a small SCPI wrapper driver and giving up whatever nice abstractions VISA provides me in doing this. I have a RS232 to USB FTDI cable which is known working.

When I write SCPI commands to the serial device, though, nothing happens and I receive no response. I have checked the baud, parity, stop bits, control, many times and am confident they match. I see nothing in the manual about needing to explicitly enable RS232 communication on the device.

As an extra datapoint, pyvisa documentation says it should pick up the device over the RS232 adapter, but it doesn't. I'm unsure what to make of this, I have no way to talk to it with the RS232.

This might be where I'm a bit lost, as I'm unclear if there's some handshaking or other magic that needs to be done to start communication with the load. I am working under the assumption that I can send it SCPI commands directly over the RS232 connection, but perhaps I've oversimplified this.

How do I connect to an instrument and check the serial connection?

• What pyvisa backend are you using? What resource string are you using to open a handle to the instrument? Are you properly terminating your commands? Page 10 of the manual says you need to terminate your commands with a carriage return and a newline character. Post an example script sending a "*IDN?" query using pyvisa. – Shamtam Jun 26 at 23:22
• I believe its PyVISA-py. This is the last part of my question, I still need a resource string to open a handle even over RS232?? In the instrument's menu it gives me a resource string in the USB settings but in the RS232 settings it only has serial setup params. I had assumed I could just send SCPI to it over the RS232 connection without needing a resource string. I am properly terminating them with \r\n per the manual, and just using pyserial's serial.write() and serial.read() methods. This has worked for me with other (non-SCPI) instruments. – brenzo Jun 27 at 0:21
• Looks like you can just use the COM port directly as the resource string (see here), e.g. i = rm.open_resource('COM2'). Alternatively, I'm used to using a string like ASRL1::INSTR for e.g. COM1. – Shamtam Jun 27 at 12:21