will yield a positive or negative error
depending on whether the actual
speed is higher or lower than the
set reference. This error is fed to
the PI controller, which is a firmware
algorithm that calculates a value
that compensates for the variation
in speed. This compensating value
will add to or subtract from the
initial PWM duty cycle to produce a
new value.
Conclusion
In cost-sensitive motor control
applications, an efficient and
flexible microcontroller can have
significant impact. Device efficiency
can be measured against the
level of integrated peripherals to
optimise the control task along with
the number of pins and memory
and the size of the package.
Additionally, ease of use and time
to market are important especially if
variants of the design are required.
This article has shown how a low-
cost microcontroller can meet these
requirements and let the driver set
the desired speed reference, predict
the rotor position, implement a
control algorithm, measure the
actual speed of the motor and
impose fault detection.
the motor to stall and the winding
to take the full current. Thus, to
protect the motor, fault detection
for over current and stalling must
be implemented.
To
implement
over-current
detection, Rshunt is added to
the drive circuitry, which gives
a voltage corresponding to the
current flowing in the motor
winding. The voltage drop across
the resistor varies linearly with
respect to the motor current. This
voltage is fed to the inverting input
of the comparator and compared
with a reference voltage based on
the product of Rshunt resistance
and the maximum allowable stall
current of the motor.
The reference voltage can be
provided by the FVR and can be
narrowed down further by the DAC.
This allows a very small reference
voltage to be used, which lets the
resistance be kept low thus reducing
power dissipation from Rshunt. If
the Rshunt voltage exceeds the
reference, the comparator output
triggers the auto-shutdown feature
of the CWG, the output of which
will remain inactive as long as the
fault exists.
Over temperature can be detected
using the device’s on-chip
temperature indicator, which can
measure temperatures between
-40 and +85˚C. The indicator’s
internal circuit produces a variable
voltage relative to temperature
and this voltage is converted to
digital by the ADC. For a more
accurate temperature indicator,
a single-point calibration can be
implemented.
Outer loop
The outer loop shown in Fig. 2
controls the motor’s speed under
varying conditions such as changes
in load demand, disturbances and
temperature drift. The speed is
measured by the SMT, which is a
24bit counter-timer with clock and
gating logic that can be configured
for measuring various digital signal
parameters such as pulse width,
frequency, duty cycle and the time
difference between edges on two
input signals.
Measuring the motor’s output
frequency can be done through
the SMT’s period and duty cycle
acquisition mode. In this mode,
either the duty cycle or period of
the SMT signal can be acquired
relative to the SMT clock. The SMT
counts the number of SMT clocks
present in a single period of motor
rotation and stores the result in the
captured period register. Using this
register allows the actual frequency
of the motor to be obtained.
When the speed reference is
compared with the actual speed, it
Read To Lead
www. new- techeurope . com
New-Tech Magazine Europe l 37




