Tool/software: Starterware
Hi, I tried to use eQEP0 for incremental encoder.
So I activated eQEP0, the count of QEP is fine.
But, when the index signal occurs, there's something I coudn't understand.
I set the IEI bit in QEPCTL, because of initialization at index. It works well, the count goes zero when index occurs.
But the FIMF bit in QEPSTS, it's not set at index.
Sometimes FIMF set at index, but I couldn't find what did I wrong..
Here's my QEP initializing,
............................................................
HWREG(SOC_CONTROL_MODULE_REG + CTRL_PWMSS) &= ~PWMSS0_TBCLKEN_ENABLE_BIT;
HWREG(PWMSS0_REG + PWM_CLKCONFIG) = ((1<<eQEPCLK_EN));
while((1<<eQEPCLK_EN) != ((1<<eQEPCLK_EN) & HWREG(PWMSS0_REG + PWM_CLKSTATUS)));
// pinmux setting - QEP_A, QEP_B, QEP_INDEX, QEP_STROBE
HW_WR_REG32( (SOC_CONTROL_MODULE_REG + CTRL_CONF_MCASP0_AHCLKX), (eQEP_PINMUX));
HW_WR_REG32( (SOC_CONTROL_MODULE_REG + CTRL_CONF_MCASP0_AXR1), (eQEP_PINMUX));
HW_WR_REG32( (SOC_CONTROL_MODULE_REG + CTRL_CONF_MCASP0_ACLKR), (eQEP_PINMUX));
HW_WR_REG32( (SOC_CONTROL_MODULE_REG + CTRL_CONF_MCASP0_FSR), (eQEP_PINMUX));
HWREG(eQEP0_REG + eQEP_QDECCTL) = 0x00;
HWREGH(eQEP0_REG + eQEP_QEPCTL) |= (1<<eQEP_QEPCTL_IEI)|(1<<eQEP_QEPCTL_SWI);
HWREG(eQEP0_REG + eQEP_QPOSCNT) = 0;
HWREG(eQEP0_REG + eQEP_QPOSINIT) = eQEP_OFFSET;
HWREG(eQEP0_REG + eQEP_QPOSMAX) = pos_max + eQEP_OFFSET;
HWREGH(eQEP0_REG + eQEP_QEPCTL) |= (1<<eQEP_QEPCTL_PHEN);
............................................................................
Everything that doesn't show here is set initial value(except PRCM.)
Thank you.