Hi Michael,
Does additionally adding an epicsThreadSleep() to writeController() make any difference?
Regards,
Freddie
From: Tech-talk <tech-talk-bounces at aps.anl.gov>
On Behalf Of Sintschuk, Michael via Tech-talk
Sent: 15 July 2022 10:15
To: Mark Rivers <rivers at cars.uchicago.edu>
Cc: tech-talk <tech-talk at aps.anl.gov>
Subject: AW: motor driver only works with asyn traces turned on
Hi Mark,
1)
I added
asynSetTraceFile
to put the output to a file. The driver doesn’t work with that either and I don’t see any indication where the communication fails. I once got the output
2022/07/15 10:33:50.096 asynOctetSyncIO wrote:
|
|
M)_able.VAL",16777215,0,"$(P)$(M)_able.VAL")
|
|
#! Record("$(P)$(M)_vCh",440,699,0,
but I don’t know what the means and it is not reproducible.
2)
I‘ve also overridden the
writeReadController method and went up to epicsThreadSleep(0.5). I can see how the communication
is slowed down but it doesn’t help.
I noticed that it is enough to comment in only the line
asynSetTraceMask("serial1",0,0x3)
and everything works fine. Except for the annoying IOC-console output…
Michael
SICHERHEITSHINWEIS: Diese E-Mail wurde von außerhalb an die BAM gesendet. Bitte klicken Sie nicht
auf Links oder öffnen Anhänge, bevor Sie nicht den Absender verifiziert haben und sicher sind, dass der Inhalt vertrauenswürdig ist.
This message was sent from outside of BAM. Please do not click links or open attachments unless you recognize the sender and know the content is trustworthy.
|
Hi Michael,
Ø
BUT, it only works when asyn traces are turned on at IOC startup:
That indicates the problem is a timing issue. When you enable asynTrace you slow down the execution of the program a little bit, which eliminates the timing
problem.
My first guess would be that your controller is not able to accept commands quite as fast as they are sent when you disable asynTrace.
Here are the things I would suggest.
Add this line to you startup script after line 20:
asynSetTraceFile("serial1",0,"PS10.txt")
That will put the asynTrace output into the file PS10.txt. If you are lucky writing the file will be faster than sending the trace
output to the console, and the driver will not work. That might let you see where the communication is messing up.
Another suggestion would be to override the asynMotorController::writeReadController method in your PS10Controller class, but add
an epicsThreadSleep() after calling pasynOctetSyncIO->writeRead. That might fix the problem. Here is an example:
/** Writes a string to the controller and reads a response.
* \param[in] output Pointer to the output string.
* \param[out] input Pointer to the input string location.
* \param[in] maxChars Size of the input buffer.
* \param[out] nread Number of characters read.
* \param[out] timeout Timeout before returning an error.*/
asynStatus PS10Controller::writeReadController(const char *output, char *input,
size_t maxChars, size_t *nread, double timeout)
{
size_t nwrite;
asynStatus status;
int eomReason;
// const char *functionName="writeReadController";
status = pasynOctetSyncIO->writeRead(pasynUserController_, output,
strlen(output), input, maxChars, timeout,
&nwrite, nread, &eomReason);
epicsThreadSleep(0.05);
return status;
}
Mark
Hi EPICS-community,
I’m trying to write a model 3 motor driver for ps 10 controller from OWIS. So far I made some good progress and I can move/stop the connected rotation stage (stepper motor, no encoder), also setting the velocity and running
a homing sequence is possible.
BUT, it only works when asyn traces are turned on at IOC startup:
asynSetTraceIOMask("serial1",0,0x1)
asynSetTraceMask("serial1",0,0x3)
If I comment them out, the move command doesn’t work after IOC start. The Retry counts count until 11 and that’s it. The only thing that works is the homing sequence.
Did someone experienced such a behavior before? Do I have some obvious mistake somewhere in the driver-code?
I uploaded the code to git: https://github.com/MichaS-git/motorOwis
Regards
Michael