Hi,
For our system, the motor may initially 'jump' (and potentially trigger a 'first index' event) before we actually want to get the first index. That is, we want the first index after a 'blanking period'.
We are using this code to attempt to re-enable the triggering:
EQEP_clearStatus(motor_QEP_BASE, EQEP_STS_1ST_IDX_FLAG);
But it seems to just clear the status bit but not actually re-arm the system to latch in the next actual index pulse.
Is there some way to get it to completely clear the First Index status so that it re-sets the bit on the next index pulse?
Here's the rest of the initialization code (created from the .syscfg):
void EQEP_init(){
//motor_QEP initialization
EQEP_SourceSelect source_motor_QEP =
{
EQEP_SOURCE_DEVICE_PIN, // eQEPA source
EQEP_SOURCE_DEVICE_PIN, // eQEPB source
EQEP_SOURCE_DEVICE_PIN, // eQEP Index source
};
// Selects the source for eQEPA/B/I signals
EQEP_selectSource(motor_QEP_BASE, source_motor_QEP);
// Set the strobe input source of the eQEP module.
EQEP_setStrobeSource(motor_QEP_BASE,EQEP_STROBE_FROM_GPIO);
// Sets the polarity of the eQEP module's input signals.
EQEP_setInputPolarity(motor_QEP_BASE,false,false,true,false);
// Configures eQEP module's quadrature decoder unit.
EQEP_setDecoderConfig(motor_QEP_BASE, (EQEP_CONFIG_QUADRATURE | EQEP_CONFIG_2X_RESOLUTION | EQEP_CONFIG_NO_SWAP | EQEP_CONFIG_IGATE_DISABLE));
// Set the emulation mode of the eQEP module.
EQEP_setEmulationMode(motor_QEP_BASE,EQEP_EMULATIONMODE_RUNFREE);
// Configures eQEP module position counter unit.
EQEP_setPositionCounterConfig(motor_QEP_BASE,EQEP_POSITION_RESET_1ST_IDX,65535U);
// Sets the current encoder position.
EQEP_setPosition(motor_QEP_BASE,0U);
// Disables the eQEP module unit timer.
EQEP_disableUnitTimer(motor_QEP_BASE);
// Disables the eQEP module watchdog timer.
EQEP_disableWatchdog(motor_QEP_BASE);
// Configures the quadrature modes in which the position count can be latched.
EQEP_setLatchMode(motor_QEP_BASE,(EQEP_LATCH_CNT_READ_BY_CPU|EQEP_LATCH_RISING_STROBE|EQEP_LATCH_SW_INDEX_MARKER));
// Set the quadrature mode adapter (QMA) module mode.
EQEP_setQMAModuleMode(motor_QEP_BASE,EQEP_QMA_MODE_BYPASS);
// Disable Direction Change During Index
EQEP_disableDirectionChangeDuringIndex(motor_QEP_BASE);
// Configures the mode in which the position counter is initialized.
EQEP_setPositionInitMode(motor_QEP_BASE,(EQEP_INIT_FALLING_INDEX));
// Sets the software initialization of the encoder position counter.
EQEP_setSWPositionInit(motor_QEP_BASE,true);
// Sets the init value for the encoder position counter.
EQEP_setInitialPosition(motor_QEP_BASE,0U);
// Enables the eQEP module.
EQEP_enableModule(motor_QEP_BASE);
}
Thanks,
-Mike
