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