Hi Euan,
I just did some tests with testAsynPortDriverApp, the test application
for asynPortDriver that comes with asyn. It seems to be working as
expected for me.
I changed testAsynPortDriverApp to disable autoconnect in the
constructor:
corvette:asyn/testAsynPortDriverApp/src>svn diff
Index: testAsynPortDriver.cpp
===================================================================
---
testAsynPortDriver.cpp (revision 1768)
+++ testAsynPortDriver.cpp
(working copy)
@@ -238,7 +238,7 @@
asynInt32Mask | asynFloat64Mask | asynFloat64ArrayMask | asynDrvUserMask, /*
Interface mask */
asynInt32Mask | asynFloat64Mask | asynFloat64ArrayMask, /* Interrupt
mask */
0, /* asynFlags. This driver does not block and it is not multi-device,
so flag is 0 */
-
1, /* Autoconnect */
+
0, /* Autoconnect */
0, /* Default priority */
0) /* Default stack size*/
I also changed the iocBoot/ioctestAsynPortDriver/st.cmd to load an asyn
record on that port.
dbLoadRecords("../../db/asynRecord.db","P=testAPD:,R=asyn1,PORT=testAPD,ADDR=0,OMAX=80,IMAX=80")
When I start the IOC I get a number of error messages like the
following:
**********************
2011/06/20 15:50:47.810 testAPD:scope1:VoltsPerDiv
devAsynFloat64:process error queuing request port testAPD not connected
2011/06/20 15:50:47.811 testAPD:scope1:Run_RBV devAsynInt32
queueRequest port testAPD not connected
2011/06/20 15:50:47.811 testAPD:scope1:Run devAsynInt32::processCommon,
error queuing request port testAPD not connected
**********************
These errors are expected, because these records have PINI=YES, but the
port is not connected.
When I look at the medm screen for the asyn record it shows .AUCT=“noAutoConnect”
(in yellow) and .CNCT readback widget=”Disconnected” (in red).
If I toggle the scope1:Run PV between Stop and Run I get the following
errors on the IOC:
**********************
2011/06/20 15:54:26.108 testAPD:scope1:Run devAsynInt32::processCommon,
error queuing request port testAPD not connected
2011/06/20 15:54:26.481 testAPD:scope1:Run devAsynInt32::processCommon,
error queuing request port testAPD not connected
**********************
Again, those are expected, because the asyn port is disconnected.
Now, I use the medm screen for the asyn record to change the CNCT field
from “Disconnect” to “Connect”. The readback widget
changes from “Disconnected” in red to “Connected” in
green.
When I then toggle the scope1:Run PV the simulated scope display begins
to update normally.
Thus, I don’t see the problems you are describing. I am
running the SVN version of asyn (soon to be R4-17), while you are running 4-16.
But there have not been any changes in connection management since 4-16.
In your original message you said:
> If I create the port driver class with the autoconnect flag set to
true I can use the asynRecord CNCT field to connect or disconnect a device from
the port.
Actually, the CNCT field is normally used when the autoconnect flag is
set to false; it is not needed if the autoconnect flag is set to true.
In your second message you said:
> If the asynPortDriver class is instantiated with autoConnect
disabled then the PCNCT field
> of the asynRecord shows 'Connect' which I think means the port is
connected.
No, that is not correct, and perhaps this is the source of the
confusion. Here you refer to the PCNCT field, while in your original
message you were referring to the CNCT field. They do two very different
things.
The PCNCT field controls the connection of the pasynUser structure to
the asyn port. This invokes a call to
pasynManager->connectDevice(). The CNCT field controls the connection of
the device to the asyn port. This invokes a call to
pasynCommon->connect(). asynManager will normally not let you queue a
request unless the device is connected to the port. The exception is that
you can queue connection requests, which is what the .CNCT field in the asyn
record does.
This is what I see when the port is disconnected:
epics> asynReport 4
testAPD multiDevice:No canBlock:No autoConnect:No
enabled:Yes connected:No numberConnects 1
nDevices 0 nQueued 0 blocked:No
asynManagerLock:No synchronousLock:No
exceptionActive:No exceptionUsers 1 exceptionNotifys
0
interfaceList
When I then use medm to set .CNCT=Connect I get the following:
epics> asynReport 4
testAPD multiDevice:No canBlock:No autoConnect:No
enabled:Yes connected:Yes numberConnects 2
nDevices 0 nQueued 0 blocked:No
asynManagerLock:No synchronousLock:No
exceptionActive:No exceptionUsers 1 exceptionNotifys
0
interfaceList
Let me know if you still have questions or problems.
Cheers,
Mark
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Thursday, June 09, 2011 6:28 PM
To: Mark Rivers
Cc: [email protected]
Subject: Re: asyn connection management with asynPortDriver
Hi Mark,
A bit more information about why I am confused. If the asynPortDriver
class is instantiated with autoConnect disabled then the PCNCT field
of the asynRecord shows 'Connect' which I think means the port is
connected. However asynReport in the IOC says the port isn't connected.
There doesn't seem to be a mechanism for connecting the port itself
except via autoConnect, although I think that the ::connect method called with
addr=-1 is what the documentation implies.
e.g.
epics> asynReport 4
drx1 multiDevice:Yes canBlock:Yes autoConnect:No
enabled:Yes connected:No numberConnects 0
epics> dbpr as:t:as01:drx:s1:asynRecord 4
ACKS: NO_ALARM ACKT:
YES ACMD:
None ADDR:
0
AINP:
AOUT: AQR:
0
ASG:
ASP: (nil) AUCT:
noAutoConnect BAUD: Unknown BINP:
0
BKPT:
00 BOUT:
0 CNCT:
Disconnect DBIT: Unknown
DESC:
DISA: 0
DISP: 0 DISS:
NO_ALARM
DISV:
1 DPVT:
0xaa61c40
DRVINFO:
DSET: 0xb7740988
DTYP:
asynRecordDevice
ENBL: Enable EOMR:
None
ERRS: 0xaa61f20 EVNT:
0
F64INP: 0 F64IV:
1
F64OUT: 0
FCTL: Unknown FLNK:CONSTANT
0 GPIBIV:
0
I32INP: 0
I32IV: 1
I32OUT: 0
IEOS:
IFACE: asynOctet IFMT:
ASCII IMAX:
80 IPTR:
0xaa61e70
LCNT:
0 LSET:
0xb6c75078 MCTL: Unknown
MLIS: 00 00 00 00 00 00 00 00 00 00 00
00
MLOK: 28 1c a6 0a
NAME: as:t:as01:drx:s1:asynRecord
NAWT: 0
NORD: 0
NOWT:
80 NRRD: 0 NSEV:
NO_ALARM NSTA:
NO_ALARM
OCTETIV: 1
OEOS:
OFMT: ASCII OMAX:
80
OPTIONIV: 0 OPTR:
0xaa61e18 PACT:
0
PCNCT: Connect
PHAS:
0 PINI:
NO PORT:
drx1 PPN:
(nil)
PPNR: (nil) PRIO:
LOW PROC:
0 PRTY:
Unknown
PUTF:
0 RDES:
0x9dc5570 REASON:
0 RPRO:
0
RSET: 0xb7740940 SBIT:
Unknown SCAN: Passive SDIS:CONSTANT
SEVR: NO_ALARM
SOCK:
SPR:
0
SPVT: (nil)
STAT: NO_ALARM TB0:
On TB1:
Off TB2:
Off
TB3:
Off TB4:
Off TFIL:
Unknown TIB0:
Off
TIB1: Off
TIB2: Off TIME:
<undefined>
TINP:
TIOM:
0 TMOD:
Write/Read TMOT:
1 TMSK:
1
TPRO: 0 TSE:
0
TSEL:CONSTANT TSIZ:
80
UCMD: None UDF:
0
UI32INP: 0 UI32IV:
1
UI32MASK:
4294967295
UI32OUT: 0
VAL:
cheers,
Euan.
On 10/06/2011, at 2:16 AM, Mark Rivers
wrote:
> Hi Euan,
>
> I am away from the lab, but I will look into this and get you an
answer when I return on June 20. It seems like the asyn record should do
what you want, but maybe something is wrong.
>
> Meanwhile perhaps Eric Norum can help :-)
>
> Mark
>
>
> ________________________________
>
> From: [email protected] on behalf of
[email protected]
> Sent: Wed 6/8/2011 8:25 PM
> To: [email protected]
> Subject: asyn connection management with asynPortDriver
>
>
>
> Hi,
>
> I would like to use the connection management features of asyn
with a driver based on the asynPortDriver class. If I create the port driver
class with the autoconnect flag set to true I can use the asynRecord CNCT field
to connect or disconnect a device from the port. If autoconnect is set to
false, then when the IOC starts up, the following messages appear:
>
> iocRun: All initialization complete
> epics> 2011/06/09 10:51:51.625 as:t:as01:drx:s1:asynRecord:
queueRequest failed for special.
> 2011/06/09 10:51:51.625 as:t:as01:drx:s1:asynRecord: port drx1 not
connected
>
> If I try and use the CNCT field if the asyn record to connect a
device then a similar message is produced:
> epics> 2011/06/09 11:00:29.564 as:t:as01:drx:s1:asynRecord:
exception 2
> 2011/06/09 11:00:39.172 as:t:as01:drx:s1:asynRecord: queueRequest
failed for special.
> 2011/06/09 11:00:39.172 as:t:as01:drx:s1:asynRecord: port drx1 not
connected
>
> As I understand the setup, the asynPortDriver constructor will
connect the port and the class methods connect() and disconnect() will
connect devices to the port. I have derived these methods in my class so
that I can manage connections but without autoconnect to make the first
connection these methods are not called. So even though the port is connected,
without autoconnect I can't connect any devices to the port. I guess there is
some setup I haven't performed. I would like advice as to how to manage the
connections. I am using asyn 4.16 with EPICS 3.14.12.
>
> cheers,
>
> Euan.
>
>
>