Other Parts Discussed in Thread: EK-TM4C123GXL
TM4C123 and TM4C129 QEI:
A bit of datasheet clarification is needed with respect to the Quadrature Encoder Interface (QEI):
Is it possible to generate the Index Interrupt when NOT using Index pulse to reset the Position Counter?
Said another way, will INTINDEX bit of QEIRIS (and subsequently QEIISC) be set to 1 when: INTINDEX bit of QEIINTEN is 1, and RESMODE of QEICTL is 0?
Everything in the datasheet indicates that the answer to both questions above should be "Yes" however our tests seem to contradict that.
We are currently testing on a EK-TM4C123GXL which uses a TM4C123GH6PM. Our wiring, software, and vector table setup appear correct unless we've missed something.
Specifically:
We connected the shaft of a 1000-line encoder to a drill motor, allowing us to turn the shaft and vary speed. We set maximum position QEIMAXPOS to 0xffffffff. Our program uses the EK's virtual COM port to display information in a terminal emulator on our PC. It displays the total number of QEI interrupts; separately it shows the number of QEI interrupts triggered due to each condition: Errors, Index pulses, and Direction changes. Our program also displays the current position (QEIPOS) and velocity (QEISPEED). This information is monitored and displayed for both QEIs of the TM4C123GH6PM, so we can connect the encoder to QEI0 (PD6, PD7, PF4) or to QEI1 (PC5, PC6, PC4) and observe behavior. The display is updated 10 times per second showing the information "live." We "unlocked" PD7 (NMI) for use as ChB0.
Our tests show the following:
The position counter (QEIPOS) counts successfully in both directions and rolls over from 0x00000000 to 0xffffffff and back as expected.
The velocity register (QEISPEED) shows a velocity that increases and decreases with corresponding changes in drill motor speed and goes to 0 when stopped.
QEISTAT shows the proper DIRECTION and ERROR.
QEI interrupts are triggering for Errors and Direction Changes, but NOT for Index.
We verified our encoder is producing the Index pulse and it reaches the TM4C. We verified this by two methods: (1) oscilloscope, (2) by changing QEI setup to reset position counter on index -- we set RESMODE of QEICTL to 1. With RESMODE set to 1 (and no other changes to our program), our test shows that Index interrupts are being triggered. However, this resets our position counter on each turn, which is not acceptable in our application. With RESMODE set back to 0 (and again no other changes), Index interrupts are no longer triggered.
Either we missed something in our tests, or we misunderstood the datasheet, or the datasheet needs a bit of clarification on this point.
For example, the block diagram from TM4C123GH6PM datasheet June 12, 2014 page 1306 shows that the IDX signal goes to the Position Integrator block as well as the Interrupt Control block, and various text supports the idea that it should be possible to get our Index interrupt without having hardware reset the position counter.
Any help is greatly appreciated. Thanks.