Search the Community

Showing results for tags 'QEI'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News
    • Announcements
    • Suggestions
    • New users say Hi!
  • Spotlight!
    • Sponsor Spotlight
    • Sponsor Giveaways
  • Energia
    • Energia - MSP
    • Energia - TivaC/CC3XXX
    • Energia - C2000
    • Energia Libraries
  • MSP Technical Forums
    • General
    • Compilers and IDEs
    • Development Kits
    • Programmers and Debuggers
    • Code vault
    • Projects
    • Booster Packs
    • Energia
  • Tiva-C, Hercules, CCXXXX ARM Technical Forums
    • General
    • SensorTag
    • Tiva-C, Hercules, CC3XXX Launchpad Booster Packs
    • Code Vault
    • Projects
    • Compilers and IDEs
    • Development Kits and Custom Boards
  • Beagle ARM Cortex A8 Technical Forums
    • General
    • Code Snippets and Scripts
    • Cases, Capes and Plugin Boards
    • Projects
  • General Electronics Forum
    • General Electronics
    • Other Microcontrollers
  • Connect
    • Embedded Systems/Test Equipment Deals
    • Buy, Trade and Sell
    • The 43oh Store
    • Community Projects
    • Fireside Chat
  • C2000 Technical Forums
    • General
    • Development Kits
    • Code Vault
    • Projects
    • BoosterPacks

Calendars

  • Community Calendar

Found 2 results

  1. I got the QEI module working on the new Tiva Launchpad and thought the code might be helpful for others. QEI0 can use either PortD or Port F, since F is used by the LEDs I used PortD - the only gotcha is that PD7 is one of the NMI locked pins by default so I burned lots of time wondering why things weren't quite working. Anyway here is working code: //***************************************************************************** // // qei.c - Example to demonstrate QEI on Tiva Launchpad //This setup uses QEI0 P6/PD7, in my testing an arcade trackball is connected. //You can also use QEI1 PC5/PC6 in which case you don't need the PD7 HWREG calls (note: I didn't test this) // // //***************************************************************************** #include <stdint.h> #include <stdbool.h> #include "inc/hw_gpio.h" #include "inc/hw_types.h" #include "inc/hw_ints.h" #include "inc/hw_memmap.h" #include "driverlib/sysctl.h" #include "driverlib/pin_map.h" #include "driverlib/gpio.h" #include "driverlib/qei.h" volatile int qeiPosition; int main(void) { // Set the clocking to run directly from the crystal. SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); // Enable QEI Peripherals SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); SysCtlPeripheralEnable(SYSCTL_PERIPH_QEI0); //Unlock GPIOD7 - Like PF0 its used for NMI - Without this step it doesn't work HWREG(GPIO_PORTD_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY; //In Tiva include this is the same as "_DD" in older versions (0x4C4F434B) HWREG(GPIO_PORTD_BASE + GPIO_O_CR) |= 0x80; HWREG(GPIO_PORTD_BASE + GPIO_O_LOCK) = 0; //Set Pins to be PHA0 and PHB0 GPIOPinConfigure(GPIO_PD6_PHA0); GPIOPinConfigure(GPIO_PD7_PHB0); //Set GPIO pins for QEI. PhA0 -> PD6, PhB0 ->PD7. I believe this sets the pull up and makes them inputs GPIOPinTypeQEI(GPIO_PORTD_BASE, GPIO_PIN_6 | GPIO_PIN_7); //DISable peripheral and int before configuration QEIDisable(QEI0_BASE); QEIIntDisable(QEI0_BASE,QEI_INTERROR | QEI_INTDIR | QEI_INTTIMER | QEI_INTINDEX); // Configure quadrature encoder, use an arbitrary top limit of 1000 QEIConfigure(QEI0_BASE, (QEI_CONFIG_CAPTURE_A_B | QEI_CONFIG_NO_RESET | QEI_CONFIG_QUADRATURE | QEI_CONFIG_NO_SWAP), 1000); // Enable the quadrature encoder. QEIEnable(QEI0_BASE); //Set position to a middle value so we can see if things are working QEIPositionSet(QEI0_BASE, 500); //Add qeiPosition as a watch expression to see the value inc/dec while (1) //This is the main loop of the program { qeiPosition = QEIPositionGet(QEI0_BASE); SysCtlDelay (1000); } }
  2. The Tiva Launchpads have a hardware Quadratic Encoder Interface peripheral. The documents on CC3200 doesn't seem to depict it. I had the wrong impression that CC3200 has the same kind of peripherals as Tiva in addition to the WiFI feature set. Can any one confirm if indeed hardware QEI peripheral is not available in CC3200?