Author Topic: lxi-tools TTi PL303QMD-P connection help required  (Read 870 times)

0 Members and 1 Guest are viewing this topic.

Offline lambcutletTopic starter

  • Contributor
  • Posts: 13
  • Country: gb
lxi-tools TTi PL303QMD-P connection help required
« on: August 16, 2023, 09:09:42 pm »
Hi,
I need some help using 'script' in lxi-tools.
lxi-tools version 2.6, fedora dnf install.

In the 'script' window i have this. Which does not work.
Code: [Select]
psu = lxi_connect("192.168.1.124", 9221, nil, 2000, "RAW") --
print("psu id = " .. lxi_scpi(psu, "*IDN?"))
lxi_disconnect(psu)

Using the 'scpi' window I can send '*IDN?'', using a manual configured, ip address, RAW/TCP, 9221. This works.
Even using a simple bash script I can get a response.
Code: [Select]
#!/bin/bash

IP_ADDR=192.168.1.124
PORT=9221

lxi benchmark --address $IP_ADDR --raw --port $PORT

lxi scpi --address $IP_ADDR --raw --port $PORT "*IDN?"
lxi scpi --address $IP_ADDR --raw --port $PORT "v1 12.34"
lxi scpi --address $IP_ADDR --raw --port $PORT "v1?"

But the 'script' window has me stumped.
Can anyone provide advice?
 

Online tautech

  • Super Contributor
  • ***
  • Posts: 28891
  • Country: nz
  • Taupaki Technologies Ltd. Siglent Distributor NZ.
    • Taupaki Technologies Ltd.
Re: lxi-tools TTi PL303QMD-P connection help required
« Reply #1 on: August 16, 2023, 09:28:17 pm »
Avid Rabid Hobbyist.
Siglent Youtube channel: https://www.youtube.com/@SiglentVideo/videos
 
The following users thanked this post: lambcutlet

Offline lambcutletTopic starter

  • Contributor
  • Posts: 13
  • Country: gb
Re: lxi-tools TTi PL303QMD-P connection help required
« Reply #2 on: August 17, 2023, 09:22:28 pm »
Hi Lundmar,

Testing to find the cause I copied
https://github.com/lxi-tools/lxi-tools/blob/master/examples/lua/basics.lua
And dropped this into 'script' in the GUI. This fails. Reporting
Code: [Select]
[string "buffer"]:103: attempt to call a nil value (field 'pow')Even running the same program from the commandline results in
Code: [Select]
lua: test.lua:103: attempt to call a nil value (field 'pow')
stack traceback:
test.lua:103: in main chunk
[C]: in ?
Realised then when i run
Code: [Select]
psu = lxi_connect("192.168.1.124", 9221, nil, 2000, "RAW") --
print("psu id = " .. lxi_scpi(psu, "*IDN?"))
lxi_disconnect(psu)
This also fails with 'attempt to call nil value'.

Any idea why this is?
Is there a package that needs installed?

Lua version 5.4.4
 

Offline lundmar

  • Frequent Contributor
  • **
  • Posts: 439
  • Country: dk
Re: lxi-tools TTi PL303QMD-P connection help required
« Reply #3 on: August 19, 2023, 02:55:15 pm »
Hi Lundmar,

Testing to find the cause I copied
https://github.com/lxi-tools/lxi-tools/blob/master/examples/lua/basics.lua
And dropped this into 'script' in the GUI. This fails. Reporting
Code: [Select]
[string "buffer"]:103: attempt to call a nil value (field 'pow')Even running the same program from the commandline results in
Code: [Select]
lua: test.lua:103: attempt to call a nil value (field 'pow')
stack traceback:
test.lua:103: in main chunk
[C]: in ?

Turns out that math.pow() has been deprecated by lua. Instead we need to use the math operator "^". I've updated the lua script to use this.

Realised then when i run
Code: [Select]
psu = lxi_connect("192.168.1.124", 9221, nil, 2000, "RAW") --
print("psu id = " .. lxi_scpi(psu, "*IDN?"))
lxi_disconnect(psu)
This also fails with 'attempt to call nil value'.

Any idea why this is?
Is there a package that needs installed?

Lua version 5.4.4

I'm not sure. The documentation for your instrument does state that it only supports socket (raw) communication on port 9221 so it should work.

I can connect to my R&S NGM202 PSU using the following raw connect test script:
https://github.com/lxi-tools/lxi-tools/blob/master/examples/lua/connect-raw.lua
« Last Edit: August 19, 2023, 04:30:19 pm by lundmar »
https://lxi-tools.github.io - Open source LXI tools
https://tio.github.io - A simple serial device I/O tool
 

Offline lundmar

  • Frequent Contributor
  • **
  • Posts: 439
  • Country: dk
Re: lxi-tools TTi PL303QMD-P connection help required
« Reply #4 on: August 19, 2023, 07:36:22 pm »
FYI - lxi-tools had a regression so that the print() function printed the output to the console of the application instead of the console of the gui.

This is now fixed in the recently released lxi-tools v2.7.

So if the problem is that you didn't see any response, that is why.
https://lxi-tools.github.io - Open source LXI tools
https://tio.github.io - A simple serial device I/O tool
 

Offline lambcutletTopic starter

  • Contributor
  • Posts: 13
  • Country: gb
Re: lxi-tools TTi PL303QMD-P connection help required
« Reply #5 on: August 19, 2023, 08:10:15 pm »
Hi Lundmar,

Installed lxi-tools via 'snap' version 2.7
And I can confirm I now receive a valid *IDN? response.
Also the lua script math.pow to '^' works. As you described.

Thankyou
consider this closed
 

Offline lundmar

  • Frequent Contributor
  • **
  • Posts: 439
  • Country: dk
Re: lxi-tools TTi PL303QMD-P connection help required
« Reply #6 on: August 19, 2023, 08:34:31 pm »
Hi Lundmar,

Installed lxi-tools via 'snap' version 2.7
And I can confirm I now receive a valid *IDN? response.
Also the lua script math.pow to '^' works. As you described.

Thankyou
consider this closed

No worries. And thank you for pointing me to this issue. It lead me to making the new release.  :-+
https://lxi-tools.github.io - Open source LXI tools
https://tio.github.io - A simple serial device I/O tool
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf