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  2020  2021  <20222023  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  2020  2021  <20222023  2024 
<== 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:

A command processing time (interpretation time) of about 20 to 40 milliseconds has to be considered between two individual commands sent to the PS 10-32. The control unit signals received can be, for example, retrieved character by character every millisecond, until the defined end-of-string identifier is received.

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
Gesendet: Freitag, 15. Juli 2022 11:15
An: 'Mark Rivers' <rivers at cars.uchicago.edu>
Cc: tech-talk <tech-talk at aps.anl.gov>
Betreff: 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.

 

  1. 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

Von: Mark Rivers <rivers at cars.uchicago.edu>
Gesendet: Donnerstag, 14. Juli 2022 19:22
An: Sintschuk, Michael <
michael.sintschuk at bam.de>
Cc: tech-talk <
tech-talk at aps.anl.gov>
Betreff: RE: motor driver only works with asyn traces turned on

 

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

 

From: Tech-talk <tech-talk-bounces at aps.anl.gov> On Behalf Of Sintschuk, Michael via Tech-talk
Sent: Thursday, July 14, 2022 9:56 AM
To:
tech-talk at aps.anl.gov
Subject: motor driver only works with asyn traces turned on

 

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


References:
motor driver only works with asyn traces turned on Sintschuk, Michael via Tech-talk
RE: motor driver only works with asyn traces turned on Mark Rivers via Tech-talk
AW: motor driver only works with asyn traces turned on Sintschuk, Michael via Tech-talk
AW: motor driver only works with asyn traces turned on Sintschuk, Michael via Tech-talk

Navigate by Date:
Prev: AW: motor driver only works with asyn traces turned on Sintschuk, Michael via Tech-talk
Next: time out error in streamdevice Silver 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  2020  2021  <20222023  2024 
Navigate by Thread:
Prev: AW: motor driver only works with asyn traces turned on Sintschuk, Michael via Tech-talk
Next: time out error in streamdevice Silver 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  2020  2021  <20222023  2024 
ANJ, 14 Sep 2022 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·