Author Topic: How do you find the proper communication TCP/IP port number for Rigol DG-1022z?  (Read 1526 times)

0 Members and 1 Guest are viewing this topic.

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Ok so I have my DG-1022z connected by ethernet cable to my laptop, and I want to control it without installing the massive framework that comes with NI software. Even for controlling just one device you have to install an entire set of NI drivers for tons of devices. Even if you just download the official Ultra Sigma software, running the installer adds in a ton of NI bloatware (like drivers for every possible device that Rigol makes), with no chance to select just the driver(s) for the device(s) you plan to use. At least that's the situation for the USB connection. As much as I'd like the convenience of operating my DG-1022z as a USB device (so I don't need to waste an Ethernet port), I don't like that Rigol depends exclusively on NI software and driver framework, and doesn't bother to write their own Rigol drivers that you can install by themselves (one for each device that Rigol makes). So to avoid wasting several gigabytes of harddrive space, I've decided to not go with the USB connectivity, and instead go for Ethernet connection.

Fortunately the official Rigol programming guide at https://beyondmeasure.rigoltech.com/acton/attachment/1579/f-0493/1/-/-/-/-/DG1000Z%20Programming%20Guide.pdf gives me every command I'll need to use. Unfortunately, neither this nor any other document I can find tells me what the TCP/IP port number is for sending commands to the DG-1022z. Even the onscreen display on the device itself, when viewing the LAN settings, doesn't show a port number. Instead, the closest thing it shows is a string intended for use with NI VISA drivers (the name of the field is even "VISA" on the onscreen display). The string in question says TCPIP0::192.168.1.1::INSTR and this doesn't tell me at all what the port number is. What I can gather from it is that it's using TCP/IP as the protocol, 192.168.1.1 as the IP address, and that this is for controlling the instrument (it abbreviates it as INSTR). No mention of the port numbers. Apparantly, Rigol intends not only the USB connection to be dependent on NI bloatwear, but also even the TCP/IP connection to be dependent on NI bloatwear. And that's despite the fact that they provide a list of all the commands that can be used in the programming guide, so all you really would need would be to write your own software for sending these commands over TCP/IP (which is a trivial matter, as Windows itself provides API functions for sending data over network sockets), if you could find your device's TCP/IP port number. And that's a big if, as Rigol seems to want to hide it from the end user, as if it were some kind of trade secret.

If anybody else can tell me where to discover my device's port number, I'd be really happy to know.
 

Offline JDubU

  • Frequent Contributor
  • **
  • Posts: 441
  • Country: us
The SCPI command port number for Rigol devices is 5555.
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
The SCPI command port number for Rigol devices is 5555.

Where did you find that? I couldn't find that documented anywhere.
 

Offline JDubU

  • Frequent Contributor
  • **
  • Posts: 441
  • Country: us
I happened to know it from past experience but confirmed it with Google search:

rigol scpi "port number"
 

Offline nightfire

  • Frequent Contributor
  • **
  • Posts: 585
  • Country: de
Another thing when you are not sure about which ports a device has open is to use a port scanner.

Most prominent example here would be nmap: https://nmap.org/
These tools scan the target and print out a number of open ports that are listening to data communication.
 

Offline Kean

  • Supporter
  • ****
  • Posts: 2099
  • Country: au
  • Embedded systems & IT consultant
    • Kean Electronics
It is kind of hidden in the programming guide, but you will find it mentioned under ":SYSTem:COMMunicate:LAN:CONTrol?"

Querying this does kind of end up being a "chicken or the egg" dilemma... so you would have to be querying it over USB.

I'd expect it to be shown on the I/O settings page but I don't think it is.
 

Offline Bud

  • Super Contributor
  • ***
  • Posts: 6912
  • Country: ca
I don't like that Rigol depends exclusively on NI software and driver framework, and doesn't bother to write their own Rigol drivers that you can install by themselves (one for each device that Rigol makes).
Can you name any other manufacturer who does their own  drivers. They all use one of the major ones like NI or Keysight that I have seen.
« Last Edit: February 11, 2024, 04:16:49 pm by Bud »
Facebook-free life and Rigol-free shack.
 

Offline Bud

  • Super Contributor
  • ***
  • Posts: 6912
  • Country: ca
Use Wireshark to capture and analyze LAN messages format, it may not be as simple as you think like just open a connection and send commands in ASCII. There may be particular message format for send and receive, preamble, header, trailer, sequence control, etc. There may also be different numeric data formats that may require translation, depending on what data is sent/received. Integer data format for screen capture may be different from floating data format for aquisition mode, that kind of thing.
Facebook-free life and Rigol-free shack.
 

Offline Kean

  • Supporter
  • ****
  • Posts: 2099
  • Country: au
  • Embedded systems & IT consultant
    • Kean Electronics
Use Wireshark to capture and analyze LAN messages format, it may not be as simple as you think like just open a connection and send commands in ASCII. There may be particular message format for send and receive, preamble, header, trailer, sequence control, etc. There may also be different numeric data formats that may require translation, depending on what data is sent/received. Integer data format for screen capture may be different from floating data format for aquisition mode, that kind of thing.

There is a 264 page programming guide available for the DG1000Z series covering the supported SCPI commands, and giving many examples.  I would think it would be relatively straightforward to implement.  Even the binary transfers for screen capture are pretty clearly documented.
 
The following users thanked this post: Bud

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
I happened to know it from past experience but confirmed it with Google search:

rigol scpi "port number"

I confirmed with a port scan that port 5555 is open. In fact, I found a total of 6 ports are open (including port 80, for the internal web server). The other 5 open ports are:
111
617
618
619
5555

I can't find any documentation online about what these ports are used for, except for port 111. I know that the Rigol DG-1022z uses LXI protocol for network connectivity, because it displays the LXI logo when connected to a network. The official LXI website has a list of used ports at https://www.lxistandard.org/About/LXI-Protocols.aspx and port 111 is to be used for VXI-11 protocol. Also it mentions the use of ports 5024 and 5025 for SCPI commands, and SCPI is a type of command that the DG-1022z uses (according to official Rigol documentation). So I'm actually quite surprised that this Rigol funcgen doesn't use either of those two SCPI port numbers. I've got no idea why Rigol would use non-standard port numbers, except to try to make their system proprietary, and difficult to write 3rd party software for.

And that still doesn't explain what the remaining ports are for. Of the 5 ports that are not for a web server (ports 111, 617, 618, 619, and 5555) I'm not quite sure which one is actually the main communication channel for sending control commands to the device. I really am hoping that there's some kind of official documentation on the use of these 5 ports in general (such as from LXI, VXI, or other standards defining organizations), and more importantly their use with the Rigol DG-1022z specifically. Does Rigol publish a (maybe hard to find) document that actually explains the use of each of those ports?

I'd hate to accidentally send a command to the wrong port, and have it brick the device.
 

Offline rcjoy

  • Regular Contributor
  • *
  • Posts: 51
  • Country: us
Since you mention it supports VXI-11, then using python with the python-vxi11 package is the easiest way to go.
No need to worry about ports, and you don't need to install any NI drivers and frameworks.

 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
Since you mention it supports VXI-11, then using python with the python-vxi11 package is the easiest way to go.
No need to worry about ports, and you don't need to install any NI drivers and frameworks.

I prefer to avoid python if possible. It's an interpreted language. This means if you write a program with it, and you want to distribute it, you need to distribute Python as well. I prefer something like C that can make standalone EXEs. But this kind of direct connecting (rather than working through an already existing framework like the Python VXI-11 framework you already mentioned), means I will need to know the port number. Now I know that supposedly the port 5555 is the one I want, but before I start sending commands on it, I would like official documentation from Rigol that port 5555 is indeed the correct port. Do you know any official PDF docs from Rigol that state that port 5555 is the correct one?
 

Offline coromonadalix

  • Super Contributor
  • ***
  • Posts: 5906
  • Country: ca
If you dont send any calibration, eeprom dump or write    "if the scope has theses commands"      you can use whaterver you want   Pyhton, C, C++,  VB, VS   blah blah

for the port(s)   well   ask rigol directly ?
thats why i ditched Rigol after a scope purchase, documentation is  .......... sucks
their SW  ............  sucks

For Siglent  we developped many apps  in Python and or VS 2021 for Siglent stuff     lot of fun working with them, the IT guy was drooling  loll   
LXI  ... usb and lan controlled
I even done my 1st SW in Labview for an SSG3032X
At 1st we used  Keysight I/O suite, later the Rhode Schwartz  visa drivers with their tools to send receive commands correctly,  know their opened ports  yes
and now   absolutely "no drivers needed"  nothing,  fully lan controlled   ...  we scan the Instrument declared ID  send some "presence request say: IDN"  toc toc yahoo are you there  ...   
that's all

If your network is secured,  you may need to whitelist  their mac's  ...



you can achieve this too ..      if you are afraid to distibute ??  its the same thing as installing usb drivers to make peripheral work ??? 

my 2 cents
« Last Edit: February 13, 2024, 01:41:42 am by coromonadalix »
 

Offline Kean

  • Supporter
  • ****
  • Posts: 2099
  • Country: au
  • Embedded systems & IT consultant
    • Kean Electronics
Now I know that supposedly the port 5555 is the one I want, but before I start sending commands on it, I would like official documentation from Rigol that port 5555 is indeed the correct port. Do you know any official PDF docs from Rigol that state that port 5555 is the correct one?

As I mentioned above, it is documented (poorly) in the official programming guide that you linked to.

Page 2-191 (203 of 264).

Code: [Select]
:SYSTem:COMMunicate:LAN:CONTrol?
Syntax               :SYSTem:COMMunicate:LAN:CONTrol?
Description          Query the number of the initial control connecting terminal used for socket communication.
Return Format        The query returns 5555; if the interface does not support socket, the query returns 0.
 

Offline alm

  • Super Contributor
  • ***
  • Posts: 2881
  • Country: 00
I can't find any documentation online about what these ports are used for, except for port 111. I know that the Rigol DG-1022z uses LXI protocol for network connectivity, because it displays the LXI logo when connected to a network. The official LXI website has a list of used ports at https://www.lxistandard.org/About/LXI-Protocols.aspx and port 111 is to be used for VXI-11 protocol.
Port 111 is portmap. It tells the port assignment for RPC services. If you run rpcinfo -p <ip address> (for Mac / Linux / Unix, probably rpcinfo /p on Windows), it will show you what some of the other ports are used for.

VXI-11 is an RPC based protocol that you could implement in any programming language. Though for something as string-heavy as instrument control, C wouldn't be my first choice.

Offline rcjoy

  • Regular Contributor
  • *
  • Posts: 51
  • Country: us
I prefer to avoid python if possible.

VXI-11 library for C is at https://github.com/f4exb/libvxi11

VXI-11 library for C++ is at https://github.com/Lew-Engineering/libvxi11

Those are for Mac or Linux, so they will need some modifications for if you use Windows.

But using Python initially is the easy way to see if you can talk to the scope at all via the network.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Since you mention it supports VXI-11, then using python with the python-vxi11 package is the easiest way to go.
No need to worry about ports, and you don't need to install any NI drivers and frameworks.

I prefer to avoid python if possible. It's an interpreted language. This means if you write a program with it, and you want to distribute it, you need to distribute Python as well. I prefer something like C that can make standalone EXEs. But this kind of direct connecting (rather than working through an already existing framework like the Python VXI-11 framework you already mentioned), means I will need to know the port number. Now I know that supposedly the port 5555 is the one I want, but before I start sending commands on it, I would like official documentation from Rigol that port 5555 is indeed the correct port. Do you know any official PDF docs from Rigol that state that port 5555 is the correct one?

Python it literally limitless. And a big plus is that ChatGPT is fluent in it.

https://pyinstaller.org/en/stable/
PyInstaller bundles a Python application and all its dependencies into a single package. The user can run the packaged app without installing a Python interpreter or any modules. PyInstaller supports Python 3.8 and newer, and correctly bundles many major Python packages such as numpy, matplotlib, PyQt, wxPython, and others.

I recommend using python for controlling instrumentation. It works.
You can also use C/C++/C#*, but you'd bo doing your own sockets or depending on NI VISA.

*c# is also interpreted
« Last Edit: February 13, 2024, 12:02:58 pm by Jeroen3 »
 

Offline Veteran68

  • Frequent Contributor
  • **
  • Posts: 727
  • Country: us
pyinstaller is just one of several methods of packaging Python apps as EXE's.

I'm an old-school developer who favors ASM/C/C++ for anything I need mad performance out of, but scripting languages have their place. I'm a big fan of Python and Node.js for the right jobs.

*c# is also interpreted

Meh, I could nitpick that statement. It's compiled down to an intermediate runtime language (IRL) of bytecode, similar to Java. So it's partially compiled and partially interpreted. Depending on the runtime, I've seen IRL applications meet and even exceed unoptimized C++ for certain tasks because their bytecode engines and standard libraries can be heavily optimized for those tasks.
 

Offline Ben321Topic starter

  • Frequent Contributor
  • **
  • Posts: 894
I just tried the port 5555 and it seems to be the right one, even though I can find no official documentation for this, nor even the source material that the community seems to have used to find port 5555. It seems that port 5555 for Rigol is just a piece of knowledge floating around the electronics hobby community with no real known source. It's a piece of knowledge that just seems to "exist" without having been found. Very strange.
 

Offline Berni

  • Super Contributor
  • ***
  • Posts: 4957
  • Country: si
Don't reinvent the wheel. Just install a VISA library and be done with it.

You are free to choose whatever VISA implementation you would like to use. Be it from National Instruments, Rigol, Keysight, R&S..etc Personally i like Keysights implementation because it has a nice UI and lets you spy on the traffic live (useful for debugging):
https://www.keysight.com/de/de/lib/software-detail/computer-software/io-libraries-suite-downloads-2175637.html

The stuff is all standardized by the IVI Foundation, so Keysights VISA library has no problem talking to Rigol or Tek gear. The software side API is also standardized, so the applications making use of it also see no difference. It all looks the same no matter the connection method of the instrument, be it USB, RS232, GPIB, Ethernet, GPIB to Ethernet bridge, PCIe, PXI..etc All you do is include the VISA.dll in your application, tell it you want to connect to "TCPIP0::192.168.2.102::inst0::INSTR" and it will connect and you can start feeding commands to it. The DLL itself is a old school machine code DLL, but it has bindings into modern .net or python or whatever you like.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf