Give away medical masks when you place an order. learn more

Advanced MCUs Anchor Complex Firmware Stack For Sophisticated Field-Oriented Control Motor Designs

Permanent-magnet synchronous motors (PMSM) offer significant advantages in efficiency, responsiveness, and lifecycle cost savings for demanding motor-control applications. Unlike classical brush-type motors, PMSMs are electronically commutated motors (ECM) that require high-integration microcontrollers capable of executing sophisticated Field-Oriented Control (FOC) algorithms and delivering the precise motor-control signals needed to achieve maximum torque.

By drawing on suitable motor-control software libraries, engineers can more easily exploit the advantages of FOC PMSMs using specialized versions of MCUs from leading MCU vendors including Freescale Semiconductor, Microchip Technology, NXP Semiconductors, STMicroelectronics, and Texas Instruments, among others.

In PMSMs, magnetic fields generated in succession in multiple stator windings spin a permanent-magnet rotor. By maintaining a 90° phase between the magnet field generated from each stator winding and the permanent magnet in the rotor, electronic-commutation control logic can achieve maximum torque in the motor. FOC, also known as vector control, provides a means to maintain this optimum phase relationship between stator and rotor by providing high torque even at low speeds and while responding quickly to dynamically changing loads, such as those in washing machines.

FOC approach

FOC continuously commutates the PMSM with sine waves to deliver high torque with little torque ripple. As a result, FOC-driven PMSMs run with reduced mechanical oscillations, outperforming trapezoidal or even sine-wave-driven brushless DC (BLDC) motors — resulting in quieter appliances. Furthermore, FOC-driven PMSMs are highly efficient, thanks to their use of permanent magnets, making them increasingly attractive as energy costs continue to climb — according to the U.S. Department of Energy, kitchen and laundry appliances account for about one-third of household electricity consumption. At the same time, the availability of sensorless methods for ascertaining rotor position further reduces component and lifecycle costs. This opens door to PMSM applications in more demanding compressor and pump designs, such as household, commercial, and automotive applications where sensors cannot easily be used.

FOC implementation imposes significant processing demands, requiring a firmware architecture that combines chip-specific and motor-control-specific software libraries, correspondingly robust processing horsepower, and appropriate integrated peripheral functionality (see Figure 1). Typically, required on-chip peripheral functionality includes multichannel pulse-width modulation signal outputs, with dead time to avoid shoot-through current in the motor-control power stage, high-speed, high-resolution analog-to-digital converters (ADCs) with precision triggering capabilities for accurate measurement of the three-phase current with minimal MCU loading, and fault handling able to shut down the motor quickly in the event of mechanical problems.

Figure 1: In this representative firmware stack for a Field-Oriented Control architecture, on-chip peripherals complement software routines executed by the device's MCU.

Individual MCU offerings augment these base motor-control capabilities with specialized features designed for broader application requirements and higher performance. For example, Freescale's Cortex-M4 K10 Kinetis MCUs offer dedicated signal-processing features like barrel shifters as well as parallelizing features such as single-cycle, single-instruction/multiple-data (SIMD), and single-cycle multiplier-accumulators (MAC). Microchip's dsPIC33F 16-bit motor control family achieves required performance through its on-chip 40-MIPS digital signal controller core. NXP's LPC17xx and LPC32x0 combine dedicated motor-control PWMs with ARM 32-bit Cortex-M3 and 16/32-bit ARM9 cores, respectively. In each case, MCU suppliers combine specialized, on-chip hardware with specialized software libraries to meet motor-control requirements such as FOC-based designs.

FOC algorithm

The FOC algorithm delivers PMSM advantages by taking three-phase motor signals through a series of transforms designed to translate the three-phase, time-varying motor current measured at the stator into a much simpler two-phase, time-invariant, rotor-centric reference that can be more easily manipulated (see Figure 2).

Figure 2: The Field-Oriented Control algorithm uses a series of signal transforms to achieve electronic commutation in permanent magnet synchronous motors.

In the initial input stage of the FOC algorithm, the MCU uses the Clarke transform to project the three-phase (IA, IB, IC) current vector to a two-phase (Iα,Iβ) vector space, which is still referenced to the stator. The MCU then applies the Park transform to rotate the stator-referenced Iα,Iβ vector by angle Φ to a new two-axes coordinate system with separate flux (Id) and torque (Iq) components aligned with the rotator. Since this new coordinate system remains fixed, with respect to the rotor, it is time-invariant in that reference plane.

The rotation angle Φ needed to align the stator field vector to the rotor coordinate system depends, of course, on the rotor position, which has traditionally been measured through sensors attached to the motor shaft. As mentioned above additional sensors increase BOM costs and degrade motor-system life span, motivating increased interest in sensorless approaches which calculate rotor position by leveraging its known relationship with back EMF. Unlike trapezoidal motors, however, back EMF in FOC designs must be estimated using virtual motor models because all phases are engaged in commutation. Consequently, sensorless FOC designs place additional processing load and require MCUs capable of rapidly returning results of trigonometric functions calculated through table lookup, floating-point arithmetic, or integer methods such as the CORDIC algorithm using barrel shifters.

By moving the three-phase, time-varying vector space to a two-axes time-invariant vector space, the FOC algorithm allows engineers to apply conventional proportional-integral-derivative (PID) controllers, used in dc motors, to calculate new target voltages Vd and Vq. In practice, the slow response time of motor speed changes means that D terms are often not needed in these controllers. Note that the use of a permanent magnet in the rotor means that there is no slip because the rotor flux produced by the rotor rotates at the same speed as the rotor field. Consequently, the reference flux IDREF illustrated in Figure 2 is zero; the torque reference Iqref is set through calibration to meet desired performance targets.

The MCU passes the output from the PI controllers through an Inverse Park Transform to translate the rotor-referenced Vd,Vq values to stator-referenced values. The MCU then passes these results through an Inverse Clarke Transform to produce the required three-phase voltage vector, which is then converted to pulse-width modulation (PWM) signals and delivered to a three-phase power stage that directly drives the PMSM.

Motor-control MCU suppliers simplify firmware development for FOC-based designs with extensive software libraries. For example, STMicroelectronics pairs its STM32F103xx family of MCUs with a complete PMSM FOC library written in C. Similarly, TI's TMS320C2 code libraries include optimized C libraries for Park and Clarke transforms able to complete Park transforms, in as little as 125 cycles.

This series of transforms and control functions presents a substantial processing load which is further exacerbated in sensorless designs. Sensorless FOC logic needs to include special initialization and start-up routines to account for lack of observable current measurement in a motor at rest (see Figure 3). FOC startup routines typically apply preset sine-wave patterns that run the motor up to sufficient speed needed for the MCU-based control system to switch to dynamic sensorless measurements.

Figure 3: Hitting the start or reset button on a sensorless FOC PMSM-based whitegoods application places the motor-control system in specialized states required to properly spin-up the motor to sufficient speeds to permit safe transitions to the sensorless state.