Sie sind auf Seite 1von 4

Cortex-M3 based STM32 MCUs tackles advanced motor control techniques

By Vincent Onde, STMicroelectronics

Three phase brushless motors (either AC induction or permanent magnet synchronous motors)
historically owe their great success in adjustable speed application to the advent of frequency
converters and sophisticated control techniques. These high-performance drives were mainly
used for factory automation and robotics. For the last decade, the significant price decrease of
the electronics bill of material allowed them to be used in cost-sensitive markets such as
household appliances, air conditioning or personal healthcare equipment. We will discuss here
how ARM-based standard devices helped to break the complexity paradigm in a market that
was for long dominated by DSPs and FPGAs. STMicroelectronics’ STM32 product family,
based on the Cortex-M3 core, will be used as the example.

First of all, let’s get back to basics: why is a processor so crucial in a motor control system,
and why do we need astonishing computational performance? After all, Nicolas Tesla did
not need a compiler when he invented the AC motor more than a century ago. As soon as
variable speed is required, one can hardly avoid using an inverter to drive a 3-phase motor
with decent performance. It is not even an option to have a permanent magnet synchronous
motor (PMSM) spinning. The core of this sophisticated power electronics system is a DC
to AC 3-phase converter in which the MCU acts as conductor, handling in a fully digital
way the usual control triptych: sensing (current, speed, angle,…), processing (algorithms,
housekeeping functions,…) and finally controlling power switches, 6 in the minimal
configuration.

The simplest way to achieve variable speed operation for a three-phase AC motor is to
implement a scalar control, where the principle is to maintain a constant ratio between the
frequency and the voltage applied to the motor. This is a very popular control method for
entry-level drives, suitable for applications having well-known load characteristics and
which are not very demanding in terms of control bandwidth (such as fractional horse
power pumps and fans). Unfortunately, not all applications can afford such simple control
and its limitations. In particular, it does not guarantee the optimum motor behavior (torque,
efficiency) during transient operations.… To overcome these limitations, other control
strategies have been developed. The field–oriented (also called vector) control is one of the
most widely used. It allows driving any AC machine (either induction or permanent
magnet based) to be driven in the same way as a separately excited DC machine, with two
decoupled DC current controllers whatever the operating frequency (i.e. speed). The
magnetizing current corresponds to the DC main flux (the magnet’s flux in a PMSM
motor), while a 90° shifted current controls torque just like the armature current does in the
DC motor. Field-oriented control allows precise and responsive speed control when the
load changes, and guarantees optimized efficiency even during transient operation by
maintaining perfectly in quadrature the stator and rotor fluxes. It is the basic theoretical
framework used to implement more sophisticated control techniques, differentiated by
motor topologies. For the PMSM motor in particular, it is the foundation of most sensorless
drives, where it allows significant cost savings (speed or angle sensor(s) and the related
wiring are no more longer necessary), while improving reliability. In this case, the rotor
angular position must be estimated by computational means, using solely the mathematical
model of the motor, the current and voltage values. The state observer theory (among other
techniques) allows achieving Sensorless speed control to be achieved down to few
hundreds of RPMs, and in some case down to standstill. However, it also represents
additional real-time burden for the CPU. Lastly, vector control algorithms must be
continuously recomputed, at a rate of between 1 and 20 kHz -depending on the final
application bandwidth- and do intensively require numerical computations, with Parke
and Clarke transforms, numerous PID controllers, and software PLLs.... This is why digital
signal processors, MPUs or FGPAs where used in the past as controllers.
While proprietary hybrid controller and low-end fixed-point DSP architectures were
emerging, STMicroelectronics based its STM32 MCU family on the Cortex-M3 core. It
fits perfectly the requirements of a vast majority of brushless motor drives, with all the
benefits -from NRE standpoints- of being powered by an industry standard ARM® core,
and the cost effectiveness of a standard MCU.
Based on the Harvard architecture this 32-bit RISC uses the Thumb2 instruction set, which
has 16 and 32-bit instructions. This improves significantly the code density vs. pure 32-bit
code while retaining most of previous ARM7 instruction set benefits (with in additional
optimized Multiply-Accumulate and hardware divide instruction).
Motor control requires a MCU which has very good real-time responsiveness (low
interrupt latency), pure processing capabilities (such as single-cycle multiply) as well as
excellent performances for control (when handling non-sequential execution flow and
conditional branches). The Cortex-M3 fulfills all these points. As a reference, when
clocked at 72MHz, it performs a Sensorless field-oriented control loop for a permanent
magnet motor within less than 25µs, which corresponds to 25% CPU load at 10 kHz
sampling rate.
In the STM32, the core (tightly coupled with ST’s optimized flash memory interface) is
also surrounded by peripherals that can deal with the external world with a minimum
number of additional components (see on Figure 2 shows a block diagram of the
STM32F103 medium density derivative). Needless to say that PWM timers and ADCs are
essentials. The first includes state of the art features such as centered pattern PWM
generation and deadtime insertion logic, with a particular emphasis on safety: it directly
controls the power switches commutation, and potentially up to kWs. For instance, the
registers coding for critical parameters can be locked against software run-away. All I/Os
are also driven with a user programmable safe state as soon an “emergency stop” pin is tied
low. This feature was designed using combinatorial logic to guarantee that the protection
works even in case of main clock (crystal) failure, even before the internal switchover to a
backup oscillator happens. Finally, it also contains a 4th compare channel that can be
devoted to ADC triggering for optimum current measures.

