Tool/software: Code Composer Studio
Hi, i am working with QEI Module in Tiva 1294 and when i am using the Direction count mode the counter give me scattered data which have no mean, i checked the register maps and every thing is right in control register, can any one check the configuration i set and help me.- Here is pin configuring:
// step 1. CONFIGURE GPIO PINS TO WORK AS ENCODER PIN
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
GPIOPinConfigure(GPIO_PL1_PHA0);
GPIOPinConfigure(GPIO_PL2_PHB0);
GPIOPinConfigure(GPIO_PL3_IDX0);
// step 2. Enable ENCODER PINS
SysCtlPeripheralEnable(SYSCTL_PERIPH_QEI0);
GPIOPinTypeQEI(GPIO_PORTL_BASE,GPIO_PIN_1); // channel A
GPIOPinTypeQEI(GPIO_PORTL_BASE,GPIO_PIN_2); // channel B
GPIOPinTypeQEI(GPIO_PORTL_BASE,GPIO_PIN_3); // channel I
// step 3. Enable ENCODER MODULE
QEIEnable(QEI0);
// step 4. Enable INDEX INTERRUPT
QEIIntEnable(QEI0,QEI_INTINDEX);
// step 5. pad configuration
GPIOPadConfigSet(GPIO_PORTL_BASE, GPIO_PIN_1 | GPIO_PIN_2, GPIO_STRENGTH_8MA_SC, GPIO_PIN_TYPE_STD_WPU);
- Here is module configuring to work in Direction count mode:
QEIConfigure(QEI0,(QEI_CONFIG_CAPTURE_A | QEI_CONFIG_NO_RESET | QEI_CONFIG_CLOCK_DIR | QEI_CONFIG_NO_SWAP),2500);
- Here is the clock setting i use:
SysCtlClockFreqSet(SYSCTL_OSC_INT,16000000);