Texas TMS320x2833x User manual

TMS320x2833x, 2823x Enhanced QuadratureEncoder Pulse (eQEP) Module
Reference Guide
Literature Number: SPRUG05AAugust 2008 – Revised December 2008

Contents
Preface ........................................................................................................................................ 61 Introduction ......................................................................................................................... 82 Description ........................................................................................................................ 102.1 EQEP Inputs ............................................................................................................. 112.2 Functional Description .................................................................................................. 112.3 eQEP Memory Map ..................................................................................................... 123 Quadrature Decoder Unit (QDU) ........................................................................................... 143.1 Position Counter Input Modes ......................................................................................... 143.2 eQEP Input Polarity Selection ......................................................................................... 173.3 Position-Compare Sync Output ........................................................................................ 174 Position Counter and Control Unit (PCCU) ............................................................................ 174.1 Position Counter Operating Modes.................................................................................... 174.2 Position Counter Latch .................................................................................................. 204.3 Position Counter Initialization .......................................................................................... 224.4 eQEP Position-compare Unit .......................................................................................... 225 eQEP Edge Capture Unit ..................................................................................................... 246 eQEP Watchdog ................................................................................................................. 277 Unit Timer Base ................................................................................................................. 278 eQEP Interrupt Structure ..................................................................................................... 289 eQEP Registers .................................................................................................................. 28
SPRUG05A – August 2008 – Revised December 2008 Table of Contents 3Submit Documentation Feedback

www.ti.com
List of Figures
1 Optical Encoder Disk ........................................................................................................ 82 QEP Encoder Output Signal for Forward/Reverse Movement ......................................................... 93 Index Pulse Example ........................................................................................................ 94 Functional Block Diagram of the eQEP Peripheral .................................................................... 125 Functional Block Diagram of Decoder Unit ............................................................................. 146 Quadrature Decoder State Machine ..................................................................................... 157 Quadrature-clock and Direction Decoding .............................................................................. 168 Position Counter Reset by Index Pulse for 1000 Line Encoder (QPOSMAX = 3999 or 0xF9F) ................. 189 Position Counter Underflow/Overflow (QPOSMAX = 4) .............................................................. 1910 Software Index Marker for 1000-line Encoder (QEPCTL[IEL] = 1) .................................................. 2111 Strobe Event Latch (QEPCTL[SEL] = 1) ................................................................................ 2112 eQEP Position-compare Unit ............................................................................................. 2213 eQEP Position-compare Event Generation Points ..................................................................... 2314 eQEP Position-compare Sync Output Pulse Stretcher ................................................................ 2315 eQEP Edge Capture Unit ................................................................................................. 2516 Unit Position Event for Low Speed Measurement (QCAPCTL[UPPS] = 0010) .................................... 2517 eQEP Edge Capture Unit - Timing Details .............................................................................. 2618 eQEP Watchdog Timer .................................................................................................... 2719 eQEP Unit Time Base ..................................................................................................... 2820 EQEP Interrupt Generation ............................................................................................... 2821 QEP Decoder Control (QDECCTL) Register ........................................................................... 2922 eQEP Control (QEPCTL) Register ....................................................................................... 3023 eQEP Position-compare Control (QPOSCTL) Register ............................................................... 3124 eQEP Capture Control (QCAPCTL) Register .......................................................................... 3225 eQEP Position Counter (QPOSCNT) Register ......................................................................... 3326 eQEP Position Counter Initialization (QPOSINIT) Register........................................................... 3327 eQEP Maximum Position Count Register (QPOSMAX) Register .................................................... 3328 eQEP Position-compare (QPOSCMP) Register........................................................................ 3329 eQEP Index Position Latch (QPOSILAT) Register .................................................................... 3430 eQEP Strobe Position Latch (QPOSSLAT) Register .................................................................. 3431 eQEP Position Counter Latch (QPOSLAT) Register .................................................................. 3432 eQEP Unit Timer (QUTMR) Register .................................................................................... 3533 eQEP Register Unit Period (QUPRD) Register ........................................................................ 3534 eQEP Watchdog Timer (QWDTMR) Register .......................................................................... 3535 eQEP Watchdog Period (QWDPRD) Register ......................................................................... 3536 eQEP Interrupt Enable (QEINT) Register ............................................................................... 3637 eQEP Interrupt Flag (QFLG) Register ................................................................................... 3738 eQEP Interrupt Clear (QCLR) Register.................................................................................. 3839 eQEP Interrupt Force (QFRC) Register ................................................................................. 3940 eQEP Status (QEPSTS) Register ........................................................................................ 4041 eQEP Capture Timer (QCTMR) Register ............................................................................... 4142 eQEP Capture Period (QCPRD) Register .............................................................................. 4143 eQEP Capture Timer Latch (QCTMRLAT) Register ................................................................... 4144 eQEP Capture Period Latch (QCPRDLAT) Register .................................................................. 42
List of Figures4 SPRUG05A – August 2008 – Revised December 2008Submit Documentation Feedback

