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

Subject: Re: StreamDevice: Timeout after reading 27 bytes
From: Mark Rivers via Tech-talk <tech-talk at aps.anl.gov>
To: 李姣赛 <ljs at impcas.ac.cn>
Cc: tech-talk <tech-talk at aps.anl.gov>
Date: Mon, 11 May 2020 11:42:51 +0000
Hi JiaosaiLi,


Your device appears to use binary communication, so I assume it does not use terminators like \r or \n to terminate a command?


You need to understand how asyn determines when to return from a read request.


You used the default values for many of the arguments to drvAsynIPPortConfigure.


> drvAsynIPPortConfigure "pulse_el", "172.17.126.22:8080"


This means you have not disabled processEos, so it is using the asynInterposeEos interface.  That means a read will return when one of the following things happens:


- The terminator is found.  You have not set a terminator, so that cannot happen.

- The maximum number of characters to read are received.  You have specified 28.

- The timeout occurs.


It appears that you are asking for 28 bytes but only receiving 27.


The way to debug this is to examine the actual communication from the device.  Replace this line in your startup script:


asynSetTraceMask("pulse_el",-1,0x1)


with these 2:


asynSetTraceIOMask("pulse_el",-1,0x4)

asynSetTraceMask("pulse_el",-1,0x9)

The first line will enable hex output for the communication.
The second line enables ASYN_TRACEIO_DRIVER in addition to ASYN_TRACE_ERROR.

Mark





________________________________
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of 李姣赛 via Tech-talk <tech-talk at aps.anl.gov>
Sent: Monday, May 11, 2020 5:08 AM
To: tech-talk at aps.anl.gov
Subject: StreamDevice: Timeout after reading 27 bytes


Dear all,

I wrote a power control IOC. The function of the power supply is realized, but when I start the IOC, it appears in cycles “Timeout after reading 27 bytes…”,eg:



(base) [root@localhost iocelexample]# ./pulse_el.cmd

#!../../bin/linux-x86_64/elexample

< envPaths

epicsEnvSet("ARCH","linux-x86_64")

epicsEnvSet("IOC","iocelexample")

epicsEnvSet("TOP","/home/EPICS/elCtrl")

epicsEnvSet("EPICS_BASE","/home/EPICS/base-3.14.12")

epicsEnvSet("ASYN","/home/EPICS/app/asyn4-17")

epicsEnvSet("STREAM","/home/EPICS/app/stream")

cd /home/EPICS/elCtrl

dbLoadDatabase "dbd/elexample.dbd"

elexample_registerRecordDeviceDriver pdbbase



#where can protocols be located?

epicsEnvSet "STREAM_PROTOCOL_PATH", "."



#the device name is "pulse"

#输入IP和端口号

#dbLoadTemplate "db/userHost.substitutions"

#dbLoadRecords "db/dbSubExample.db", "user=rootHost"

drvAsynIPPortConfigure "pulse_el", "172.17.126.22:8080"

#drvAsynIPPortConfigure "pulse_el", "192.168.157.1:8080"

#drvAsynIPPortConfigure "pulse_el", "192.168.5.8:30000"

asynSetTraceMask("pulse_el",-1,0x1)

dbLoadRecords "db/pulse_el.db","p=PulseEl"

epicsEnvSet("EPICS_CA_SERVER_PORT","5064")

epicsEnvSet("EPICS_CA_REPEATER_PORT", "5065")

epicsEnvSet("EPICS_CA_AUTO_ADDR_LIST", "YES")

epicsEnvSet("EPICS_CA_ADDR_LIST", "192.168.6.17:5066")

cd /home/EPICS/elCtrl/iocBoot/iocelexample

iocInit

Starting iocInit

############################################################################

## EPICS R3.14.12 $Date: Wed 2010-11-24 14:50:38 -0600$

## EPICS Base built Jan 16 2020

############################################################################

iocRun: All initialization complete



epics> 2020/05/11 07:54:24.626883 pulse_el PulseEl:IMon: Timeout after reading 27 bytes "...<01>*<00>�<01><00><00><00>�@IB3O<9c>@<00><00><ff><ff>"

2020/05/11 07:54:25.628253 pulse_el PulseEl:VMon: Timeout after reading 27 bytes "...<01>*<00>�<01><00><00><00>�@IB3O<9c>@<00><00><ff><ff>"

2020/05/11 07:54:27.629832 pulse_el PulseEl:IMon: Timeout after reading 27 bytes "...<01>*<00>�<01><00><00><00>�@IB3O<9c>@<00><00><ff><ff>"

2020/05/11 07:54:29.633361 pulse_el PulseEl:VMon: Timeout after reading 27 bytes "...<01>*<00>�<01><00><00><00>�@IB3O<9c>@<00><00><ff><ff>"



The command is hexadecimal, when sending a hexadecimal command to the power supply:FF FF 00 00 0E 00 04 01 2A AA 00 00 FF FF

, received the power back reading command:FFFF00001B0004012A00AA01000000DC404942334F9C400000FFFF

My record file:



record (ai, "$(p):IMon")

{

         field (DTYP, "stream")

         field (INP,  "@pulse_el.proto Read_IMon pulse_el")

         field (SCAN, "2 second")

}

record (ai, "$(p):VMon")

{

         field (DTYP, "stream")

         field (INP,  "@pulse_el.proto Read_VMon pulse_el")

         field (SCAN, "2 second")

}

My proto file:

Read_IMon {

         out "\xFF\xFF\x00\x00\x0E\x00\x04\x01\x2A\xAA\x00\x00\xFF\xFF";

         in "%*15r%(/$p:IMon)#R%*8r";

         #in "%*15r%(/$p:IMon)#R%(/$p:VMon)#R%*4r";

         MaxInput = 28;

         ExtralInput = Error;

}

Read_VMon {

         out "\xFF\xFF\x00\x00\x0E\x00\x04\x01\x2A\xAA\x00\x00\xFF\xFF";

         in "%*19r%(/$p:VMon)#R%*4r";

         MaxInput = 28;

         ExtralInput = Error;

}



If you comment out this sentence ”MaxInput=28;” there will be no errors like “timeout after …”, but PV: PulseEl:IMon and PulseEl:VMon value is 0, which are not the correct values (normal values: PulseEl:IMon is 50.3133 and PulseEl:VMon is 4.88467). On the official website, about InTerminal:



“If a device has different terminators for input and output, use this for the input terminator. If no Terminator or InTerminator is defined, the underlying driver may use its own terminator settings. If InTerminator = "", a read timeout is not an error but a valid input termination.”



So in this case, timeout is not an error, but because this error will occur repeatedly, if there are other errors, they may be washed away, resulting in the failure to find the problem. I wonder if there are other ways to avoid this error, and get two valid normal values.



Thanks very much and best wishes!

JiaosaiLi, IMPCAS


References:
StreamDevice: Timeout after reading 27 bytes 李姣赛 via Tech-talk

Navigate by Date:
Prev: Re: StreamDevice: Timeout after reading 27 bytes Ralph Lange via Tech-talk
Next: Re: [EXTERNAL] Phoebus-color.def & font.def are not effictive Kasemir, Kay 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  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: StreamDevice: Timeout after reading 27 bytes Ralph Lange via Tech-talk
Next: Using Jupyter notebooks for controlling experiments Cobb, Tom (DLSLtd,RAL,LSCI) 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  <20202021  2022  2023  2024 
ANJ, 11 May 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·