Mark,
>
I have looked at devAsynFloat64 and it never sets the record .time field for ao records, only for ai records. So you have found a bug, and TSE=-2 does not currently work for output records. I will fix that. It is
almost certainly also a problem with asynInt32, asynIUnt32Digital and asynOctet device support as well.
Oh well! then, it was worth reporting my issue to the community.
>
Meanwhile you could put an ai RBV record with SCAN=I/O Intr which should get your hardware's timestamp for that same parameter
Yes, I indeed provide I/O Intr Input records for those output records that are not using the ‘info(asyn:READBACK, "1")’ and
the timestamp is correct there.
though I did use this format
‘pasynUser->timestamp = time’ in the poller thread. Gonna test with setTimeStamp and see.
Thanks again for your assistance. I’ll wait for when you would update Asyn.
Regards,
Yann
From: Mark Rivers <rivers at cars.uchicago.edu>
Sent: Saturday, May 11, 2024 8:06 PM
To: Yann Mandza <yann.mandza at ess.eu>; Torsten Bögershausen <tboegi at edom.se>; tech-talk at aps.anl.gov
Subject: Re: Output record with TSE=-2 and info(asyn:READBACK, "1") returns <undefined> time.
I have looked at devAsynFloat64 and it never sets the record .time field for ao records, only for ai records. So you have found a bug, and TSE=-2 does not currently work for output records. I
will fix that. It is almost certainly also a problem with asynInt32, asynIUnt32Digital and asynOctet device support as well.
Meanwhile you could put an ai RBV record with SCAN=I/O Intr which should get your hardware's timestamp for that same parameter.
Mark,
I meant that a added some debug print lines to see the content of that time variable in
devAsynFloat64 as:
static const char *functionName="processCallbackOutput";
printf( "\033[0;33m%s : ( %s ) : time: '%u'\n\033[0m", epicsThreadGetNameSelf( ), __FUNCTION__, pPvt->pasynUser->timestamp.nsec );
and inside my driver writeFloat64 as below:
epicsTimeGetCurrent( &timeStamp );
setTimeStamp( &timeStamp );
printf( "\033[0;33m%s : ( %s ) : time: '%u'\n\033[0m", epicsThreadGetNameSelf( ), __FUNCTION__, timeStamp.nsec );
just mentioned it so that the logs I shared would make sense. Not consequential though.
I also tried this method.
asynRegisterTimeStampSource("ETHHAL ", "myTimeStampSource") after registering a timestamp method and adding these lines
to my write method.
updateTimeStamp (&timeStamp);
setTimeStamp( &timeStamp );
here are some logs.
ETHHAL : ( processCallbackOutput ) : time: '0'
ETHHAL : ( myTimeStampSource ) : time: '813505109'
ETHHAL : ( writeFloat64 ) : time: '813505109'
2024/05/11 19:41:12.814 ETHHAL:writeFloat64: function=0, value=4.000000
2024/05/11 19:41:12.814 DRVASYN:MOD0-VoltageRamp devAsynFloat64::processCallbackOutput process value 4.000000
Still undefined time.
Regards,
Yann
·
// Added a print line in devAsynFloat64 processCallbackOutput and writeFloat64 for some info on the time variable.
Please show those lines of code, since I don't know what you mean by the "time variable".
Hey Mark,
>
What do you observe with the code you showed in the last message?
Here are some logs,
caput DRVASYN:MOD0-VoltageRamp 4
Old : DRVASYN:MOD0-VoltageRamp 0
New : DRVASYN:MOD0-VoltageRamp 4
// Added a print line in devAsynFloat64 processCallbackOutput and writeFloat64 for some info on the time variable.
ETHHAL : ( processCallbackOutput ) : time: '0'
ETHHAL : ( writeFloat64 ) : time: '169054678'
2024/05/11 19:15:20.169 ETHHAL:writeFloat64: function=0, value=4.000000
2024/05/11 19:15:20.169 DRVASYN:MOD0-VoltageRamp devAsynFloat64::processCallbackOutput process value 4.000000
caget -a DRVASYN:MOD0-VoltageRamp
DRVASYN:MOD0-VoltageRamp <undefined> 4
Regards,
Yann
What do you observe with the code you showed in the last message?
Hey Torsten, Mark pitched in, but I forgot to add you in my response.
> Do you call setTimeStamp() ?
Here the implementation for my write method. Testing for normal async with caput first.
asynStatus drvAsynIsegHalService::writeFloat64( asynUser *pasynUser, epicsFloat64 value )
static const char *functionName = "writeFloat64";
const char *propertyName;
epicsTimeStamp timeStamp;
char sVal[WRITE_BUF_LEN];
int function = pasynUser->reason;
asynStatus status = asynSuccess;
epicsSnprintf( sVal, WRITE_BUF_LEN, "%f", value );
/*call driver methods and return asynError if write operation fails*/
epicsTimeGetCurrent( &timeStamp );
// tried this without success.
setTimeStamp(&timeStamp);
// update value of parameter
status = ( asynStatus ) setDoubleParam( function, value );
status = ( asynStatus ) callParamCallbacks( );
epicsSnprintf( pasynUser->errorMessage, pasynUser->errorMessageSize,
"%s:%s: status=%d, function=%d, value=%f",
session_, functionName, status, function, value );
asynPrint( pasynUser, ASYN_TRACEIO_DEVICE,
"%s:%s: function=%d, value=%f\n",
session_, functionName, function, value );
On 2024-05-11 13:39, Yann Mandza via Tech-talk wrote:
> I am working onan Asyn Port driver using with asynR4-42 on a Linux
> machine. Am trying to add timing support for Output record using
> and info(asyn:READBACK, "1"). When I caget an output PV with TSE=-2
> after caput to it the time obtained is <undefined> though the value is
> well written to the device.
> A camonitor on a PV with TSE=-2 and info(asyn:READBACK, "1") show an
> <undefined> time too though the read value is correct. I would like to
> associate the device timestamp to the record for output readback, and
> the current time return by epicsTimeGetCurrent to the record after a
> caput. In my poller thread this is how I set the time stamp:
> epicsUInt32 seconds = 0;
> epicsUInt32 microsecs = 0;
> sscanf( timeStampLastChanged/*hardware time string*, "%u.%u",
> &seconds, µsecs ) != 2 )
> time.secPastEpoch = seconds - POSIX_TIME_AT_EPICS_EPOCH;
> time.nsec = microsecs * 100000;
> pasynUser->timestamp = time;
Do you call setTimeStamp() ?