www.ti.com
List of Tables
1 EQEP Memory Map ....................................................................................................... 122 Quadrature Decoder Truth Table ........................................................................................ 153 eQEP Decoder Control (QDECCTL) Register Field Descriptions ................................................... 294 eQEP Control (QEPCTL) Register Field Descriptions................................................................. 305 eQEP Position-compare Control (QPOSCTL) Register Field Descriptions ......................................... 316 eQEP Capture Control (QCAPCTL) Register Field Descriptions .................................................... 327 eQEP Position Counter (QPOSCNT) Register Field Descriptions ................................................... 338 eQEP Position Counter Initialization (QPOSINIT) Register Field Descriptions .................................... 339 eQEP Maximum Position Count (QPOSMAX) Register Field Descriptions ........................................ 3310 eQEP Position-compare (QPOSCMP) Register Field Descriptions ................................................. 3411 eQEP Index Position Latch(QPOSILAT) Register Field Descriptions ............................................... 3412 eQEP Strobe Position Latch (QPOSSLAT) Register Field Descriptions ............................................ 3413 eQEP Position Counter Latch (QPOSLAT) Register Field Descriptions ............................................ 3414 eQEP Unit Timer (QUTMR) Register Field Descriptions .............................................................. 3515 eQEP Unit Period (QUPRD) Register Field Descriptions ............................................................. 3516 eQEP Watchdog Timer (QWDTMR) Register Field Descriptions .................................................... 3517 eQEP Watchdog Period (QWDPRD) Register Field Description .................................................... 3618 eQEP Interrupt Enable(QEINT) Register Field Descriptions ......................................................... 3619 eQEP Interrupt Flag (QFLG) Register Field Descriptions ............................................................. 3720 eQEP Interrupt Clear (QCLR) Register Field Descriptions ........................................................... 3821 eQEP Interrupt Force (QFRC) Register Field Descriptions ........................................................... 3922 eQEP Status (QEPSTS) Register Field Descriptions ................................................................. 4023 eQEP Capture Timer (QCTMR) Register Field Descriptions ......................................................... 4124 eQEP Capture Period Register (QCPRD) Register Field Descriptions ............................................. 4125 eQEP Capture Timer Latch (QCTMRLAT) Register Field Descriptions ............................................ 4226 eQEP Capture Period Latch (QCPRDLAT) Register Field Descriptions ............................................ 42
SPRUG05A – August 2008 – Revised December 2008 List of Tables 5Submit Documentation Feedback

PrefaceSPRUG05A – August 2008 – Revised December 2008
Read This First
This reference guide describes the enhanced quadrature encoder pulse (eQEP) module.
About This Manual
The eQEP module described in this reference guide is a Type 0 eQEP. See the TMS320x28xx, 28xxxDSP Peripheral Reference Guide (SPRU566 ) for a list of all devices with a module of the same type todetermine the differences between types and for a list of device-specific differences within a type.
Notational Conventions
This document uses the following conventions.•Hexadecimal numbers are shown with the suffix h or with a leading 0x. For example, the followingnumber is 40 hexadecimal (decimal 64): 40h or 0x40.•Registers in this document are shown in figures and described in tables.– Each register figure shows a rectangle divided into fields that represent the fields of the register.Each field is labeled with its bit name, its beginning and ending bit numbers above, and itsread/write properties below. A legend explains the notation used for the properties.– Reserved bits in a register figure designate a bit that is used for future device expansion.
Related Documentation From Texas InstrumentsThe following books describe the TMS320x2833x/2823x devices and related support tools that areavailable on the TI website:
Data Manual and Errata—SPRS439— TMS320F28335, TMS320F28334, TMS320F28332, TMS320F28235, TMS320F28234,TMS320F28232 Digital Signal Controllers (DSCs) Data Manual contains the pinout, signaldescriptions, as well as electrical and timing specifications for the F2833x/2823x devices.
SPRZ272— TMS320F28335, F28334, F28332, TMS320F28235, F28234, F28232 Digital SignalControllers (DSCs) Silicon Errata describes the advisories and usage notes for different versions ofsilicon.
CPU User's Guides—SPRU430— TMS320C28x DSP CPU and Instruction Set Reference Guide describes the centralprocessing unit (CPU) and the assembly language instructions of the TMS320C28x fixed-pointdigital signal processors (DSPs). It also describes emulation features available on these DSPs.
SPRUEO2— TMS320C28x Floating Point Unit and Instruction Set Reference Guide describes thefloating-point unit and includes the instructions for the FPU.
Peripheral Guides—
SPRU566— TMS320x28xx, 28xxx DSP Peripheral Reference Guide describes the peripheral referenceguides of the 28x digital signal processors (DSPs).
SPRUFB0— TMS320x2833x, 2823x System Control and Interrupts Reference Guide describes thevarious interrupts and system control features of the 2833x digital signal controllers (DSCs).
SPRU812— TMS320x2833x, 2823x Analog-to-Digital Converter (ADC) Reference Guide describes how toconfigure and use the on-chip ADC module, which is a 12-bit pipelined ADC.
6Preface SPRUG05A – August 2008 – Revised December 2008Submit Documentation Feedback

