EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
<== Date ==> <== Thread ==>

Subject: RE: SCPI StreamDevice troubleshooting (Keysight 34980A via TCP)
From: Mark Rivers via Tech-talk <tech-talk at aps.anl.gov>
To: Zimoch Dirk <dirk.zimoch at psi.ch>, "leblanc at ohio.edu" <leblanc at ohio.edu>
Cc: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Fri, 20 Jan 2023 17:14:06 +0000
Hi Gregory,

I agree with Dirk, your problem is probably terminators.  When you use telnet it is sending a terminator when you press Enter to send the command to the device.  You can look at the device documentation to see what terminator is expected, probably \n or \r.

You then should modify your st.cmd as follows, for example:

drvAsynIPPortConfigure("LAN0","10.0.0.105:5025",0,0,0)
asynOctetSetOutputEos("LAN0", 0, "\n")
asynOctetSetInputEos("LAN0", 0, "\n")

For debugging you should add these lines as well.  You will then see messages for all characters sent and received.
asynSetTraceIOMask("LAN0", 0, "ESCAPE")
asynSetTraceMask("LAN0", 0, "ERROR|DRIVER")

Your st.cmd has this comment:

#5th argument is noProcessEOS; 0 means do not close connection on timeout, 1 means close it

That comment is incorrect.  noProcessEOS means whether the asynInterposeEos interface to process EOS characters (i.e. terminators) is enabled.  This interface adds terminators on output and waits  for them on input.  The default is 0 which means the interface is enabled.  If you have not called asynOctetSetOutputEos or asynOctetSetInputEos then no characters are added or waited for, which is the case for your existing st.cmd.  

Enabling that interface also has another effect, which is character buffering.  For example, if you don't set a terminator but do attempt to read a specific number of octets, for example 500, from the device, the asynInterposeEos interface will not return from the read() function until 500 characters are received.  If that interface is disabled then the read() function will return as soon as the driver receives any characters from the device.

Mark


-----Original Message-----
From: Tech-talk <tech-talk-bounces at aps.anl.gov> On Behalf Of Zimoch Dirk via Tech-talk
Sent: Friday, January 20, 2023 10:50 AM
To: leblanc at ohio.edu; tech-talk at aps.anl.gov
Subject: Re: SCPI StreamDevice troubleshooting (Keysight 34980A via TCP)

On Fri, 2023-01-20 at 16:16 +0000, Leblanc, Gregory via Tech-talk wrote:
> Hi folks,
> 
> I feel like I'm close to getting EPICS to talk to our Keysight measurement mainframes but can't quite get there.  I don't see any errors when I start the IOC with st.cmd until after iocRun, at which point it reports : 
> 2023/01/20 11:08:24.866492 LAN0 swag5testIDN: No reply within 1000 ms to "*IDN?"
> 2023/01/20 11:08:25.869293 LAN0 swag5testIDNwf: No reply within 1000 ms to "*IDN?"
>  
> How do I get some more debugging messages?  Maybe some capture of what it's sending?  I think it's getting no response because asynReport 10 LAN0 shows:
> 
> LAN0 multiDevice:No canBlock:Yes autoConnect:Yes
>     enabled:Yes connected:Yes numberConnects 1
>     nDevices 0 nQueued 0 blocked:No
>     asynManagerLock:No synchronousLock:No
>     exceptionActive:No exceptionUsers 12 exceptionNotifys 0
>     traceMask:0x1 traceIOMask:0x0 traceInfoMask:0x1
>     interposeInterfaceList
>         asynOctet pinterface 0x7fd4a97e7820 drvPvt 0xd13f40
>     interfaceList
>         asynCommon pinterface 0x7fd4a97e3e30 drvPvt 0xd106d0
>         asynOption pinterface 0x7fd4a97e3e50 drvPvt 0xd106d0
>         asynOctet pinterface 0xd107f0 drvPvt 0xd106d0
>     Port 10.0.0.105:5025: Connected
>                     fd: 4
>     Characters written: 10
>        Characters read: 0
> 
> I also did a basic test using telnet and got a reasonable response.  Below I've added the output from running st.cmd.

You can get debug infos from asyn (asynTraceSomething), but you already got
some: "Characters read: 0" The device did not reply.