The most sophisticated algorithm will hardly be able to compensate poor analog
measurements and to some extentd the overall drive performance depends on ADC quality.
The STM32F103 devices are embedding up to three 1MSps 12-bit ADC with a Total
Unadjusted Error (TUE) below 5 LSB over the whole temperature and voltage range. The
digital interfaces of the ADCs have three main duties. Firstly, off-load the CPU from
simple control tasks and data manipulations, secondly interface with the rest of the chip
(interrupt and DMA requests, trigger inputs) and finally synchronize the multiple
converters of the STM32. Among the features useful for brushless motor control, let’s
consider first the channel reading sequencer. Compared to classical scan circuitry (where a
given number of channels are converted sequentially, following the analog input
numbering), it offers the possibility ofto having channels converted in any order in a
sequence of up to 16 conversions (such as Ch3, Ch3, Ch0, Ch11): this gives additional
freedom when designing a PCB, allows multiple sampling of the same channel for
averaging purposes (within a single sequence), with an interrupt issued once the full
sequence has been converted and transferred by DMA.
The noise created by the transient voltage on the power switches (typically hundreds of
V/µs in off-line applications) is an important source of errors during the reading of the
current in the motor phases and can lead to measures with very poor signal to noise ratio.
The solution is to synchronize the ADC with the timer controlling the power stage: since
the commutation instant can be anticipated (it is defined by the 3 PWM timer’s compare
registers), the ADC conversion can be triggered slightly before or after this event using an
extra compare channel. For this reason was introduced a second sequencer (so-called
injected) was introduced, which has a higher priority than the regular sequencer and can
interrupt the on-going conversion by a new one which cannot be delayed. Typically, the
regular sequencer will be in charge of “housekeeping” conversions, such as the continuous
temperature or DC bus voltage readings (as background task) and send them in RAM with
the DMA, while the injected sequencer will handle time-critical conversions and store
them in ADC registers (as would an interrupt do, but with an unacceptable delay).
Having a general purpose MCU able to perform advanced motor control is one thing, but
making it easy to start with is another challenge. Two sides of the problem are addressed,
by means of hardware and software tools. The first is a motor control starter kit, which
contains tools (JTAG probe and opto-isolator), MCU plus power stage boards and a
demonstration PMSM motor, for evaluation and development purposes. Its modular form
facilitates upgrades with new demos (such as the dual motor control MCU board) and
evaluation of several (or custom) power stages. Last, STMicroelectronics supplies freely
motor control software libraries to STM32 customers. The release 2.0 supports a wide
variety of configurations, using a simple, yet extensive, list of #define statements in a
header file. Both AC induction and synchronous motor field-oriented control algorithms
are available, coded in C to ease readability and maintenance, and demonstrating again the
efficiency of modern compilers. For the PMSM motor in particular, a robust sensorless
algorithm (based on Luenberger observer) is provided, as well as a dedicated control for
very high-speed internal magnet motor (IPM). Still, the software can also work with usual
speed and position sensors (incremental encoder, Hall sensors or tachogenerator). Three
current sensing methods are supported, using isolated sensors or shunt(s). An original
single-shunt reading technique, made possible by the STM32 peripheral features, allows
performing vector control with the lowest cost configuration (a simple and unique resistor).
It has been patented for its ability to minimize inherent current distortion.
Current developments are focused on PM motor sensorless control able to operate down to
standstill, and on dual motor control combined with Power Factor Correction. This has
recently been demonstrated successfully with a single STM32 performing two vector
controls with single-shunt current sensing, while operating a PFC stage with a 40 kHz
control loop (see Figure 1 for details).
STMicroelectronics is committed ion the long term to support the motor control market,
with its unique products portfolio ranging from discrete power switches to complex
Systems On Chip. The STM32 MCU product line will therefore naturally continue to be
deployed as shown in Figure 3 with four new directions, two of them being suitableed for
motor control. One product line will address lower costs and intends to tackle the low-end
16-bit motor control MCUs. Another one will be performance driven, for applications
requiring higher processing power, bigger memory sizes and high-bandwidth connectivity.
Such a wide scope will definitively establish -together with the Cortex-M3 core- the
versatility of the STM32 architecture for today's and tomorrow' s motor drives.

- End of text -

Figure 1 (possible as eye catcher): The STM32F103HD can handle simultaneously dual
motor control and digital PFC

Figure 2: STM32F103 Medium Density Block diagram

Figure 3: STM32: a strong foundation for growth

Das könnte Ihnen auch gefallen