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  <20212022  2023  2024  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  <20212022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Handling Ethernet-to-Serial Connection when vendor SDK expects tty device
From: Maren Purves via Tech-talk <tech-talk at aps.anl.gov>
To: Mark Rivers <rivers at cars.uchicago.edu>
Cc: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Thu, 8 Apr 2021 11:39:54 -1000
Thanks Mark,

and yes, I think the concepts are similar.

Maren

On Thu, Apr 8, 2021 at 11:33 AM Mark Rivers <rivers at cars.uchicago.edu> wrote:

Hi Maren,

 

Ø  there isn't really one piece of documentation that explains the steps needed

 

The asyn driver is documented here:

https://epics-modules.github.io/master/asyn/R4-41/asynDriver.html#drvAsynIPPort

 

You use that with a command like this in your startup script:

 

drvAsynIPPortConfigure("serial1", "164.54.160.163:4001", 0, 0, 0)

 

Ø  I'm used to having input fields like

Ø  field(INP,"@ls.M REAL <WS><2,%fK,I>")

Ø  and that's what I'd like to get to.

 

Here is an example of how this is done using asyn and stream.  This is an ai record to read the temperature of a laser. 

record(ai,"$(P)$(R)LaserTemp") {

    field(DTYP, "stream")

    field(INP, "@LQExcel.proto LaserTemp $(PORT)")

    field(PREC, "3")

}

 

The INP link says to use the protocol file “LQExcel.proto”, and the protocol LaserTemp in that file.  It uses the asyn port $(PORT), which would be set to “serial1” for the above command.

 

This is the LaserTemp protocol in that file:

 

LaserTemp {

   out "LASTEMP?";

   in "%fC";

}

 

The syntax will certainly be different from tnetDev but hopefully the concepts are pretty similar.

 

Mark

 

 

 

From: Maren Purves <m.purves at eaobservatory.org>
Sent: Thursday, April 8, 2021 11:41 AM
To: Mark Rivers <rivers at cars.uchicago.edu>
Cc: Wlodek, Jakub <jwlodek at bnl.gov>; tech-talk at aps.anl.gov
Subject: Re: Handling Ethernet-to-Serial Connection when vendor SDK expects tty device

 

Thank you Mark - this also explains why, when I tried talking to the Lakeshore from a softIoc (3.15.6) before it couldn't possibly have worked - I was missing entirely too many of the details.

But, as you say about tnetDev not having documentation, there isn't really one piece of documentation that explains the steps needed (I did in the meantime find the document about protocol files). 

I'm used to having input fields like

    field(INP,"@ls.M REAL <WS><2,%fK,I>")

and that's what I'd like to get to.

 

Thanks again,

Maren

 

On Thu, Apr 8, 2021 at 2:10 AM Mark Rivers <rivers at cars.uchicago.edu> wrote:

Hi Maren,

 

> but we have always treated devices at the ends of serial lines as devices on serial lines, no matter what they go through, at least that is my understanding.

 

