ST7MC1/ST7MC2
182/308
MOTOR CONTROLLER (Cont’d)
A logic block manages capture operations de-
pending on the sensor type. A capture is initiated
on an active edge (“Tacho capture” event) when
using a tachogenerator.
If an encoder is used, the capture is triggered on
two events depending on the Encoder Capture
Mode bit (ECM) in the MZFR register:
– Reading the MSB of the counter in manual
mode (ECM = 1)
– Interrupt from the Real Time Clock in automat-
ic mode (ECM = 0)
The clock source of the counter is selected de-
pending on sensor type:
– Motor Control Peripheral clock (16 MHz) with
tachogenerator or Hall sensors
– Encoder Clock
In order to optimize the accuracy of the measure-
ment for a wide speed range, the auto-updated
prescaler functionality is used with slight modifica-
tions compared to Sensor/Sensorless Modes (re-
– When the [MTIM:MTIML] timer value reaches
FFFFh, the prescaler is automatically increment-
ed in order to slow down the counter and avoid
an overflow. To keep consistent values, the
MTIM and MTIML registers are shifted right (di-
vided by two). The RPI bit in the MISR register is
set and an interrupt is generated (if RIM is set).
– When a capture event occurs, if the
[MTIM:MTIML] timer value is below 5500h, the
prescaler is automatically decremented in order
to speed up the counter and keep precision bet-
ter than 0.005% (1/5500h). The MTIM and
MTIML registers are shifted left (multiplied by
two). The RMI bit in the MISR register is set and
an interrupt is generated if RIM is set.
– If the prescaler contents reach the value 0, it can
no longer be automatically decremented, the
[MTIM:MTIML] timer continues working with the
same prescaler value, i.e. with a lower accuracy.
No RMI interrrupt can be generated.
– If the prescaler contents reach the value 15, it
can no longer be automatically incremented.
When the timer reaches the value FFFFh, the
prescaler and all the relevant registers remain
unchanged and no interrupt is generated, the
timer clock is disabled, and its contents stay at
FFFFh. The capture logic block still works, ena-
bling the capture of the maximum timer value.
The only automatically updated registers for the
Speed Sensor Mode are MTIM and MTIML. Ac-
cess to Delay manager registers in Speed Sensor
Figure 103. Auto-updated prescaler functional diagram
Ratio > 0?
Ratio = Ratio - 1
Counter = 0
Begin
End
Yes
No
Capture with [MTIM:MTIML] Timer < 5500h
Ratio < Fh?
Ratio = Ratio + 1
Counter = Counter/2
Begin
End
Yes
No
[MTIM:MTIML] Timer Overflow
Slow-down control
Speed-up control
(MTIM = MTIML = FFh)
(MZREG < 55h)
1