lxi-tools TTi PL303QMD-P connection help required - Page 1
Forum section: electronics / testgear

author: lambcutlet
author_rank: Contributor
timestamp: August 16, 2023, 09:09:42 pm
content: 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: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:#!/bin/bashIP_ADDR=192.168.1.124PORT=9221lxi benchmark --address $IP_ADDR --raw --port $PORTlxi 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?

author: tautech
author_rank: Super Contributor
timestamp: August 16, 2023, 09:28:17 pm
content: Suggest you engage directly with the developer:https://www.eevblog.com/forum/testgear/open-source-lxi-tools-v2-0-released/

author: lambcutlet
author_rank: Contributor
timestamp: August 17, 2023, 09:22:28 pm
content: Hi Lundmar,Testing to find the cause I copiedhttps://github.com/lxi-tools/lxi-tools/blob/master/examples/lua/basics.luaAnd dropped this into 'script' in the GUI. This fails. ReportingCode:[string "buffer"]:103: attempt to call a nil value (field 'pow')Even running the same program from the commandline results inCode:lua: test.lua:103: attempt to call a nil value (field 'pow')stack traceback:test.lua:103: in main chunk: in ?Realised then when i runCode: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

author: lundmar
author_rank: Frequent Contributor
timestamp: August 19, 2023, 02:55:15 pm
content: Quote from: lambcutlet on August 17, 2023, 09:22:28 pmTurns 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.Quote from: lambcutlet on August 17, 2023, 09:22:28 pmI'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

author: lundmar
author_rank: Frequent Contributor
timestamp: August 19, 2023, 07:36:22 pm
content: 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.

author: lambcutlet
author_rank: Contributor
timestamp: August 19, 2023, 08:10:15 pm
content: Hi Lundmar,Installed lxi-tools via 'snap' version 2.7And I can confirm I now receive a valid *IDN? response.Also the lua script math.pow to '^' works. As you described.Thankyouconsider this closed

author: lundmar
author_rank: Frequent Contributor
timestamp: August 19, 2023, 08:34:31 pm
content: Quote from: lambcutlet on August 19, 2023, 08:10:15 pmNo worries. And thank you for pointing me to this issue. It lead me to making the new release.