Products > Test Equipment

Siglent SDS1104X-E and SDS1204X-E: Bode plot with a non-Siglent AWG

<< < (24/35) > >>

awakephd:
I realize this is a very late response, and I may be about to "teach grandma to suck eggs" as the saying goes (tell you what you already know) ... apologies if that is the case.

On choosing an IP address - Knutselaar suggests 192.168.0.155, with the idea that 155 is unlikely to be taken. This is probably going to work most of the time, assuming one's wifi router is set to start addresses at 192.168.0.100 ... but there is a better way: Most (nearly all?) wifi routers will allow you to reserve IP addresses, generally by MAC. Once reserved, you can be confident that no other device will receive that IP address from the router.

Again, I apologize if I am repeating the obvious / mansplaining / etc.!

das_strobel:

--- Quote from: bateau020 on May 01, 2024, 02:02:31 pm ---The SDS800X-HD (SDS804X-HD/SDS814X-HD/SDS824X-HD) changed the initialization phase (uses UDP instead of TCP for the port mapping phase, and requires VXI port changes), and as a result, the original script does not work on that scope.
In case you "upgraded" your scope and still want to use the script, see my repo https://github.com/hb020/sds1004x_bode/

--- End quote ---

Thanks for this work. I cloned your repo and tried it with my brand new SDS1000X HD and my old Rigol DG1062Z (predecessor of the DG800 series) and it works beautifully using "dg800" for the awg parameter. So again: Great work!

I few small comments:

I'm using Ubuntu 22.04 LTS and the lates Python available from the default repos is 3.11, default is 3.10. You have a few debug strings that use the relaxed f-format syntax from 3.12. This unnecessarily breaks the script for the older versions. I fixed it on my side (it is just replacing a few double quotes with single quotes) and then everything works. I'd suggest you might want to change this to make the script more compatible. I can provide you a PR to your repo if you wish.

There is way of running this script without sudo, which enabled me to use the debugger on the script in vscode without running the whole vscode as root:

--- Code: ---sudo setcap 'CAP_NET_BIND_SERVICE+ep' /bin/python3.10
--- End code ---
Downside is this enables all python instances to be able to serve privileged ports... But I found this more convenient for debugging.

The final comment will probably only apply to very few people but I wanted to share my findings. Maybe it helps somebody. I got this error message when I started the script:

--- Code: ---Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  [...]
  File ".../sds1004x_bode/sds1004x_bode/awg_server.py", line 88, in create_socket
    sock.bind((host, port))
OSError: [Errno 98] Address already in use

--- End code ---
This was due to the fact that on my Linux machine rpcbind was running which is needed by nfs.server. After temporarily stopping it using the command

--- Code: ---sudo systemctl stop rpcbind.socket rpcbind.service

--- End code ---
the script finally worked. Rpcbind can be started again with

--- Code: ---sudo systemctl start rpcbind.socket rpcbind.service

--- End code ---

bateau020:

--- Quote from: das_strobel on September 06, 2024, 10:14:43 am ---...I cloned your repo
...few small comments

--- End quote ---

Thanks for the heads up. I will add the proposed changes and comments to the repo. A PR would be best, but I will try to reproduce, since it seems easy to do.

das_strobel:

--- Quote from: bateau020 on September 06, 2024, 10:20:47 am ---A PR would be best, but I will try to reproduce, since it seems easy to do.

--- End quote ---

To spare you some work here is the git diff

--- Code: ---$ git diff
diff --git a/sds1004x_bode/awg_server.py b/sds1004x_bode/awg_server.py
index 59b1958..b8aea46 100644
--- a/sds1004x_bode/awg_server.py
+++ b/sds1004x_bode/awg_server.py
@@ -101,7 +101,7 @@ class AwgServer(object):
 
         print("Starting AWG server...")
         print(f"Listening on {self.host}")
-        print(f"RPCBIND on {"UDP" if self.portmap_on_udp else "TCP"} port {self.rpcbind_port}")
+        print(f"RPCBIND on {'UDP' if self.portmap_on_udp else 'TCP'} port {self.rpcbind_port}")
         print(f"VXI-11 on TCP port {self.vxi11_port}")
 
         print("Creating sockets...")
diff --git a/sds1004x_bode/awgdrivers/dg800.py b/sds1004x_bode/awgdrivers/dg800.py
index 0db9c19..3b60f0e 100644
--- a/sds1004x_bode/awgdrivers/dg800.py
+++ b/sds1004x_bode/awgdrivers/dg800.py
@@ -26,6 +26,7 @@ WAVEFORM_COMMANDS = {
 # Default AWG settings
 DEFAULT_LOAD = 50
 DEFAULT_OUTPUT_ON = False
+DEBUG_OUT = True
 
 
 class RigolDG800(BaseAWG):
@@ -100,7 +101,7 @@ class RigolDG800(BaseAWG):
             self.enable_output(2, on)
         else:
             self.channel_on[channel - 1] = on
-            self._send_command(f":OUTPUT{channel}:STATE {"ON" if on else "OFF"}")
+            self._send_command(f":OUTPUT{channel}:STATE {'ON' if on else 'OFF'}")
 
     def set_frequency(self, channel: int, freq: float):
         if DEBUG_OUT:
diff --git a/sds1004x_bode/awgdrivers/utg1000x.py b/sds1004x_bode/awgdrivers/utg1000x.py
index b0437be..96af648 100644
--- a/sds1004x_bode/awgdrivers/utg1000x.py
+++ b/sds1004x_bode/awgdrivers/utg1000x.py
@@ -100,7 +100,7 @@ class UTG1000x(BaseAWG):
             self.enable_output(2, on)
         else:
             self.channel_on[channel - 1] = on
-            self._send_command(f":CHAN{channel}:OUTPUT {"ON" if on else "OFF"}")
+            self._send_command(f":CHAN{channel}:OUTPUT {'ON' if on else 'OFF'}")
 
     def set_frequency(self, channel: int, freq: float):
         if DEBUG_OUT:


--- End code ---

bateau020:
Done. Added some better debugging in the port opening. Tested under Python 3.8. and later.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod