On 29.06.2016 15:09, Dirk Zimoch wrote:
Hi folks,
After upgrading the motor package from 6-2-2 to 6-9, I got reports that
the encoder homing procedure did not work any more with our MAXv
firmware version 1.34.
After painfully crawling through the numerous code changes, I came to
the conclusion, that the reason must be a bug in the MAXv firmware which
is triggered by no less than 4 different code changes in the motor
driver software.
The MAXv bug is such that the command "EH1111" is quite fragile if
following the "HL" command in the same string. Under certain
circumstances, the MAXv silently changes the setting to "EH0111" (one
can see the change when reading back the setting with "EH?".
In our case, it is the INIT string "LH;HL;HE;AN;EH1111" that is affected
by the bug.
First, if the combination "HL EH1111" is followed by any more characters
such as " ", "\n" or ";" the MAXv executes "HL EH0111" instead. This bug
is triggered at two places in the code.
1. devOmsCom.cc: oms_build_trans() adds a ";" to the INIT string.
2. drvMAXv.cc: send_mess() adds a ";" to any command that does not
already have a ";" at the end.
These changes have been introduced to fix another MAXv bug but must be
reverted or homing is broken. I suggest to terminate those commands with
";" that need it but not generally all.
But two other changes also break the "EH1111" command, though I do not
know the exact mechanism yet (maybe a race condition between motor
software and MAXv firmware, because I cannot reproduce it when entering
the commands manually).
3. drvMAXv.cc: thread_args "update delay" was set to 0. This needs to be
reverted to 0.010.
The next change is not in OmsSrc/ but in MotorSrc/ and thus affects all
motor drivers.
4. motordevCom.cc: In motor_init_record_com() initString handling has
been moved before initEncoder handling. Even though I see the reasoning,
it breaks the "EH1111" in the init string.
Any single one of the 4 changes break the "EH1111" command. While the
first 3 are confined to the MAXv/Oms driver and can be addressed
locally, change 4 is global and I do not know a solution yet.
Can someone maybe confirm this behavior with different MAXv firmware
versions?
I used this (vxWorks) shell function for my tests:
void maxvcmd(int card, char* query)
{
char buffer[100];
send_recv_mess(card, query, NULL, buffer, 1);
printf ("%s\n", buffer);
}
maxvcmd 0,"AX HL EH1111;"
maxvcmd 0,"AX EH?"
Do you get the correct =1111 or the buggy =0111 ?
Also compare with "AX HL EH1111 EH?"
It returns the correct =1111 value, but subsequent "AX EH?" queries
again return =0111.
Dirk
I could solve problem 3 and 4 with a well placed
epicsThreadSleep(0.005). Thus no change in motordevCom.cc is necessary.
A patch file is attached.
Dirk
diff --git a/EPICS-R3-14/motorR6-9/motorApp/OmsSrc/devOmsCom.cc b/EPICS-R3-14/motorR6-9/motorApp/OmsSrc/devOmsCom.cc
index c1e4d3c..7ebb1cd 100644
--- a/EPICS-R3-14/motorR6-9/motorApp/OmsSrc/devOmsCom.cc
+++ b/EPICS-R3-14/motorR6-9/motorApp/OmsSrc/devOmsCom.cc
@@ -286,7 +286,6 @@ RTN_STATUS oms_build_trans(motor_cmnd command, double *parms, struct motorRecord
strcpy(buffer, mr->init);
strcat(motor_call->message, buffer);
- strcat(motor_call->message, ";");
}
else
{
diff --git a/EPICS-R3-14/motorR6-9/motorApp/OmsSrc/drvMAXv.cc b/EPICS-R3-14/motorR6-9/motorApp/OmsSrc/drvMAXv.cc
index e9bb346..3c61ea5 100644
--- a/EPICS-R3-14/motorR6-9/motorApp/OmsSrc/drvMAXv.cc
+++ b/EPICS-R3-14/motorR6-9/motorApp/OmsSrc/drvMAXv.cc
@@ -726,9 +726,6 @@ static RTN_STATUS send_mess(int card, char const *com, char *name)
strcat(cmndbuf, com);
}
- if (cmndbuf[strlen(cmndbuf) - 1] != ';') /* Terminate command with a ';'. */
- strcat(cmndbuf, ";");
-
Debug(9, "send_mess: ready to send message.\n");
putIndex = pmotor->outPutIndex;
for (pcmndbuf = cmndbuf; *pcmndbuf != '\0'; pcmndbuf++)
@@ -762,6 +759,8 @@ static RTN_STATUS send_mess(int card, char const *com, char *name)
return_code = ERROR;
}
+ if (strstr(com, "EH1")) epicsThreadSleep(0.005); /* workaround for MAXv bug with EH1111 */
+
epicsMutexUnlock(MUTEX(card));
return (return_code);
}
- Navigate by Date:
- Prev:
Re: IOCs under procServ as system services under systemd? Jack
- Next:
RE: Motor Module, Deferred Movement, .VAL field set to .RBV after motion Mark Rivers
- 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
- Navigate by Thread:
- Prev:
Re: Motor Module, Deferred Movement, .VAL field set to .RBV after motion Jacob DeFilippis
- Next:
September EPICS meeting at ORNL/SNS Kasemir, Kay
- 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
|