Tool/software: Code Composer Studio
Hi,
I want a technical support for me with an encoder module problem as in direction count mode it does not work, only work in quadrature mode and i ask before in discussion board and cannot solve the problem til now this my mail if you can help me solve this problem.
- mail address
alimagdi377@gmail.com
- 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);