v(k)
+
X
t(k)
*
t(k
*
1)
+
X
D
T
Enhanced Quadrature Encoder Pulse (eQEP) Module
15.4.2.5 eQEP Edge Capture Unit
The eQEP peripheral includes an integrated edge capture unit to measure the elapsed time between the
unit position events as shown in
. This feature is typically used for low speed measurement
using the following equation:
(3)
where,
•
X - Unit position is defined by integer multiple of quadrature edges (see
•
Δ
T - Elapsed time between unit position events
•
v(k) - Velocity at time instant "k"
The eQEP capture timer (QCTMR) runs from prescaled SYSCLKOUT and the prescaler is programmed
by the QCAPCTL[CCPS] bits. The capture timer (QCTMR) value is latched into the capture period register
(QCPRD) on every unit position event and then the capture timer is reset, a flag is set in
QEPSTS[UPEVNT] to indicate that new value is latched into the QCPRD register. Software can check this
status flag before reading the period register for low speed measurement and clear the flag by writing 1.
Time measurement (
Δ
T) between unit position events will be correct if the following conditions are met:
•
No more than 65,535 counts have occurred between unit position events.
•
No direction change between unit position events.
The capture unit sets the eQEP overflow error flag (QEPSTS[COEF]) in the event of capture timer
overflow between unit position events. If a direction change occurs between the unit position events, then
an error flag is set in the status register (QEPSTS[CDEF]).
Capture Timer (QCTMR) and Capture period register (QCPRD) can be configured to latch on following
events.
•
CPU read of QPOSCNT register
•
Unit time-out event
If the QEPCTL[QCLM] bit is cleared, then the capture timer and capture period values are latched into the
QCTMRLAT and QCPRDLAT registers, respectively, when the CPU reads the position counter
(QPOSCNT).
If the QEPCTL[QCLM] bit is set, then the position counter, capture timer, and capture period values are
latched into the QPOSLAT, QCTMRLAT and QCPRDLAT registers, respectively, on unit time out.
shows the capture unit operation along with the position counter.
NOTE:
The QCAPCTL register should not be modified dynamically (such as switching CAPCLK
prescaling mode from QCLK/4 to QCLK/8). The capture unit must be disabled before
changing the prescaler.
1666
Pulse-Width Modulation Subsystem (PWMSS)
SPRUH73H – October 2011 – Revised April 2013
Copyright © 2011–2013, Texas Instruments Incorporated