www.ti.com
Related Documentation From Texas Instruments
SPRU949— TMS320x2833x, 2823x External Interface (XINTF) User's Guide describes the XINTF, whichis a nonmultiplexed asynchronous bus, as it is used on the 2833x devices.
SPRU963— TMS320x2833x, TMS320x2823x Boot ROM User's Guide describes the purpose andfeatures of the bootloader (factory-programmed boot-loading software) and provides examples ofcode. It also describes other contents of the device on-chip boot ROM and identifies where all ofthe information is located within that memory.
SPRUFB7— TMS320x2833x, 2823x Multichannel Buffered Serial Port (McBSP) User's Guide describesthe McBSP available on the F2833x devices. The McBSPs allow direct interface between a DSPand other devices in a system.
SPRUFB8— TMS320x2833x, 2823x Direct Memory Access (DMA) Reference Guide describes the DMAon the 2833x devices.
SPRUG04— TMS320x2833x, 2823x Enhanced Pulse Width Modulator (ePWM) Module Reference Guidedescribes the main areas of the enhanced pulse width modulator that include digital motor control,switch mode power supply control, UPS (uninterruptible power supplies), and other forms of powerconversion.
SPRUG02— TMS320x2833x, 2823x High-Resolution Pulse Width Modulator (HRPWM) describes theoperation of the high-resolution extension to the pulse width modulator (HRPWM).
SPRUFG4— TMS320x2833x, 2823x Enhanced Capture (eCAP) Module Reference Guide describes theenhanced capture module. It includes the module description and registers.
SPRUG05— TMS320x2833x, 2823x Enhanced Quadrature Encoder Pulse (eQEP) Reference Guidedescribes the eQEP module, which is used for interfacing with a linear or rotary incrementalencoder to get position, direction, and speed information from a rotating machine in highperformance motion and position control systems. It includes the module description and registers.
SPRUEU1— TMS320x2833x, 2823x Enhanced Controller Area Network (eCAN) Reference Guidedescribes the eCAN that uses established protocol to communicate serially with other controllers inelectrically noisy environments.
SPRUFZ5— TMS320F2833x, 2823x Serial Communication Interface (SCI) Reference Guide describesthe SCI, which is a two-wire asynchronous serial port, commonly known as a UART. The SCImodules support digital communications between the CPU and other asynchronous peripherals thatuse the standard non-return-to-zero (NRZ) format.
SPRUEU3— TMS320x2833x, 2823x Serial Peripheral Interface (SPI) Reference Guide describes the SPI- a high-speed synchronous serial input/output (I/O) port - that allows a serial bit stream ofprogrammed length (one to sixteen bits) to be shifted into and out of the device at a programmedbit-transfer rate.
SPRUG03— TMS320x2833x, 2823x Inter-Integrated Circuit (I2C) Reference Guide describes thefeatures and operation of the inter-integrated circuit (I2C) module.
Tools Guides—
SPRU513— TMS320C28x Assembly Language Tools User's Guide describes the assembly languagetools (assembler and other tools used to develop assembly language code), assembler directives,macros, common object file format, and symbolic debugging directives for the TMS320C28x device.
SPRU514— TMS320C28x Optimizing C Compiler User's Guide describes the TMS320C28x™ C/C++compiler. This compiler accepts ANSI standard C/C++ source code and produces TMS320 DSPassembly language source code for the TMS320C28x device.
SPRU608— The TMS320C28x Instruction Set Simulator Technical Overview describes the simulator,available within the Code Composer Studio for TMS320C2000 IDE, that simulates the instructionset of the C28x™ core.
SPRU625— TMS320C28x DSP/BIOS Application Programming Interface (API) Reference Guidedescribes development using DSP/BIOS.
SPRUG05A – August 2008 – Revised December 2008 Read This First 7Submit Documentation Feedback

1 Introduction
QEPA
QEPB
QEPI
Reference GuideSPRUG05A – August 2008 – Revised December 2008
Enhanced QEP (eQEP) Module
The enhanced quadrature encoder pulse (eQEP) module is used for direct interface with a linear or rotaryincremental encoder to get position, direction, and speed information from a rotating machine for use in ahigh-performance motion and position-control system.
A single track of slots patterns the periphery of an incremental encoder disk, as shown in Figure 1 . Theseslots create an alternating pattern of dark and light lines. The disk count is defined as the number ofdark/light line pairs that occur per revolution (lines per revolution). As a rule, a second track is added togenerate a signal that occurs once per revolution (index signal: QEPI), which can be used to indicate anabsolute position. Encoder manufacturers identify the index pulse using different terms such as index,marker, home position, and zero reference
Figure 1. Optical Encoder Disk
To derive direction information, the lines on the disk are read out by two different photo-elements that"look" at the disk pattern with a mechanical shift of 1/4 the pitch of a line pair between them. This shift isrealized with a reticle or mask that restricts the view of the photo-element to the desired part of the disklines. As the disk rotates, the two photo-elements generate signals that are shifted 90 out of phase fromeach other. These are commonly called the quadrature QEPA and QEPB signals. The clockwise directionfor most encoders is defined as the QEPA channel going positive before the QEPB channel and viseversa as shown in Figure 2 .
Enhanced QEP (eQEP) Module8 SPRUG05A – August 2008 – Revised December 2008Submit Documentation Feedback

