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 2020 2021 <2022> 2023 2024 2025 | 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 2020 2021 <2022> 2023 2024 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: motor driver only works with asyn traces turned on |
From: | Mark Rivers via Tech-talk <tech-talk at aps.anl.gov> |
To: | "freddie.akeroyd at stfc.ac.uk" <freddie.akeroyd at stfc.ac.uk>, "Sintschuk, Michael" <michael.sintschuk at bam.de> |
Cc: | tech-talk <tech-talk at aps.anl.gov> |
Date: | Fri, 15 Jul 2022 13:06:18 +0000 |
Hi Michael,
> Yes, that works. It is actually enough to override only the writeController() method with epicsThreadSleep(0.05).
That makes sense. There are several places in your code where you call writeController() back to back. But the OWIS PS-10 manual (https://www.owis.eu/fileadmin/user_upload/PDF-Files/User-manual_PS10_EN.pdf)
says this on page 41:
So they do say that you must wait 20-40 ms between commands.
Mark
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Sintschuk, Michael via Tech-talk <tech-talk at aps.anl.gov>
Sent: Friday, July 15, 2022 8:00 AM To: freddie.akeroyd at stfc.ac.uk <freddie.akeroyd at stfc.ac.uk> Cc: tech-talk <tech-talk at aps.anl.gov> Subject: AW: motor driver only works with asyn traces turned on Hi Freddie,
>Does additionally adding an epicsThreadSleep() to writeController() make any difference? Yes, that works. It is actually enough to override only the writeController() method with epicsThreadSleep(0.05).
Thanks for the help! Michael
Von: Sintschuk, Michael
Hi Mark,
#! Record("$(P)$(M)_vCh",440,699,0,
but I don’t know what the means and it is not reproducible.
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
Von: Mark Rivers <rivers at cars.uchicago.edu>
Hi Michael,
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
From: Tech-talk <tech-talk-bounces at aps.anl.gov>
On Behalf Of Sintschuk, Michael via Tech-talk
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 |