AN2897 Freescale Semiconductor / Motorola, AN2897 Datasheet - Page 21

no-image

AN2897

Manufacturer Part Number
AN2897
Description
Using the eTPU Angle Clock
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
4.2.1
The first state is entered by a host service request. The eTPU parameters are initialized and hardware is
setup for the specific application.
4.2.2
The eTPU will wait until a transition is detected on the input pin. The channel service request vector for
TransitionA is shared with Match B. Also, the channel cannot distinguish between the initial startup tooth
transitions and subsequent ones. Therefore the software must sort out the service requests from the channel
when they are received.
Freescale Semiconductor
NewRev
AdjustAngle
if (hsrInitAngleClock)
{
/* Initialize Parameters */
State1:
// Set the channel mode to detection one input transition and two match
events
SetChannelMode(m2_st);
/* ... */
// Setup action unit A to capture high to low transition
SetupCaptureTrans_A(Capture_tcr1, high_low);
/* Match2SingleTransition mode requires a MatchA before the transition can be detected. Force
the first match in a couple of microseconds. */
// Setup match to block out transition too close to current time
SetupMatch_A((tcr1+20), Mtcr1_Ctcr1_ge, match_no_change);
}
Initialize Crank
First Edge
Reference
Name
if AngleClock = 0 then ToothCount = 0
ToothTime = Time(ActiveEdge)
BlankTimer = Period * BlankingRatio
EngineAngle = EngineAngle + AngleCorrection
Do Not Change State Number
Table 1. Angle Clock System State (continued)
Using the eTPU Angle Clock, Rev. 0
// Sets Entry Vector for the eTPU
EXAMPLE
EXAMPLE
Action
If ActiveEdge
If AdjustAngle() //return
If timeout (StallTimer)
Return to last state.
Exit Condition
eTPU Software Design
x
21

Related parts for AN2897