Functional Overview: AN2511/D Rev. 0, 5/2003 32-Bit Linear Quadrature Decoder TPU Function Set (32LQD)
Functional Overview: AN2511/D Rev. 0, 5/2003 32-Bit Linear Quadrature Decoder TPU Function Set (32LQD)
Functional Overview: AN2511/D Rev. 0, 5/2003 32-Bit Linear Quadrature Decoder TPU Function Set (32LQD)
AN2511/D
Rev. 0, 5/2003
Functional Overview
32-bit Linear Quadrature Decoder (32LQD) TPU Function Set is useful for
decoding position, direction and velocity information from encoder signals in
motion control systems. The 32-bit Position Counter (PC) is particularly useful
for linear motor systems. The function set consists of 3 TPU functions:
• 32-bit Linear Quadrature Decoder (32LQD)
• Home Channel for 32-bit Linear Quadrature Decoder (32LQD_Home)
• Velocity Support for 32-bit Linear Quadrature Decoder (32LQD_VS)
The 32-bit Linear Quadrature Decoder uses two input channels to decode a
pair of out-of-phase encoder signals and produce a resulting 32-bit bidirectional
position counter for the CPU. An additional input channel can also be used to
indicate a “home” position. When the position is reached, appropriate actions
are taken. For accurate velocity measurement, Velocity Support can be added.
Figure 1 illustrates the functionality.
Phase A
Phase B
Position Counter +1 +1 +1 +1 +1 +1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 +1 +1 +1 +1
Home
Figure 1. Signals processed by 32LQD TPU function set and corresponding PC value
©M
The 32LQD is the main function of the set. It can be used either alone, with one
of the supporting functions, or with both of them. There are no restrictions on
channel numbers – any function can run on any channel.
The two out of phase encoder signals are called Phase A (primary channel) and
Phase B (secondary channel). The Host Sequence (HSQ) bit 0 is used to
determine to which channel Phase A is connected and to which Phase B is
connected. The HSQ is also used for other configuration options – refer to the
detailed function descriptions.
In this configuration, when no other functions run on the same TPU, the 32LQD
can receive and process input transitions at a rate of up to 540 kcounts per
second at 40MHz IMB clock. When 32LQD_home and 32LQD_VS are not
used, the 32LQD running standalone can count edges at a rate of up to 800
kcounts per second at 40MHz IMB clock. This is equivalent to a 1024-pulse
encoder speed of more then 11,700 rpm.
1 svmStd_top middle
2 svmStd_top middle
3 svmStd_bottom middle
4 svmStd_bottom middle
5 svmStd_bottom middle
6 32LQD high
7 32LQD high
8 32LQD_home low
10 svmStd_sync low
12 32LQD_VS low
15 svmStd_fault middle
5. Issues an HSR (Host Service Request) type %10 to both of the 32LQD
channels to initialize position counting. Issues an HSR type %10 to the
32LQD_home and 32LQD_VS channels, if used.
6. Enables servicing by assigning high, middle or low priority to the channel
priority bits. Both Phase A and Phase B channels should be assigned
the same priority.
NOTE: A CPU routine that configures the TPU can be generated automatically using
the MPC500_Quick_Start Graphical Configuration Tool.
32-bit Linear The 32LQD operates on two channels and processes the incoming out-of-
Quadrature Decoder phase encoder signal. As a result of this processing, the bidirectional 32-bit
(32LQD) Position Counter (PC) gets a value that reflects the position of a motion system.
The PC value is incremented or decremented by 1 on each transition of Phase
A or Phase B input channels – see Figure 2. On initialization, the PC is set to
a 32-bit PC_init value entered by the CPU.
Phase A
Phase B
Position Counter +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1
Phase A
Phase B
Freescale Semiconductor, Inc...
Position Counter -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
Phase A
Phase B
Position Counter +1 +1 +1 +1 +1 +1 -1 -1 -1 -1 -1 -1
The mode selection is done by HSQ bit 1. The HSQ bit 0 is used to determine
which channel is Phase A and which is Phase B – see Table 5. The user has
to select Phase A on one channel and Phase B on the other, and the same
mode on both channels.
The function offers interpolation support for very slow quadrature signals. The
parameters LastEdgeT and ActualT are updated on a Host Service Request
HSR = 11. The LastEdgeT then has the value of last incoming edge time in
TCR clocks and the ActualT has the current value of the TCR clock.
The CPU program should use 32-bit reads/writes of 32-bit parameters (PC,
PC_init) to ensure their coherency. It can also use a 32-bit read of LastEdgeT
and ActualT for coherency.
Host Interface
Written By CPU Written by both CPU and TPU
functions)
1 0
Channel Priority 00 – Channel Disabled
01 – Low Priority
10 – Middle Priority
11 – High Priority
1 0
Host Service Bits (HSR) 00 – No Host Service Request
01 – Not used
10 – Initialization
11 – Get LastEdgeT and ActualT
1 0
Host Sequence Bits (HSQ) x0 – Phase A (primary channel)
x1 – Phase B (secondary channel)
0x – TCR1 clock selected
1x – TCR2 clock selected
0
Channel Interrupt Enable x – Not used
0
Channel Interrupt Status x – Not used
Phase A
3 PC_LOWER
4 TCR_VALUE
5 CORR_PIN_PTR_A
6 CHAN_PINSTATE_A
7
Freescale Semiconductor, Inc...
0
1
2 PC_init_UPPER
Phase B
3 PC_init_LOWER
4
5 CORR_PIN_PTR_B
6 CHAN_PINSTATE_B
7
Performance
NOTE: Execution times do not include the time slot transition time (TST = 10 or 14 IMB
clocks)
Freescale Semiconductor, Inc...
Phase A EDGE EDGE EDGE EDGE EDGE EDGE EDGE EDGE EDGE
GET
Phase B EDGE EDGE EDGE
TIME
EDGE EDGE EDGE EDGE EDGE
HSR 11
INIT GET_TIME
EDGE
HSR = 10 HSR = 11
Noise Immunity The input signals can be disturbed by an impulse noise. The TPU hardware
rejects short input pulses of less than a configurable number of IMB clocks.
Longer pulses are processed by TPU. Furthermore the function itself uses a pin
history to reject any short error pulse that is long enough to get through the
hardware filter, but not long enough to last from the actual transition time to the
time that the TPU services the channel. Even longer error pulses are counted
on both edges resulting a net error of zero on the PC. See examples of error
pulses processing on Figure 5.
Phase A
Freescale Semiconductor, Inc...
Phase B
Position Counter +1 X +1 +1 X +1 +1 +1 X +1
Phase A
Phase B
Position Counter +1 +1 -1 +1 +1 -1 -1 -1 +1 +1 -1 +1 +1
Home Channel for The 32LQD_home function monitors an input signal, which indicates a “HOME-
32-bit Linear position” of the motion system with a pulse. The function can be configured to
Quadrature Decoder react on either a low-high transition, a high-low transition or either transition.
(32LQD_home) This way the user can select whether the HOME-signal is of positive or
negative polarity and the action to be taken when the HOME-position is either
reached, left or both. Three function modes are offered based on these options:
• Detection of low-high transition
• Detection of high-low transition
• Detection of any transition
When the specified action happens the 32LQD_home function resets the 32-
bit Position Counter to its initialization value (PC_init_UPPER,
PC_init_LOWER) and generates a channel interrupt.
Host Interface
Written By CPU Written by both CPU and TPU
functions)
1 0
Channel Priority 00 – Channel Disabled
01 – Low Priority
10 – Middle Priority
11 – High Priority
1 0
Host Service Bits (HSR) 00 – No Host Service Request
01 – Not used
10 – Initialization
11 – Not used
1 0
Host Sequence Bits (HSQ) 00 – Detection of low-high transition
01 – Detection of high-low transition
1x – Detection of any transition
0
Channel Interrupt Enable 0 – Channel Interrupt Disabled
1 – Channel Interrupt Enabled
0
Channel Interrupt Status 0 – Interrupt Not Asserted
1 – Interrupt Asserted
2
3
4
5
6 PC_VS_ADDR
7
Performance
NOTE: Execution times do not include the time slot transition time (TST = 10 or 14 IMB
clocks)
H SQ = 00
H om e HOME
H SQ = 01
H om e HOME
H SQ = 1x
H om e HOME HO ME
INIT
HOME
HSR = 10
Velocity Support for The 32LQD_VS runs on an unconnected TPU channel. The function
Freescale Semiconductor, Inc...
32-bit Linear periodically measures the difference of the 32LQD 32-bit Position Counter (PD
Quadrature Decoder – Position Difference) and the exact time corresponding to it (TD – Time
(32LQD_VS) Difference). The Time Difference slightly varies from the period of
measurement (VS_period). The Time Difference is calculated as the difference
between the time of the last transition counted and the time of the transition
preceeding the first one counted. It is illustrated on Figure 8.
VS_period
Time Difference
Phase A
Phase B
Position Counter +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1
Position Difference = 9
The Time Difference and Position Difference values can be used by the CPU
program to calculate the exact velocity of the motion system.
The function can use either the TCR1 or the TCR2 clock for VS_period
measurement. Two function modes are offered based on this options:
• TCR1 clock selected
• TCR2 clock selected
The mode selection is done by the HSQ bits – see Table 13. The selected
clock must be the same as is used by the main function 16QD.
Host Interface
Written By CPU Written by both CPU and TPU
Freescale Semiconductor, Inc...
Velocity Support
2 PC_VS_UPPER
3 PC_VS_LOWER
4 VS_PD_UPPER
5 VS_PD_LOWER
6 VS_TD
Freescale Semiconductor, Inc...
7 EDGE_TIME
Performance
NOTE: Execution times do not include the time slot transition time (TST = 10 or 14 IMB
clocks)
Freescale Semiconductor, Inc...
VS VS VS VS VS
INIT
VS
HSR = 10
E-mail:
support@freescale.com
+1-800-521-6274 or +1-480-768-2130
support@freescale.com
Japan:
Freescale Semiconductor Japan Ltd.
Headquarters
ARCO Tower 15F Information in this document is provided solely to enable system and software
1-8-1, Shimo-Meguro, Meguro-ku, implementers to use Freescale Semiconductor products. There are no express or
implied copyright licenses granted hereunder to design or fabricate any integrated
Tokyo 153-0064 circuits or integrated circuits based on the information in this document.
Japan Freescale Semiconductor reserves the right to make changes without further notice to
0120 191014 or +81 3 5437 9125 any products herein. Freescale Semiconductor makes no warranty, representation or
support.japan@freescale.com guarantee regarding the suitability of its products for any particular purpose, nor does
Freescale Semiconductor assume any liability arising out of the application or use of
Asia/Pacific: any product or circuit, and specifically disclaims any and all liability, including without
Freescale Semiconductor Hong Kong Ltd. limitation consequential or incidental damages. “Typical” parameters which may be
provided in Freescale Semiconductor data sheets and/or specifications can and do
Technical Information Center vary in different applications and actual performance may vary over time. All operating
2 Dai King Street parameters, including “Typicals” must be validated for each customer application by
Tai Po Industrial Estate customer’s technical experts. Freescale Semiconductor does not convey any license
Tai Po, N.T., Hong Kong under its patent rights nor the rights of others. Freescale Semiconductor products are
+800 2666 8080 not designed, intended, or authorized for use as components in systems intended for
support.asia@freescale.com surgical implant into the body, or other applications intended to support or sustain life,
or for any other application in which the failure of the Freescale Semiconductor product
could create a situation where personal injury or death may occur. Should Buyer
For Literature Requests Only: purchase or use Freescale Semiconductor products for any such unintended or
Freescale Semiconductor Literature Distribution Center unauthorized application, Buyer shall indemnify and hold Freescale Semiconductor
P.O. Box 5405 and its officers, employees, subsidiaries, affiliates, and distributors harmless against all
Denver, Colorado 80217 claims, costs, damages, and expenses, and reasonable attorney fees arising out of,
1-800-441-2447 or 303-675-2140 directly or indirectly, any claim of personal injury or death associated with such
Fax: 303-675-2150 unintended or unauthorized use, even if such claim alleges that Freescale
LDCForFreescaleSemiconductor@hibbertgroup.com Semiconductor was negligent regarding the design or manufacture of the part.
AN2511/D
Rev. 0
5/2003
For More Information On This Product,
Go to: www.freescale.com