Part Number: TMS320F28377D
Other Parts Discussed in Thread: C2000WARE
Hi Champ,
I am asking for my customer due to I am not familiar with eQEP module.
The customer refered to example eqep_ex1 EQEP_init() with a little modification.
Since there are no strobe and index signals, and the speed is not so slow that needed the capture function in the application.
Simply need two orthogonal encoder signals A and B, and then use it at any time by EQEP_getPosition(), reading the count value only.
However, the values obtained are all 0.
Would you please have the look with the initail eQEP setting for the code, seen if there is any missing part ?
void Peripheral_init_EQEP2(void)
{
//eQEP I/O, motor encoder signal input
GPIO_setPinConfig(GPIO_11_EQEP2_A);
GPIO_setQualificationMode(11, GPIO_QUAL_3SAMPLE);
GPIO_setPinConfig(GPIO_33_EQEP2_B);
GPIO_setQualificationMode(33, GPIO_QUAL_3SAMPLE);
// Set the strobe input source of the eQEP module.
EQEP_setStrobeSource(EQEP2_BASE,EQEP_STROBE_FROM_GPIO);
// Sets the polarity of the eQEP module's input signals.
//QEPA, QEPB, Index, Strobe
EQEP_setInputPolarity(EQEP2_BASE,false,false,false,false);
// Configures eQEP module's quadrature decoder unit.
// select encoder signal type
EQEP_setDecoderConfig(EQEP2_BASE, (EQEP_CONFIG_QUADRATURE | EQEP_CONFIG_2X_RESOLUTION | EQEP_CONFIG_NO_SWAP));
// Set the emulation mode of the eQEP module.
EQEP_setEmulationMode(EQEP2_BASE,EQEP_EMULATIONMODE_RUNFREE);
// Configures eQEP module position counter unit.
// set when to reset counter value
EQEP_setPositionCounterConfig(EQEP2_BASE,EQEP_POSITION_RESET_MAX_POS,65535U);
// Sets the current encoder position.
EQEP_setPosition(EQEP2_BASE,0U);
// Enables the eQEP module unit timer.
//EQEP_enableUnitTimer(EQEP2_BASE,1000000U);
// Disables the eQEP module watchdog timer.
EQEP_disableWatchdog(EQEP2_BASE);
// Configures the quadrature modes in which the position count can be latched.
EQEP_setLatchMode(EQEP2_BASE,(EQEP_LATCH_CNT_READ_BY_CPU|EQEP_LATCH_RISING_STROBE));
// Set the quadrature mode adapter (QMA) module mode.
EQEP_setQMAModuleMode(EQEP2_BASE,EQEP_QMA_MODE_BYPASS);
// Configures the mode in which the position counter is initialized.
EQEP_setPositionInitMode(EQEP2_BASE,(EQEP_INIT_DO_NOTHING));
// Sets the software initialization of the encoder position counter.
EQEP_setSWPositionInit(EQEP2_BASE,true);
// Sets the init value for the encoder position counter.
EQEP_setInitialPosition(EQEP2_BASE,0U);
// Enables the eQEP module.
EQEP_enableModule(EQEP2_BASE);
// Configures eQEP module edge-capture unit.
EQEP_setCaptureConfig(EQEP2_BASE,EQEP_CAPTURE_CLK_DIV_64,EQEP_UNIT_POS_EVNT_DIV_32);
// Enables the eQEP module edge-capture unit.
//EQEP_enableCapture(EQEP2_BASE);
}
Thanks for any help.
Best regard,
Johnny