Your original message said you were using tnetDev.  That is the code that makes the serial ports on the terminal server available to EPICS.  I could not find actual documentation on tnetDev but I did find this in a tech-talk message from 2002 (https://epics.anl.gov/tech-talk/2002/msg00826.php)

The tnetDevCreate routine creates pseudo-terminal devices for the ports on
the terminal server.  This routine must run before iocInit, i.e. before any
of the simulation mode or disabling tools of EPICS is available. When
tnetDevCreate runs the terminal server port must exist and be configured
correctly or really bad things happen.  My startup code looks like:
 
   # Start serial drivers for terminal server
   hostAdd "harpts", "192.168.3.41"
   tnetDevCreate "/pty/0.", "harpts", 3003
   tnetDevCreate "/pty/1.", "harpts", 3004

 

Note that tnetDevCreate is creating a new object in EPICS called "/pty/0.” that is connected to terminal server whose IP name is “harpts” on port 3003.  That is very similar to what is done in the current asyn software with this command:

 

drvAsynIPPortConfigure("serial1", "164.54.160.163:4001", 0, 0, 0)

 

That creates an asyn port driver called “serial1” that is connected to port 4001 on the terminal server whose IP address is 164.54.160.163.

 

Note that the asyn command to connect to a real serial port is similar:

 

drvAsynSerialPortConfigure("serial1", "/dev/ttyS0", 0, 0, 0)

 

Both of these commands create asyn drivers called “serial1” can be used in the same way with EPICS device support, such as stream.

 

> what I will attempt first is to talk to and read out a Lakeshore device connected to a console switch

> but I don't see Jakub's case as all that different.

 

Jakub’s case is quite different.  He wants the ability to execute a Linux command like this:

 

cp LakeshoreCommands.txt /dev/ttyr00

 

He wants the port on the terminal server to appear just like a real Linux serial port. 

 

I don’t believe you could execute a command like that with your current terminal server and the Lakeshore device.  You need the tnetDev software to make it available in EPICS.

 

Mark

 

 


From: Maren Purves <m.purves at eaobservatory.org>
Sent: Wednesday, April 7, 2021 7:13 PM
To: Mark Rivers
Cc: Wlodek, Jakub; tech-talk at aps.anl.gov
Subject: Re: Handling Ethernet-to-Serial Connection when vendor SDK expects tty device

 

Hi Mark,

 

but we have always treated devices at the ends of serial lines as devices on serial lines, no matter what they go through, at least that is my understanding.

I'm planning on getting back to upgrading EPICS here at some point - and what I will attempt first is to talk to and read out a Lakeshore device connected to a console switch because that's what we have in the lab.

Just like in high energy physics our computers at the telescope are not right where our equipment is. This is even more the case for Linux boxes than for VME crates.

Maybe I'm misunderstanding something here, but I don't see Jakub's case as all that different.

 

Thanks,

Maren

 

On Wed, Apr 7, 2021 at 2:00 AM Mark Rivers <rivers at cars.uchicago.edu> wrote:

Hi Maren,


> I hope EPICS didn't lose that capability with the newer versions?

No, EPICS has not lost that capability.  With EPICS and asyn one uses the drvAsynIPPort driver, and not the drvAsynSerialPort driver, because EPICS is talking to the terminal server, not directly to the serial port. In fact EPICS now supports the RFC2217 protocol, which allows EPICS to control the serial port parameters like baud rate, parity, etc.  Without that one needs to configure those parameters outside of EPICS, typically with a Web or command line interface to the terminal server.

The issue that Jakub was facing is that he needed a way to create a Linux device that appears to be a standard tty driver, i.e. it emulates a local serial port and hides the fact that it is going through a Moxa.  He needed that to be able to use a vendor library, not for EPICS.

Mark


________________________________
From: Maren Purves <m.purves at eaobservatory.org>
Sent: Wednesday, April 7, 2021 2:56 AM
To: Mark Rivers
Cc: Wlodek, Jakub; tech-talk at aps.anl.gov
Subject: Re: Handling Ethernet-to-Serial Connection when vendor SDK expects tty device

Hi Mark & Jakub,

while I have never worked with a Moxa we have connected serial line devices through terminal servers or later console switches from the beginning of using them with EPICS, starting with one that I first tried to connect directly to a serial line but found that one of the parameters needed a setting that I could only set on a terminal server.
We're still running EPICS 3.13.8 and PPC IOCs with tnetDev and drvAscii and that has always worked.
I hope EPICS didn't lose that capability with the newer versions?
When I tried to upgrade to 3.15.6 and got as far as building a softIoc the first device I tried to talk to (but never succeeded) was a Lakeshore on a console switch (never got that to work, got side-tracked and haven't gotten back to it yet). I hope you're not saying that isn't going to work?

Thanks,
Maren

On Tue, Apr 6, 2021 at 3:51 AM Mark Rivers via Tech-talk <tech-talk at aps.anl.gov<mailto:tech-talk at aps.anl.gov>> wrote:
Hi Jakub,

> I know there is external software I could use to create a virtual serial device from an ethernet connection, but is there a way to do this from within EPICS?


I don't know of a way to do that inside EPICS.


Moxa provides a "Real TTY" Linux driver that allows creating ports like /dev/ttyr00 to the Moxa device.  These provide all of the serial port controls (baud, parity, etc.).


https://www.moxa.com.cn/getmedia/6fbafa79-1113-4953-a6cc-bef28dae1180/moxa-real-tty-driver-for-nport-tech-note-v1.0.pdf


Mark


________________________________
From: Tech-talk <tech-talk-bounces at aps.anl.gov<mailto:tech-talk-bounces at aps.anl.gov>> on behalf of Wlodek, Jakub via Tech-talk <tech-talk at aps.anl.gov<mailto:tech-talk at aps.anl.gov>>
Sent: Tuesday, April 6, 2021 8:34 AM
To: tech-talk at aps.anl.gov<mailto:tech-talk at aps.anl.gov>
Subject: Handling Ethernet-to-Serial Connection when vendor SDK expects tty device

Good morning EPICS community,

I had the following question regarding one of the devices that I am currently working on supporting. Essentially, I am using an asynPortDriver
based driver integrated with the device vendor SDK. The vendor SDK has a connection function that expects a string representing either identification
for the USB device to communicate over the USB bus (this I have working fine), or a TTY serial device for communicating over serial (ex. /dev/ttyS0, COM1 on Windows).
When connected directly to the serial port of the target machine, the device connects and this works OK.

However, ideally, we would prefer to use a MOXA ethernet-to-serial adapter to talk to the device, and I am not sure what the best approach for this is. Traditionally,
for say a StreamDevice IOC I would use drvAsynIPPortConfigure(), and then configure the MOXA to communicate via serial on the other end, but given that
the device needs a serial device to connect, I wasn't sure how to handle that. I know there is external software I could use to create a virtual serial device from
an ethernet connection, but is there a way to do this from within EPICS?

Thanks,
Jakub


References:
Handling Ethernet-to-Serial Connection when vendor SDK expects tty device Wlodek, Jakub via Tech-talk
Re: Handling Ethernet-to-Serial Connection when vendor SDK expects tty device Mark Rivers via Tech-talk
Re: Handling Ethernet-to-Serial Connection when vendor SDK expects tty device Maren Purves via Tech-talk
Re: Handling Ethernet-to-Serial Connection when vendor SDK expects tty device Mark Rivers via Tech-talk
Re: Handling Ethernet-to-Serial Connection when vendor SDK expects tty device Maren Purves via Tech-talk
Re: Handling Ethernet-to-Serial Connection when vendor SDK expects tty device Mark Rivers via Tech-talk
Re: Handling Ethernet-to-Serial Connection when vendor SDK expects tty device Maren Purves via Tech-talk
RE: Handling Ethernet-to-Serial Connection when vendor SDK expects tty device Mark Rivers via Tech-talk

Navigate by Date:
Prev: RE: Handling Ethernet-to-Serial Connection when vendor SDK expects tty device Mark Rivers via Tech-talk
Next: Re: line scan camera with ADAravis driver skips frames Katie Matusik 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  <20212022  2023  2024 
Navigate by Thread:
Prev: RE: Handling Ethernet-to-Serial Connection when vendor SDK expects tty device Mark Rivers via Tech-talk
Next: VisualDCT doesnt load .dbd or .db files Marco A. Barra Montevechi Filho 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  <20212022  2023  2024 
ANJ, 08 Apr 2021 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·