![Freescale Semiconductor MC9S12ZVM series Reference Manual Download Page 74](http://html1.mh-extra.com/html/freescale-semiconductor/mc9s12zvm-series/mc9s12zvm-series_reference-manual_2330602074.webp)
Chapter 1 Device Overview MC9S12ZVM-Family
MC9S12ZVM Family Reference Manual Rev. 1.3
74
Freescale Semiconductor
by the CPU monitoring flags or responding to interrupts. The TIM then generates the commutation_event
under CPU control, based on the zero crossing time.
1. Enable TIM OC0 and select toggle action on output compare event: TCTL2[OM0:OL0]=0b01.
2. Enable PMF commutation event input: PMFCFG1[ENCE]=0b1.
3. Enable internal ADC channel for measuring the phase voltages from the muxed GDU outputs.
4. Align rotor to stator field. Initialize phase MUX using register GDUPHMUX.
5. Startup motor by applying PWM to an arbitrary motor phase.
6. Take samples of the phase voltages periodically based on PWM cycle to detect zero crossing.
7. Calculate the delay to next commutation and store value to output compare register. Update
registers with next values of mask and swap.
8. On next output compare event the buffered mask and swap information are transferred to the active
PWM register to execute the commutation.
1.13.6
PMSM Control
PMSM control drives all 3 phases simultaneously with sinusoidal waveforms. Both sensorless and Sine-
Cosine position sensor control loop operation are supported.
1.13.6.1
PMSM Sensorless Operation
In this configuration the PMSM stator winding currents are driven sinusoidally and the back EMF
waveform is also sinusoidal. Thus all 3 phases are active simultaneously. The rotor position and speed are
determined by the current and calculated voltages respectively. The back EMF voltage is calculated based
on the currents.
1. Configure PMF for complementary mode operation.
2. Configure PMF for center aligned or phase shifted operation.
3. Select correct PMF deadtime insertion based on external FET switches.
4. Enable GDU current sense opamps for measuring the phase currents from 2 external shunts.
5. Map the output pin of each current sense opamp to the ADC input.
6. Optionally use GDU phase comparators for zero crossing detection to correct deadtime distortion.
7. Fetch targeted motor speed parameter from external source (e.g. SCI)
8. Configure PMF period and duty cycle.
9. Startup motor by applying FOC startup algorithm.
10. Take samples of the phase currents periodically based on PWM cycle to determine motor speed.
11. Calculate FOC algorithm to determine back EMF and motor position.