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  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Changing the Timeout for drvAsynSerialPort?
From: Franklin Fuller <[email protected]>
To: Mark Rivers <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Thu, 11 Dec 2014 10:16:46 -0800
Mark,

I added those environment variables, trace outputs, fixed a missing parenthesis in the original st.cmd, and then recompiled before running.  I also disabled the firewall on this mac laptop, just in case that was causing problems.  Here now is the output:

#!../../bin/darwin-x86/ps365controlTest
##########################################
# Setup Environment
< envPaths
epicsEnvSet("ARCH","darwin-x86")
epicsEnvSet("IOC","iocps365controlTest")
epicsEnvSet("TOP","/Users/fdfuller/src/EPICS/myapps/ps365control")
epicsEnvSet("ASYN","/Users/fdfuller/src/EPICS/modules/asyn")
epicsEnvSet("STREAM","/Users/fdfuller/src/EPICS/modules/streams")
epicsEnvSet("EPICS_BASE","/Users/fdfuller/src/EPICS/base")
epicsEnvSet "STREAM_PROTOCOL_PATH" "/Users/fdfuller/src/EPICS/myapps/ps365control/db"
##########################################
# Allow PV prefixes and serial port name to be set from the environment
epicsEnvSet "P" "ps365control"
epicsEnvSet "R" "Test"
epicsEnvSet "TTY" "/dev/cu.usbserial-FTWDR32T"
##########################################
# Register all support components
cd /Users/fdfuller/src/EPICS/myapps/ps365control
dbLoadDatabase(dbd/ps365controlTest.dbd)
ps365controlTest_registerRecordDeviceDriver(pdbbase)
##########################################
# Set up ASYN ports
drvAsynSerialPortConfigure("L0","/dev/cu.usbserial-FTWDR32T",0,0,0) #sets up a port L0 at $TTY (see above)
#now we fill in the details of the port connection
#9600/8/N/1 is the most typical serial port configuration
asynSetOption("L0",0,"baud","9600")
asynSetOption("L0",0,"bits","8")
asynSetOption("L0",0,"parity","none")
asynSetOption("L0",0,"stop","1")
asynSetTraceIOMask("L0",0,2)
asynSetTraceMask("L0",0,255)
##########################################
## Load record instances
dbLoadRecords("db/devps365control.db","P=ps365control,R=Test,PORT=L0,A=0")
##########################################
# Start EPICS
cd /Users/fdfuller/src/EPICS/myapps/ps365control/iocBoot/iocps365controlTest
iocInit
Starting iocInit
############################################################################
## EPICS R3.14.12.4 $Date: Mon 2013-12-16 15:51:45 -0600$
## EPICS Base built Sep 21 2014
############################################################################
2014/12/11 09:46:01.492 L0 addr -1 queueRequest priority 0 not lockHolder
2014/12/11 09:46:01.493 L0 schedule queueRequest timeout
2014/12/11 09:46:01.493 asynManager::portThread port=L0 callback
2014/12/11 09:46:01.493 L0 addr -1 queueRequest priority 0 not lockHolder
2014/12/11 09:46:01.493 L0 schedule queueRequest timeout
2014/12/11 09:46:01.493 L0 addr -1 queueRequest priority 0 not lockHolder
2014/12/11 09:46:01.493 L0 schedule queueRequest timeout
2014/12/11 09:46:01.493 asynManager::portThread port=L0 callback
2014/12/11 09:46:01.493 /dev/cu.usbserial-FTWDR32T read.
2014/12/11 09:46:01.493 /dev/cu.usbserial-FTWDR32T read 0, return 1
2014/12/11 09:46:01.493 /dev/cu.usbserial-FTWDR32T write.
2014/12/11 09:46:01.493 /dev/cu.usbserial-FTWDR32T write 5
*IDN?
cas warning: Configured TCP port was unavailable.
cas warning: Using dynamically assigned TCP port 49730,
cas warning: but now two or more servers share the same UDP port.
cas warning: Depending on your IP kernel this server may not be
cas warning: reachable with UDP unicast (a host's IP in EPICS_CA_ADDR_LIST)
2014/12/11 09:46:01.494 wrote 5 to /dev/cu.usbserial-FTWDR32T, return asynSuccess
2014/12/11 09:46:01.494 L0 wrote
*IDN?
2014/12/11 09:46:01.494 L0 addr -1 queueRequest priority 0 from lockHolder
2014/12/11 09:46:01.494 L0 schedule queueRequest timeout
2014/12/11 09:46:01.494 asynManager::portThread port=L0 callback
2014/12/11 09:46:01.494 /dev/cu.usbserial-FTWDR32T read.
iocRun: All initialization complete
epics> 2014/12/11 09:46:02.489 /dev/cu.usbserial-FTWDR32T timeout handler.
2014/12/11 09:46:02.594 /dev/cu.usbserial-FTWDR32T read 0, return 1
2014/12/11 09:46:02.594534 L0 ps365controlTestIDN: No reply from device within 1000 ms
2014/12/11 09:46:02.595 asynManager::portThread port=L0 callback
2014/12/11 09:46:02.595 L0 addr -1 queueRequest priority 0 not lockHolder
2014/12/11 09:46:02.595 L0 schedule queueRequest timeout
2014/12/11 09:46:02.595 asynManager::portThread port=L0 callback
2014/12/11 09:46:02.595 /dev/cu.usbserial-FTWDR32T read.
2014/12/11 09:46:02.595 /dev/cu.usbserial-FTWDR32T read 0, return 1
2014/12/11 09:46:02.595 /dev/cu.usbserial-FTWDR32T write.
2014/12/11 09:46:02.595 /dev/cu.usbserial-FTWDR32T write 5
*IDN?
2014/12/11 09:46:02.595 wrote 5 to /dev/cu.usbserial-FTWDR32T, return asynSuccess
2014/12/11 09:46:02.595 L0 wrote
*IDN?
2014/12/11 09:46:02.595 L0 addr -1 queueRequest priority 0 from lockHolder
2014/12/11 09:46:02.595 L0 schedule queueRequest timeout
2014/12/11 09:46:02.595 asynManager::portThread port=L0 callback
2014/12/11 09:46:02.595 /dev/cu.usbserial-FTWDR32T read.
2014/12/11 09:46:03.591 /dev/cu.usbserial-FTWDR32T timeout handler.
2014/12/11 09:46:03.695 /dev/cu.usbserial-FTWDR32T read 0, return 1
2014/12/11 09:46:03.695444 L0 ps365controlTestIDNwf: No reply from device within 1000 ms


So the upshot is that it looks like it's doing something.  The downside is: I don't know why it isn't receiving a response.  As I said, if you manually send values to /dev/cu.usbserial-FTWDR32T, such as the *IDN? command that it's trying, you get a response.  I tested other commands and full control is possible.

Still reading this streamDevice documentation to figure out where I can add some communication timeout time.  Not sure that's the issue anymore, now that I see this trace output.

~Franklin





On Thu, Dec 11, 2014 at 3:37 AM, Mark Rivers <[email protected]> wrote:
--------
WARNING: At least one of the links in the message below goes to an IP address (e.g. 10.1.1.1), which could be malicious. To learn how to protect yourself, please go here: https://commons.lbl.gov/x/_591B
--------

Hi Franklin,

You should set asynTrace debugging right after creating the port.  Then you can see what is actually being sent and received:

drvAsynSerialPortConfigure("L0","$(TTY)",0,0,0) #sets up a port L0 at $TTY (see above)
asynSetTraceIOMask("L0", 0, 2)
asynSetTraceMask("L0", 0, 255)

Please do that and then send the complete output when the IOC boots.

You also have a problem here:


> Further, if I query the ioc with "caget -S ps365controlTestIDNwf", I get this:

> ps365controlTestIDNwf \003

> CA.Client.Exception...............................................
>    Warning: "Identical process variable names on multiple servers"
>    Context: "Channel: "ps365controlTestIDNwf", Connecting to: 198.128.196.226:5064<http://198.128.196.226:5064>, Ignored: franklins-mbp.dhcp.lbl.gov:5064<http://franklins-mbp.dhcp.lbl.gov:5064>"
>    Source File: ../cac.cpp line 1298
>    Current Time: Wed Dec 10 2014 17:44:31.920218000

I suspect this is happening because you are running both the IOC and caget client on the same computer, and it has multiple network cards.

You should define the following environment variables:

EPICS_CA_AUTO_ADDR_LIST=NO
EPICS_CA_ADDR_LIST=xxx.xxx.xxx.xxx

where xxx.xxx.xxx.xxx is the broadcast address of the network that you might want to use for external EPICS Channel Access.  For example:

165.65.160.255

Mark


________________________________
From: [email protected] [[email protected]] on behalf of Franklin Fuller [[email protected]]
Sent: Wednesday, December 10, 2014 7:47 PM
To: [email protected]
Subject: Changing the Timeout for drvAsynSerialPort?

Hi all,

Question is: How can I changed the timeout for drvAsynSerialPort?
Context follows (maybe I'm asking the wrong question):

I've been working through a tutorial* with few modifications.  So far no problems until I try to initiate communication with a Stanford Research Systems PS365 HV supply.  When I run ./st.cmd, everything says it initializes, but then I get a message saying that the ioc did not receive a response within 1 second.  The exact error(s) are:


2014/12/10 17:31:18.937952 L0 ps365controlTestIDN: No reply from device within 1000 ms

2014/12/10 17:31:20.039439 L0 ps365controlTestIDNwf: No reply from device within 1000 ms


Further, if I query the ioc with "caget -S ps365controlTestIDNwf", I get this:

ps365controlTestIDNwf \003

CA.Client.Exception...............................................
    Warning: "Identical process variable names on multiple servers"
    Context: "Channel: "ps365controlTestIDNwf", Connecting to: 198.128.196.226:5064<http://198.128.196.226:5064>, Ignored: franklins-mbp.dhcp.lbl.gov:5064<http://franklins-mbp.dhcp.lbl.gov:5064>"
    Source File: ../cac.cpp line 1298
    Current Time: Wed Dec 10 2014 17:44:31.920218000

I can "manually" communicate with the device using a simple screen command.  I use the same port address with 9660/8/N/1 standard settings. It seems to take a second, maybe 2, to open the connection.  So my thought was that maybe I just need to have the asyn driver increase its timeout time to avoid this error.

I can't see a way to change the timeout, however.

* The tutorial in question: http://www.aps.anl.gov/epics/modules/soft/asyn/R4-21/HowToDoSerial/HowToDoSerial_StreamDevice.html

My st.cmd is given below:

#!../../bin/darwin-x86/ps365controlTest


##########################################
# Setup Environment
< envPaths
epicsEnvSet "STREAM_PROTOCOL_PATH" "$(TOP)/db"

##########################################
# Allow PV prefixes and serial port name to be set from the environment
epicsEnvSet "P" "$(P=ps365control)"
epicsEnvSet "R" "$(R=Test)"
epicsEnvSet "TTY" "$(TTY=/dev/ttyUSB)"

##########################################
# Register all support components
cd ${TOP}
dbLoadDatabase(dbd/ps365controlTest.dbd)
ps365controlTest_registerRecordDeviceDriver(pdbbase)

##########################################
# Set up ASYN ports
drvAsynSerialPortConfigure("L0","$(TTY)",0,0,0) #sets up a port L0 at $TTY (see above)
#now we fill in the details of the port connection
#9600/8/N/1 is the most typical serial port configuration
asynSetOption("L0",-1,"baud","9600"
asynSetOption("L0",-1,"bits","8")
asynSetOption("L0",-1,"parity","none")
asynSetOption("L0",-1,"stop","1")
asynSetOption("L0",-1,"clocal","Y")
asynSetOption("L0",-1,"crtscts","N")


##########################################
## Load record instances
dbLoadRecords("db/devps365control.db","P=$(P),R=$(R),PORT=L0,A=0")

##########################################
# Start EPICS
cd ${TOP}/iocBoot/${IOC}


Replies:
Re: Changing the Timeout for drvAsynSerialPort? Eric Norum
RE: Changing the Timeout for drvAsynSerialPort? Mark Rivers
References:
Changing the Timeout for drvAsynSerialPort? Franklin Fuller
RE: Changing the Timeout for drvAsynSerialPort? Mark Rivers

Navigate by Date:
Prev: Build system EXPAND not working with INC J. Lewis Muir
Next: Re: Changing the Timeout for drvAsynSerialPort? Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Changing the Timeout for drvAsynSerialPort? Mark Rivers
Next: Re: Changing the Timeout for drvAsynSerialPort? Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 17 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·