mp49 / parker6k

EPICS support for the Parker 6K controller
1 stars 2 forks source link

ATHM field doesn't work correctly #5

Closed mark0n closed 10 years ago

mark0n commented 10 years ago

The ATHM field is always 0 even if the home switch is closed and the HOMELS bit of MSTA is 1. This is different from the documentation of the Motor Record which says: "ATHM: The state of the hardware's 'home' switch. If 1, the motor has hit the switch."

mark0n commented 10 years ago

This might be related to the fact that I'm using the following configuration:

See motorRecord.cc:

    /* Get state of motor's or encoder's home switch. */
    if (msta.Bits.EA_PRESENT && pmr->ueip)
        pmr->athm = (msta.Bits.EA_HOME) ? 1 : 0;
    else
        pmr->athm = (msta.Bits.RA_HOME) ? 1 : 0;

Note: EA_HOME corresponds to the HOME bit of MSTA while RA_HOME corresponds to the HOMELS bit of MSTA.

Maybe TLIM polling always update the RA_HOME bit? We might want it to update the RA_HOME bit instead when an encoder is present? I'll look into this tomorrow...

mp49 commented 10 years ago

TLIM polling has to be on, because that's when I set the AtHome bit in MSTA. EA_PRESENT should be on when ENCCNT=1 is set on the controller, although I only read that at startup.

Does it work correctly if UEIP is off?

I'm not sure I've ever set the encoder home bit in MSTA. Any idea what that actually means? On a reference mark?

I suppose we could set both bits on when the home switch is active.

mark0n commented 10 years ago

I just gave it a try: Having TLIM polling write to both EA_HOME and RA_HOME fixes this issue (see PR).