T0
0 1 2 3 4 5 6 7 N−6 N−5 N−4 N−3 N−2 N−1 0
QEPA
QEPB
QEPI
Clockwise shaft rotation/forward movement
Anti-clockwise shaft rotation/reverse movement
0 N−1 N−2 N−3 N−4 N−5N−6 N−7 6 5 4 3 2 1 0 N−1 N−2
QEPA
QEPB
QEPI
T0
Legend: N = lines per revolution
T0
0.25T0±0.1T0
0.5T0±0.1T0
T0±0.5T0
QEPA
QEPB
QEPI
(gatedto
A and B)
QEPI
(gated to A)
QEPI
(ungated)
www.ti.com
Introduction
Figure 2. QEP Encoder Output Signal for Forward/Reverse Movement
The encoder wheel typically makes one revolution for every revolution of the motor or the wheel may be ata geared rotation ratio with respect to the motor. Therefore, the frequency of the digital signal coming fromthe QEPA and QEPB outputs varies proportionally with the velocity of the motor. For example, a 2000-lineencoder directly coupled to a motor running at 5000 revolutions per minute (rpm) results in a frequency of166.6 KHz, so by measuring the frequency of either the QEPA or QEPB output, the processor candetermine the velocity of the motor.
Quadrature encoders from different manufacturers come with two forms of index pulse (gated index pulseor ungated index pulse) as shown in Figure 3 . A nonstandard form of index pulse is ungated. In theungated configuration, the index edges are not necessarily coincident with A and B signals. The gatedindex pulse is aligned to any of the four quadrature edges and width of the index pulse and can be equalto a quarter, half, or full period of the quadrature signal.
Figure 3. Index Pulse Example
SPRUG05A – August 2008 – Revised December 2008 Enhanced QEP (eQEP) Module 9Submit Documentation Feedback

