Following on the series for "GPIB" control of instruments, this post is about LXI control, in particular the Rigol DSA815-TG spectrum analyzer. It is more Linux oriented but commands can be ported to other systems.
Did this out of need since I could not find a single explanatory source of information for all the commands listed besides the programing guide and as all programing guides, they never have a simple; "how to to this"
Most of the command are using the "lxi" tool v1.21. You can use also the gui version "lxi-gui"
LXI is nothing more than LAN extensions for instrumentation control. Same end result as GPIB or Serial port control, that is, you have a system that controls and queries the instrument, only the medium is different on this case, it uses a more modern approach, the Ethernet/LAN.
Recently acquired a Rigol DSA815-TG 1.5Ghz spectrum analyzer and although at the moment I only use computer control for taking some screenshots would be interesting to know how to take more advantage of instrument remote control.
First thing you will need is connect your instrument via the LAN port to your local network, in my case I just connect it back to back to my laptop. Then you will need to set the IP via instrument panel, in my case I used a static IP in the same range as the Ethernet port of the laptop.
In case you don't know your instrument IP, case configured by DHCP for example, you can use the "lxi" tool discover command to "automatically" discover the instruments available on you local are network.
# lxi discover
Searching for LXI devices - please wait...
Broadcasting on interface lo
Broadcasting on interface enp9s0
Found "Rigol Technologies,DSA815,DSA8A22XXXXXX,00.01.19.00.02" on address 192.168.1.81
Broadcasting on interface wlp12s0
Found 1 device
If you are more inclined to review some additional protocol specifications,you can find it here.
A simple wireshark capture allows to have an idea of the inner workings of the discovery process.
At this stage you can query the instrument with the classic "*IDN?" command:
# lxi scpi --address 192.168.1.81 "*IDN?"
A: Rigol Technologies,DSA815,DSA8A22XXXXXX,00.01.19.00.02
Note: I replaced part of the instrument identifier string with X's.
You can also use a normal "telnet" to port 5555 and make de same query:
# telnet 192.168.1.81 5555
Connected to 192.168.1.81.
Escape character is '^]'.
Now let's take some data from the instrument, a screenshot for a start, using the lxi tool screenshot option:
# lxi screenshot --address 192.168.1.81 trace.bmp
Result is is "trace.bmp file saved on the current working directory:
The screenshot will literary take a screenshot of what's visible on the screen be it a trace or a configuration screen.
Even more complicated screenshot for the command line die hard's:
# echo ":PRIV:SNAP? BMP" | nc -w 5 192.168.1.81 5555 | dd bs=1 skip=11 of=screen.bmp
Continuing with some other commands...
Display brightness query:
# lxi scpi --address 192.168.1.81 "DISP:BRIG?"
Note: answer with be a numeric value of the the setting, in my case is "1"
If you need to change to "2" the screen brightness:
# lxi scpi --address 192.168.1.81 "DISPlay:BRIGhtness 2"
Turning the tracking generator/TG on:
# lxi scpi --address 192.168.1.81 "OUTP:STATE 1"
Querying the tracking generator/TG status:
# lxi scpi --address 192.168.1.81 "OUTP:STATE?"
Output will be 1 or 0 if ON or OFF.
Setting and querying the start frequency:
# lxi scpi --address 192.168.1.81 "FREQ:START 124Mhz"
# lxi scpi --address 192.168.1.81 "FREQ:START?"
Note: it will answer the previous set frequency: "124000000"
For stop frequency should be "FREQuency:STOP", bellow for a 450Mhz stop frequency
# lxi scpi --address 192.168.1.81 "FREQ:STOP 450Mhz"
The result will be like this on the spectrum analyzer:
Now we need to take/download traces: this for me is the most interesting part since we can take the traces and then compute over the results, for instance in SWR (when trial license expires ) or 3db bandwidth for example.
Download data of trace 1
# lxi scpi --address 192.168.1.81 ":TRACe:DATA? TRACe1"
Output, (shortened version) will be similar to this:
#9000009014 -2.017071e+01, -5.862679e+01, -6.025334e+01, -6.129734e+01, -6.015621e+01, -6.299181e+01, -5.941000e+01, -6.174416e+01, -5.768233e+01, -6.222626e+01, -6.008302e+01, -6.109689e+01, -6.196978e+01, -6.302518e+01, -6.228621e+01, -6.230527e+01, -6.312371e+01, -6.304392e+01, -6.187805e+01, -6.133699e+01, -6.096120e+01, -5.720531e+01, -5.873640e+01, -6.165216e+01, -5.796873e+01, -5.905419e+01, -5.763849e+01, -6.094759e+01, -6.073965e+01,..
You can "pipe" the command to file this way:
# lxi scpi --address 192.168.1.81 ":TRACe:DATA? TRACe1" > trace1.csv
Open "trace1.csv" on a spreadsheet software and plot a graph:
To download trace 3 for example:
# lxi scpi --address 192.168.1.81 ":TRACe:DATA? TRACe3"
If nothing is set for that trace the output will look like this:
#9000009014 -4.000000e+02, -4.000000e+02, -4.000000e+02, -4.000000e+02, -4.000000e+02, -4.000000e+02, -4.000000e+02, -4.000000e+02, -4.000000e+02, -4.000000e+02, -4.000000e+02, -4.000000e+02, -4.000000e+02,...(continues)
As last command on this series, let's query the instrument language:
# lxi scpi --address 192.168.1.81 "SYST:LANG?"
Output is on my case: "ENGl"
- In the future will try to add more commands in this document and write some scripts for automation, maybe even a GUI program.
- If you copy past the command in this post, don't forget to set your instrument IP instead of the one I used (192.168.1.81)
- Rigol DSA800 programing guide can be downloaded at: https://www.batronix.com/files/Rigol/Spektrum-Analysatoren/DSA800/DSA800_ProgrammingGuide_EN.pdf
Hope this helps someone,
Have a nice day!