QPOSCTL:PCSPW
8
Pulse
stretcher
QFLG:PCM
QPOSCNT
32
QPOSCMP
QFLG:PCR
32
QPOSCTL:PCSHDW
QPOSCTL:PCLOAD
0
1
QPOSCTL:PCPOL
PCSOUT
PCEVENT
Basic Operation
1971
SPNU563A – March 2018
Copyright © 2018, Texas Instruments Incorporated
Enhanced Quadrature Encoder Pulse (eQEP) Module
34.2.2.3.3 Position Counter Initialization
The position counter can be initialized using following events:
•
Index event
•
Strobe event
•
Software initialization
Index Event Initialization (IEI)—
The QEPI index input can be used to trigger the initialization of the
position counter at the rising or falling edge of the index input. If the QEPCTL[IEI] bits are 10, then
the position counter (QPOSCNT) is initialized with a value in the QPOSINIT register on the rising
edge of index input. Conversely, if the QEPCTL[IEI] bits are 11, initialization will be on the falling
edge of the index input.
Strobe Event Initialization (SEI)—
If the QEPCTL[SEI] bits are 10, then the position counter is initialized
with a value in the QPOSINIT register on the rising edge of strobe input.
If QEPCTL[SEL] bits are 11, then the position counter is initialized with a value in the QPOSINIT
register on the rising edge of strobe input for forward direction and on the falling edge of strobe
input for reverse direction.
Software Initialization (SWI)—
The position counter can be initialized in software by writing a 1 to the
QEPCTL[SWI] bit. This bit is not automatically cleared. While the bit is still set, if a 1 is written to it
again, the position counter will be re-initialized.
34.2.2.3.4 eQEP Position-compare Unit
The eQEP peripheral includes a position-compare unit that is used to generate a sync output and/or
interrupt on a position-compare match.
shows a diagram. The position-compare
(QPOSCMP) register is shadowed and shadow mode can be enabled or disabled using the
QPOSCTL[PSSHDW] bit. If the shadow mode is not enabled, the CPU writes directly to the active position
compare register.
Figure 34-12. eQEP Position-compare Unit
In shadow mode, you can configure the position-compare unit (QPOSCTL[PCLOAD]) to load the shadow
register value into the active register on the following events and to generate the position-compare ready
(QFLG[PCR]) interrupt after loading.
•
Load on compare match
•
Load on position-counter zero event
The position-compare match (QFLG[PCM]) is set when the position-counter value (QPOSCNT) matches
with the active position-compare register (QPOSCMP) and the position-compare sync output of the
programmable pulse width is generated on compare match to trigger an external device.