You may try to change your terminators.

Dirk

> 
> #!../../bin/linux-x86_64/swag5test
> ######################################################################
> #########
> # Set up environment
> < envPaths
> epicsEnvSet("IOC","iocswag5test")
> epicsEnvSet("TOP","/home/leblanc/EPICS/TEST/swag5")
> epicsEnvSet("EPICS_BASE","/home/leblanc/EPICS/epics-base")
> epicsEnvSet("SUPPORT","/home/leblanc/EPICS/support")
> epicsEnvSet("ASYN","/home/leblanc/EPICS/support/asyn")
> epicsEnvSet("CALC","/home/leblanc/EPICS/support/calc")
> epicsEnvSet("STREAM","/home/leblanc/EPICS/support/StreamDevice")
> epicsEnvSet "STREAM_PROTOCOL_PATH" "/home/leblanc/EPICS/TEST/swag5/db"
> ######################################################################
> ######### # Allow PV name prefixes and serial port name to be set from 
> the environment epicsEnvSet "P" "swag5"
> epicsEnvSet "R" "test"
> epicsEnvSet "HOST" "192.168.1.111"
> epicsEnvSet "PORT" "5025"
> ######################################################################
> #########
> ## Register all support components
> cd "/home/leblanc/EPICS/TEST/swag5"
> dbLoadDatabase "dbd/swag5test.dbd"
> swag5test_registerRecordDeviceDriver pdbbase 
> ######################################################################
> #########
> # Set up ASYN ports
> drvAsynIPPortConfigure("LAN0","10.0.0.105:5025",0,0,0)
> #1st argument is the port's name
> #2nd argument is the "IP address: port num"
> #3rd argument is priority; 0 means medium #4th argument is 
> noAutoConnect; 0 means yes, autoconnect #5th argument is noProcessEOS; 
> 0 means do not close connection on timeout, 1 means close it 
> ######################################################################
> #########
> var streamError 1
> var streamDebug 1
> var streamDebugColored 1
> var streamErrorDeadTime 30
> var streamMsgTimeStamped 1
> streamSetLogfile("logfile.txt")
> ######################################################################
> #########
> ## Load record instances
> dbLoadRecords("db/devswag5.db","P=swag5,R=test,PORT=LAN0,A=0")
> ######################################################################
> #########
> ## Start EPICS
> cd "/home/leblanc/EPICS/TEST/swag5/iocBoot/iocswag5test"
> iocInit
> Starting iocInit
> ######################################################################
> ######
> ## EPICS R7.0.7.1-DEV
> ## Rev. R7.0.7-5-g0f8ea3aa3671cb0433b4 ## Rev. Date Git: 2022-09-25 
> 09:34:13 -0700 
> ######################################################################
> ######
> iocRun: All initialization complete
> epics> 2023/01/20 11:08:24.866492 LAN0 swag5testIDN: No reply within 1000 ms to "*IDN?"
> 2023/01/20 11:08:25.869293 LAN0 swag5testIDNwf: No reply within 1000 ms to "*IDN?"
> 
> --
> Gregory Leblanc
> Accelerator Engineer
> Edwards Accelerator Lab - Ohio University
> 123 University Terrace
> Athens, OH 45701 USA
> leblanc at ohio.edu
> M: (401) 52-OUAL1 or (401) 526-8251
> 

References:
SCPI StreamDevice troubleshooting (Keysight 34980A via TCP) Leblanc, Gregory via Tech-talk
Re: SCPI StreamDevice troubleshooting (Keysight 34980A via TCP) Zimoch Dirk via Tech-talk

Navigate by Date:
Prev: RE: [External] Re: SCPI StreamDevice troubleshooting (Keysight 34980A via TCP) Leblanc, Gregory via Tech-talk
Next: Trusted-CI Webinar on EPICS/RTEMS Cybersecurity Gedare Bloom via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
Navigate by Thread:
Prev: RE: [External] Re: SCPI StreamDevice troubleshooting (Keysight 34980A via TCP) Leblanc, Gregory via Tech-talk
Next: Trusted-CI Webinar on EPICS/RTEMS Cybersecurity Gedare Bloom via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
ANJ, 20 Jan 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·