v(k)[x(k)*x(k*1)
T+DX
T
(1)
v(k)[X
t(k)*t(k*1)+X
DT
(2)
2 Description
Description
www.ti.com
Some typical applications of shaft encoders include robotics and even computer input in the form of amouse. Inside your mouse you can see where the mouse ball spins a pair of axles (a left/right, and anup/down axle). These axles are connected to optical shaft encoders that effectively tell the computer howfast and in what direction the mouse is moving.
General Issues: Estimating velocity from a digital position sensor is a cost-effective strategy in motorcontrol. Two different first order approximations for velocity may be written as:
where
v(k): Velocity at time instant k
x(k): Position at time instant k
x(k-1): Position at time instant k-1
T: Fixed unit time or inverse of velocity calculation rate
∆X: Incremental position movement in unit time
t(k): Time instant "k"
t(k-1): Time instant "k-1"
X: Fixed unit position
∆T: Incremental time elapsed for unit position movement.
Equation 1 is the conventional approach to velocity estimation and it requires a time base to provide unittime event for velocity calculation. Unit time is basically the inverse of the velocity calculation rate.
The encoder count (position) is read once during each unit time event. The quantity [x(k) - x(k-1)] isformed by subtracting the previous reading from the current reading. Then the velocity estimate iscomputed by multiplying by the known constant 1/T (where T is the constant time between unit timeevents and is known in advance).
Estimation based on Equation 1 has an inherent accuracy limit directly related to the resolution of theposition sensor and the unit time period T. For example, consider a 500-line per revolution quadratureencoder with a velocity calculation rate of 400 Hz. When used for position the quadrature encoder gives afour-fold increase in resolution, in this case, 2000 counts per revolution. The minimum rotation that can bedetected is therefore 0.0005 revolutions, which gives a velocity resolution of 12 rpm when sampled at 400Hz. While this resolution may be satisfactory at moderate or high speeds, e.g. 1% error at 1200 rpm, itwould clearly prove inadequate at low speeds. In fact, at speeds below 12 rpm, the speed estimate woulderroneously be zero much of the time.
At low speed, Equation 2 provides a more accurate approach. It requires a position sensor that outputs afixed interval pulse train, such as the aforementioned quadrature encoder. The width of each pulse isdefined by motor speed for a given sensor resolution. Equation 2 can be used to calculate motor speed bymeasuring the elapsed time between successive quadrature pulse edges. However, this method suffersfrom the opposite limitation, as does Equation 1 . A combination of relatively large motor speeds and highsensor resolution makes the time interval ∆T small, and thus more greatly influenced by the timerresolution. This can introduce considerable error into high-speed estimates.
For systems with a large speed range (that is, speed estimation is needed at both low and high speeds),one approach is to use Equation 2 at low speed and have the DSP software switch over to Equation 1when the motor speed rises above some specified threshold.
This section provides the eQEP inputs, memory map, and functional description.
10 Enhanced QEP (eQEP) Module SPRUG05A – August 2008 – Revised December 2008Submit Documentation Feedback

2.1 EQEP Inputs
2.2 Functional Description
www.ti.com
Description
The eQEP inputs include two pins for quadrature-clock mode or direction-count mode, an index (or 0marker), and a strobe input.•QEPA/XCLK and QEPB/XDIRThese two pins can be used in quadrature-clock mode or direction-count mode.–Quadrature-clock ModeThe eQEP encoders provide two square wave signals (A and B) 90 electrical degrees out of phasewhose phase relationship is used to determine the direction of rotation of the input shaft andnumber of eQEP pulses from the index position to derive the relative position information. Forforward or clockwise rotation, QEPA signal leads QEPB signal and vice versa. The quadraturedecoder uses these two inputs to generate quadrature-clock and direction signals.–Direction-count ModeIn direction-count mode, direction and clock signals are provided directly from the external source.Some position encoders have this type of output instead of quadrature output. The QEPA pinprovides the clock input and the QEPB pin provides the direction input.•eQEPI: Index or Zero MarkerThe eQEP encoder uses an index signal to assign an absolute start position from which positioninformation is incrementally encoded using quadrature pulses. This pin is connected to the indexoutput of the eQEP encoder to optionally reset the position counter for each revolution. This signal canbe used to initialize or latch the position counter on the occurrence of a desired event on the index pin.•QEPS: Strobe InputThis general-purpose strobe signal can initialize or latch the position counter on the occurrence of adesired event on the strobe pin. This signal is typically connected to a sensor or limit switch to notifythat the motor has reached a defined position.
The eQEP peripheral contains the following major functional units (as shown in Figure 4 ):•Programmable input qualification for each pin (part of the GPIO MUX)•Quadrature decoder unit (QDU)•Position counter and control unit for position measurement (PCCU)•Quadrature edge-capture unit for low-speed measurement (QCAP)•Unit time base for speed/frequency measurement (UTIME)•Watchdog timer for detecting stalls (QWDOG)
SPRUG05A – August 2008 – Revised December 2008 Enhanced QEP (eQEP) Module 11Submit Documentation Feedback

QWDTMR
QWDPRD
16
QWDOGUTIME
QUPRD
QUTMR
32
UTOUT
WDTOUT
Quadrature
capture unit
(QCAP)
QCPRDLAT
QCTMRLAT
16
QFLG
QEPSTS
QEPCTL
Registers
used by
multiple units
QCLK
QDIR
QI
QS
PHE
PCSOUT
Quadrature
decoder
(QDU)
QDECCTL
16
Position counter/
control unit
(PCCU)
QPOSLAT
QPOSSLAT
32
QPOSILAT
EQEPxAIN
EQEPxBIN
EQEPxIIN
EQEPxIOUT
EQEPxIOE
EQEPxSIN
EQEPxSOUT
EQEPxSOE
GPIO
MUX
EQEPxA/XCLK
EQEPxB/XDIR
EQEPxS
EQEPxI
QPOSCMP QEINT
QFRC
32
QCLR
QPOSCTL
1632
QPOSCNT
QPOSMAX
QPOSINIT
PIE EQEPxINT
Enhanced QEP (eQEP) peripheral
System
control registers
QCTMR
QCPRD
1616
QCAPCTL
EQEPxENCLK
SYSCLKOUT
Data bus
To CPU
2.3 eQEP Memory Map
Description
www.ti.com
Figure 4. Functional Block Diagram of the eQEP Peripheral
Table 1 lists the registers with their memory locations, sizes, and reset values.
Table 1. EQEP Memory Map
Size(x16)/Name Offset #shadow Reset Register Description
QPOSCNT 0x00 2/0 0x00000000 eQEP Position CounterQPOSINIT 0x02 2/0 0x00000000 eQEP Initialization Position CountQPOSMAX 0x04 2/0 0x00000000 eQEP Maximum Position CountQPOSCMP 0x06 2/1 0x00000000 eQEP Position-compareQPOSILAT 0x08 2/0 0x00000000 eQEP Index Position LatchQPOSSLAT 0x0A 2/0 0x00000000 eQEP Strobe Position LatchQPOSLAT 0x0C 2/0 0x00000000 eQEP Position LatchQUTMR 0x0E 2/0 0x00000000 QEP Unit TimerQUPRD 0x10 2/0 0x00000000 eQEP Unit Period RegisterQWDTMR 0x12 1/0 0x0000 eQEP Watchdog TimerQWDPRD 0x13 1/0 0x0000 eQEP Watchdog Period RegisterQDECCTL 0x14 1/0 0x0000 eQEP Decoder Control RegisterQEPCTL 0x15 1/0 0x0000 eQEP Control RegisterQCAPCTL 0x16 1/0 0x0000 eQEP Capture Control Register
12 Enhanced QEP (eQEP) Module SPRUG05A – August 2008 – Revised December 2008Submit Documentation Feedback

www.ti.com
Description
Table 1. EQEP Memory Map (continued)
Size(x16)/Name Offset #shadow Reset Register Description
QPOSCTL 0x17 1/0 0x00000 eQEP Position-compare Control RegisterQEINT 0x18 1/0 0x0000 eQEP Interrupt Enable RegisterQFLG 0x19 1/0 0x0000 eQEP Interrupt Flag RegisterQCLR 0x1A 1/0 0x0000 eQEP Interrupt Clear RegisterQFRC 0x1B 1/0 0x0000 eQEP Interrupt Force RegisterQEPSTS 0x1C 1/0 0x0000 eQEP Status RegisterQCTMR 0x1D 1/0 0x0000 eQEP Capture TimerQCPRD 0x1E 1/0 0x0000 eQEP Capture Period RegisterQCTMRLAT 0x1F 1/0 0x0000 eQEP Capture Timer LatchQCPRDLAT 0x20 1/0 0x0000 eQEP Capture Period Latchreserved 0x21 31/0to0x3F
SPRUG05A – August 2008 – Revised December 2008 Enhanced QEP (eQEP) Module 13Submit Documentation Feedback

3 Quadrature Decoder Unit (QDU)
0
1
1
0
QA
QB
1
1
0
0
QDECCTL:QBP
Quadrature
decoder
00
01
10
11
iCLK
xCLK
xCLK
xCLK
01
11
10
00 iDIR
xDIR
1
0
QDECCTL:QSRC
2
QFLG:PHE
PHE
QDECCTL:QAP
x1
x2 x1, x2
QDECCTL:XCR
0
11
0
QDECCTL:QIP
QDECCTL:IGATE
QCLK
QDIR
QI
1
0
QDECCTL:QSP
0
1
QDECCTL:SPSEL
QDECCTL:SPSEL
1
0
QDECCTL:SOEN
QS
PCSOUT
EQEPxIOE
EQEPxSOE
EQEPxIOUT
EQEPxSOUT
EQEPxSIN
EQEPxIIN
EQEPxBIN
EQEPxAIN
QDECCTL:SWAP
QEPSTS:QDF
EQEPA
EQEPB
3.1 Position Counter Input Modes
Quadrature Decoder Unit (QDU)
www.ti.com
Figure 5 shows a functional block diagram of the QDU.
Figure 5. Functional Block Diagram of Decoder Unit
Clock and direction input to position counter is selected using QDECCTL[QSRC] bits, based on interfaceinput requirement as follows:•Quadrature-count mode•Direction-count mode•UP-count mode•DOWN-count mode
14 Enhanced QEP (eQEP) Module SPRUG05A – August 2008 – Revised December 2008Submit Documentation Feedback

3.1.1 Quadrature Count Mode
(00)
(10)
(11)
(01)
(A,B)=
QEPA
QEPB
eQEP signals
10
01
00 11
Increment
counter
Decrement
counter
Decrement
counter
Increment
counter
Decrement
counter
Decrement
counter
Increment
counter
Increment
counter
www.ti.com
Quadrature Decoder Unit (QDU)
The quadrature decoder generates the direction and clock to the position counter in quadrature countmode.
Direction Decoding— The direction decoding logic of the eQEP circuit determines which one of thesequences (QEPA, QEPB) is the leading sequence and accordingly updates the directioninformation in QEPSTS[QDF] bit. Table 2 and Figure 6 show the direction decoding logic in truthtable and state machine form. Both edges of the QEPA and QEPB signals are sensed to generatecount pulses for the position counter. Therefore, the frequency of the clock generated by the eQEPlogic is four times that of each input sequence. Figure 7 shows the direction decoding and clockgeneration from the eQEP input signals.
Table 2. Quadrature Decoder Truth Table
.
Previous Edge Present Edge QDIR QPOSCNT
QA ↑QB ↑UP IncrementQB ↓DOWN DecrementQA ↓TOGGLE Increment or DecrementQA ↓QB ↓UP IncrementQB ↑DOWN DecrementQA ↑TOGGLE Increment or DecrementQB ↑QA ↑DOWN IncrementQA ↓UP DecrementQB ↓TOGGLE Increment or DecrementQB ↓QA ↓DOWN IncrementQA ↑UP DecrementQB ↑TOGGLE Increment or Decrement
Figure 6. Quadrature Decoder State Machine
SPRUG05A – August 2008 – Revised December 2008 Enhanced QEP (eQEP) Module 15Submit Documentation Feedback

+1 +1 +1+1 +1+1+1 −1 −1 −1−1 −1−1−1−1 −1−1 −1 +1+1+1
−1 −1 −1 −1 −1 −1 −1 +1 +1 +1 +1 +1 +1 +1+1+1+1 +1 −1−1−1
QA
QB
QCLK
QDIR
QPOSCNT
QA
QB
QCLK
QDIR
QPOSCNT
3.1.2 Direction-count Mode
3.1.3 Up-Count Mode
Quadrature Decoder Unit (QDU)
www.ti.com
Figure 7. Quadrature-clock and Direction Decoding
Phase Error Flag— In normal operating conditions, quadrature inputs QEPA and QEPB will be 90degrees out of phase. The phase error flag (PHE) is set in the QFLG register when edge transitionis detected simultaneously on the QEPA and QEPB signals to optionally generate interrupts. Statetransitions marked by dashed lines in Figure 6 are invalid transitions that generate a phase error.
Count Multiplication— The eQEP position counter provides 4x times the resolution of an input clock bygenerating a quadrature-clock (QCLK) on the rising/falling edges of both eQEP input clocks (QEPAand QEPB) as shown in Figure 7 .
Reverse Count— In normal quadrature count operation, QEPA input is fed to the QA input of thequadrature decoder and the QEPB input is fed to the QB input of the quadrature decoder. Reversecounting is enabled by setting the SWAP bit in the QDECCTL register. This will swap the input tothe quadrature decoder thereby reversing the counting direction.
Some position encoders provide direction and clock outputs, instead of quadrature outputs. In such cases,direction-count mode can be used. QEPA input will provide the clock for position counter and the QEPBinput will have the direction information. The position counter is incremented on every rising edge of aQEPA input when the direction input is high and decremented when the direction input is low.
The counter direction signal is hard-wired for up count and the position counter is used to measure thefrequency of the QEPA input. Setting of the QDECCTL[XCR] bit enables clock generation to the positioncounter on both edges of the QEPA input, thereby increasing the measurement resolution by 2x factor.
Enhanced QEP (eQEP) Module16 SPRUG05A – August 2008 – Revised December 2008Submit Documentation Feedback

3.1.4 Down-Count Mode
3.2 eQEP Input Polarity Selection
3.3 Position-Compare Sync Output
4 Position Counter and Control Unit (PCCU)
4.1 Position Counter Operating Modes
4.1.1 Position Counter Reset on Index Event (QEPCTL[PCRM]=00)
www.ti.com
Position Counter and Control Unit (PCCU)
The counter direction signal is hardwired for a down count and the position counter is used to measure thefrequency of the QEPA input. Setting of the QDECCTL[XCR] bit enables clock generation to the positioncounter on both edges of a QEPA input, thereby increasing the measurement resolution by 2x factor.
Each eQEP input can be inverted using QDECCTL[8:5] control bits. As an example, setting ofQDECCTL[QIP] bit will invert the index input.
The enhanced eQEP peripheral includes a position-compare unit that is used to generate theposition-compare sync signal on compare match between the position counter register (QPOSCNT) andthe position-compare register (QPOSCMP). This sync signal can be output using an index pin or strobepin of the EQEP peripheral.
Setting the QDECCTL[SOEN] bit enables the position-compare sync output and the QDECCTL[SPSEL] bitselects either an eQEP index pin or an eQEP strobe pin.
The position counter and control unit provides two configuration registers (QEPCTL and QPOSCTL) forsetting up position counter operational modes, position counter initialization/latch modes andposition-compare logic for sync signal generation.
Position counter data may be captured in different manners. In some systems, the position counter isaccumulated continuously for multiple revolutions and the position counter value provides the positioninformation with respect to the known reference. An example of this is the quadrature encoder mounted onthe motor controlling the print head in the printer. Here the position counter is reset by moving the printhead to the home position and then position counter provides absolute position information with respect tohome position.
In other systems, the position counter is reset on every revolution using index pulse and position counterprovides rotor angle with respect to index pulse position.
Position counter can be configured to operate in following four modes•Position Counter Reset on Index Event•Position Counter Reset on Maximum Position•Position Counter Reset on the first Index Event•Position Counter Reset on Unit Time Out Event (Frequency Measurement)
In all the above operating modes, position counter is reset to 0 on overflow and to QPOSMAX registervalue on underflow. Overflow occurs when the position counter counts up after QPOSMAX value.Underflow occurs when position counter counts down after "0". Interrupt flag is set to indicateoverflow/underflow in QFLG register.
If the index event occurs during the forward movement, then position counter is reset to 0 on the nexteQEP clock. If the index event occurs during the reverse movement, then the position counter is reset tothe value in the QPOSMAX register on the next eQEP clock.
First index marker is defined as the quadrature edge following the first index edge. The eQEP peripheralrecords the occurrence of the first index marker (QEPSTS[FIMF]) and direction on the first index eventmarker (QEPSTS[FIDF]) in QEPSTS registers, it also remembers the quadrature edge on the first indexmarker so that same relative quadrature transition is used for index event reset operation.
SPRUG05A – August 2008 – Revised December 2008 Enhanced QEP (eQEP) Module 17Submit Documentation Feedback

F9D
F9E 0
F9F 321 4 3 12 F9D
F9E
F9F
0F9B
F9C F9A
F97
F98
F99
QA
QB
QCLK
QEPSTS:QDF
QPOSCNT F9C 4 5
F9F 0
QI
Index interrupt/
index event
marker
QPOSILAT
QEPSTS:QDLF
4.1.2 Position Counter Reset on Maximum Position (QEPCTL[PCRM]=01)
Position Counter and Control Unit (PCCU)
www.ti.com
For example, if the first reset operation occurs on the falling edge of QEPB during the forward direction,then all the subsequent reset must be aligned with the falling edge of QEPB for the forward rotation andon the rising edge of QEPB for the reverse rotation as shown in Figure 8 .
The position-counter value is latched to the QPOSILAT register and direction information is recorded inthe QEPSTS[QDLF] bit on every index event marker. The position-counter error flag (QEPSTS[PCEF])and error interrupt flag (QFLG[PCE]) are set if the latched value is not equal to 0 or QPOSMAX. Theposition-counter error flag (QEPSTS[PCEF]) is updated on every index event marker and an interrupt flag(QFLG[PCE]) will be set on error that can be cleared only through software.
The index event latch configuration QEPCTL[IEL] bits are ignored in this mode and position counter errorflag/interrupt flag are generated only in index event reset mode.
Figure 8. Position Counter Reset by Index Pulse for 1000 Line Encoder (QPOSMAX = 3999 or 0xF9F)
If the position counter is equal to QPOSMAX, then the position counter is reset to 0 on the next eQEPclock for forward movement and position counter overflow flag is set. If the position counter is equal toZERO, then the position counter is reset to QPOSMAX on the next QEP clock for reverse movement andposition counter underflow flag is set. Figure 9 shows the position counter reset operation in this mode.
First index marker is defined as the quadrature edge following the first index edge. The eQEP peripheralrecords the occurrence of the first index marker (QEPSTS[FIMF]) and direction on the first index eventmarker (QEPSTS[FIDF]) in the QEPSTS registers; it also remembers the quadrature edge on the firstindex marker so that the same relative quadrature transition is used for the software index marker(QEPCTL[IEL]=11).
Enhanced QEP (eQEP) Module18 SPRUG05A – August 2008 – Revised December 2008Submit Documentation Feedback

QA
QB
QCLK
QDIR
QPOSCNT
OV/UF
QA
QB
QCLK
QDIR
QPOSCNT
OV/UF
123401 2 1043210432 1 2340
104321 0 1234012340 1 043
4.1.3 Position Counter Reset on the First Index Event (QEPCTL[PCRM] = 10)
4.1.4 Position Counter Reset on Unit Time out Event (QEPCTL[PCRM] = 11)
www.ti.com
Position Counter and Control Unit (PCCU)
Figure 9. Position Counter Underflow/Overflow (QPOSMAX = 4)
If the index event occurs during forward movement, then the position counter is reset to 0 on the nexteQEP clock. If the index event occurs during the reverse movement, then the position counter is reset tothe value in the QPOSMAX register on the next eQEP clock. Note that this is done only on the firstoccurrence and subsequently the position counter value is not reset on an index event; rather, it is resetbased on maximum position as described in Section Section 4.1.2 .
First index marker is defined as the quadrature edge following the first index edge. The eQEP peripheralrecords the occurrence of the first index marker (QEPSTS[FIMF]) and direction on the first index eventmarker (QEPSTS[FIDF]) in QEPSTS registers, it also remembers the quadrature edge on the first indexmarker so that same relative quadrature transition is used for software index marker (QEPCTL[IEL]=11).
In this mode, the QPOSCNT value is latched to the QPOSLAT register and then the QPOSCNT is reset(to 0 or QPOSMAX, depending on the direction mode selected by QDECCTL[QSRC] bits on a unit timeevent). This is useful for frequency measurement.
SPRUG05A – August 2008 – Revised December 2008 Enhanced QEP (eQEP) Module 19Submit Documentation Feedback

4.2 Position Counter Latch
4.2.1 Index Event Latch
Position Counter and Control Unit (PCCU)
www.ti.com
The eQEP index and strobe input can be configured to latch the position counter (QPOSCNT) intoQPOSILAT and QPOSSLAT, respectively, on occurrence of a definite event on these pins.
In some applications, it may not be desirable to reset the position counter on every index event andinstead it may be required to operate the position counter in full 32-bit mode (QEPCTL[PCRM] = 01 andQEPCTL[PCRM] = 10 modes).
In such cases, the eQEP position counter can be configured to latch on the following events and directioninformation is recorded in the QEPSTS[QDLF] bit on every index event marker.•Latch on Rising edge (QEPCTL[IEL]=01)•Latch on Falling edge (QEPCTL[IEL]=10)•Latch on Index Event Marker (QEPCTL[IEL]=11)
This is particularly useful as an error checking mechanism to check if the position counter accumulatedthe correct number of counts between index events. As an example, the 1000-line encoder must count4000 times when moving in the same direction between the index events.
The index event latch interrupt flag (QFLG[IEL]) is set when the position counter is latched to theQPOSILAT register. The index event latch configuration bits (QEPCTZ[IEL]) are ignored whenQEPCTL[PCRM] = 00.
Latch on Rising Edge (QEPCTL[IEL]=01)— The position counter value (QPOSCNT) is latched to theQPOSILAT register on every rising edge of an index input.
Latch on Falling Edge (QEPCTL[IEL] = 10)— The position counter value (QPOSCNT) is latched to theQPOSILAT register on every falling edge of index input.
Latch on Index Event Marker/Software Index Marker (QEPCTL[IEL] = 11— The first index marker isdefined as the quadrature edge following the first index edge. The eQEP peripheral records theoccurrence of the first index marker (QEPSTS[FIMF]) and direction on the first index event marker(QEPSTS[FIDF]) in the QEPSTS registers. It also remembers the quadrature edge on the firstindex marker so that same relative quadrature transition is used for latching the position counter(QEPCTL[IEL]=11).
Figure 10 shows the position counter latch using an index event marker.
Enhanced QEP (eQEP) Module20 SPRUG05A – August 2008 – Revised December 2008Submit Documentation Feedback
This manual suits for next models
1
Table of contents
Popular Recording Equipment manuals by other brands

Lexicon
Lexicon 300 V3.0 - GUIDE REV 1 owner's manual

YASKAWA
YASKAWA MECHATROLINK-II V1000 installation manual

EVS
EVS Synapse 2GX100/110 Installation & configuration manual

Yamaha
Yamaha GEP50 Operation manual

Delta Elektronika
Delta Elektronika PSC-ETH-2 product manual

Rosslare
Rosslare MD-08B Installation and user manual