AN2897 Freescale Semiconductor / Motorola, AN2897 Datasheet - Page 10

no-image

AN2897

Manufacturer Part Number
AN2897
Description
Using the eTPU Angle Clock
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
System Design
3.1.3
The eTPU Angle Clock can resolve the angle between the teeth into as many as 1024 ticks. However the
proper selection of the TICKS value in the TPR must take into account other considerations. To understand
the limits for TICKS in a given system, the engineer must consider the configuration of the toothed wheel,
the maximum and minimum speed that must be processed, and the selected resolution of the TCR1
counter.
The TCR1 counter resolution is usually a compromise between the finest resolution required by the eTPU
channel drivers and the maximum pulse width that must be measured or driven. In fact, arbitrarily long
pulses can be processed regardless of the TCR1 resolution by using software intervention, so the maximum
time is seldom a great consideration. The minimum TCR1 resolution is two times the period of the MCU
system clock. However, many systems engineers choose a convenient value derived from the clock. A
typical TCR1 resolution might be 100 nanoseconds. The would enable the eTPU to time out pulses up to
about 0.8 seconds with a single write to a match register. (Using the greater-than-or-equal comparison, the
future equals half the range of the counter. Values larger than 0x800000 above the TCR value are
considered in the past, and will match immediately using the greater-than-or-equal comparison.)
Now consider the TRR. It is organized as a 1-bit integer and a 9-bit fraction.This means that the largest
value for a single tick would be 0X7FFF.1FF (32767.998) times the period of the TCR. Since a zero value
in the integer field is processed as 32768, the minimum TRR value is actually 1. There are reasons to avoid
both of these extremes, so the user should build in a little margin when setting the limits.
The maximum number of ticks per tooth should ensure that there is more than one TCR1 time per tick at
the maximum speed for the wheel. The minimum number of ticks per tooth should ensure that the
maximum value of TRR is not exceeded at the minimum wheel speed.
3.1.4
The reference point for a periodic angle clock should be on a selected physical tooth edge. Typically this
might be the first tooth edge after the gap, but any edge can be chosen. Note that if the Angle Clock is to
cycle through 720 degrees rotation, the resetting tooth is found on alternate rotations of the wheel.
10
Assume a TCR1 time of 100 nanoseconds, a maximum speed of 10,000 RPM and a 36 tooth (10
degree) wheel,
1 *MaxTicks < DegreesPerTooth * TRC1_Frequency / (60 * RPM_Maximum)
MaxTicks < 1 * 10.0 * 10,000,000 / 60 * 10,000 = 166. ticks per tooth
Assume a TCR1 time of 100 nanoseconds, a minimum speed of 20 RPM and a 36 tooth (10 degree)
wheel,
32768 * MinTicks > DegreesPerTooth * TRC1_Frequency / (60 * RPM_Minimum)
MinTicks > 10.0 * 10,000,000 / (60 * 20 * 32768) = 2.543 ticks per tooth
choose 100 for 10 ticks per degree (0.1 degree per tick)
Angle Resolution
Reference Point
Using the eTPU Angle Clock, Rev. 0
EXAMPLE
Freescale Semiconductor

Related parts for AN2897