Digital Motor Control Methodology for C2000™ Real-Time Control Microcontrollers

By Bilal Akin, Chris Clearman

Contributed By Convergence Promotions LLC

Confused about what type of motor to use in your next application? This article explains the advantages and disadvantages of each type of motor, how to control them, and in which applications they make the most sense.

With the microcontroller (MCU) revolution, motor control has evolved far beyond the common universal motor controlled using simple commutation. Today, a wide variety of low-cost MCUs are available that enable developers to create high-performance systems in a cost-effective manner. Specifically, by using more complex control algorithms systems can provide better acceleration, more accurate speed/position control, higher torque, better power efficiency, and higher precision, while substantially reducing system cost through integration of functionality into both hardware and software.

Choosing from the myriad of options available can be confusing, given the varied motor types and different control techniques. To maximize performance and efficiency while managing cost requires that developers have a broad selection of controllers from which to select the optimal architecture for their application, but that also means developers need to easily understand the advantages and disadvantages of each configuration.

TI simplifies this process for developers by offering the TMS320C2000™ platform of MCUs, which offers one of the broadest ranges of devices covering virtually every price point and supporting virtually every type of motor and control technique. With C2000 MCUs, developers can implement greater efficiency with higher performance in a cost-effective manner. In addition, because these MCUs are code compatible across the entire platform, developers can leverage long-term code investment and reuse across motor control designs to achieve significant cost savings and application stability.

High-performance motors

Universal, brushed DC and stepper motors comprise the majority of motor applications given their low cost and simplicity of control. For a wide variety of applications, however, improving performance and efficiency through more complex control mechanisms introduces enough value to justify any added design and component costs. For example, designers developing applications requiring precision variable speed velocity or position control, greater power efficiency and longer motor life will want to consider more complex – and more intelligent – types of motor control, including three-phase AC Induction (ACI), Brushless DC (BLDC), and Permanent Magnet Synchronous Motors (PMSM).

ACI, one of the most robust types of motors, is well-suited for a wide range of high-performance applications, including white goods, pumps, fans, and compressors (for refrigerators and HVAC systems). In an ACI motor, the flux of an internal stator is controlled by varying current to it, which in turn induces rotor flux (ACI motors do not contain magnets).

Torque is determined by the angle between the rotor and stator fluxes. ACI is an asynchronous type of motor, as the internal rotor and stator field vector rotates at different speeds. ACI offers excellent speed and torque control, and its key advantages are low cost and high efficiency when operated at high speeds. The primary disadvantage of ACI is that complex feedback and control mechanisms are required to maintain high efficiency, particularly across variable and lower speeds.

In contrast, BLDC and PMSM are synchronous motors. The stator flux is controlled by varying the current, but the rotor flux is held constant by permanent magnets or current fed coils. The angle between rotor and stator fluxes still determines the amount of generated torque, and the rotor rotation is at the same frequency as the stator field. With synchronous motors, the rotor position should be measured or estimated in order to achieve synchronization and high-performance control. Thus, synchronous motors can be used to control position with a great deal of accuracy.


Figure 1: Using more states to control position increases positioning precision and algorithmic complexity.

BLDC and PMSM differ in the number of states they use to control position. A trapezoidal BLDC motor, for example, has six states compared to the "continuous" states of a sinusoidal PMSM (see Figure 1). The more states supported, the more precisely position can be controlled. However, more states require more complex control mechanisms and processing as well.

BLDC provides efficient, reliable operation, medium-high torque and can be used in combustible environments for applications such as automation, traction, precision, and white goods. A key advantage of these types of motors is that they have no brushes, eliminating a primary source of wear, maintenance, and EMI. In addition, they use magnets, giving them higher power density and greater efficiency.

Technological advancements continue to bring BLDC technology to a wider range of low-cost applications traditionally served by standard DC brush motors, making it one of the fastest growing types of motors. While BLDC has been relatively more expensive than standard DC brush motors, BLDC is attractive in those applications where lower wear and maintenance play a major role in overall total cost of ownership. BLDC is also replacing ACI in applications that require low or variable speed operation, such as blower motors in HVAC systems that can adjust their speed to run more efficiently.

In addition to providing better performance at variable speeds than ACI, BLDC motors are smaller and more efficient for an equivalent cost. Driving BLDC motors through commutation is fairly simple, resulting in savings in motor design, electronic controls, and lighter overall weight. Because of the inherent flux in the magnets, less current is required to drive the motor, leading to better efficiency for BLDC motors.

While BLDC motors have historically been used in many position-control applications, PMSM are used in those applications requiring precise position control, very high speed, and/or high torque. Common applications include traction control, precision automation (robotics), and hybrid/electrical vehicles. PMSM offers higher efficiency and torque, has minimal torque ripple at commutation, offers a higher maximum achievable speed, works with low-cost distributed windings, and has low noise. Because PMSM is based on continuous sinusoidal control, less noise is observed during operation, leading to the ability to react to load changes more quickly and precisely hit required torque, speed, and position.

Control methods

For ACI motors, simple scalar control (also referred to as V/f or Volts per Hertz) is popular given the low electronics cost associated with the simple control techniques. Scalar control adjusts motor speed by simply increasing or decreasing the frequency of the sine waves used to drive the motor, with no regard for control of current or torque optimization. Scalar control tends to have poor dynamic performance, with the motor reacting slowly to changes as well as overshooting the set point. Also, torque delivery is inefficient at low and high speeds. In addition, at low speeds, internal losses result in a large portion of energy being wasted. There is much room left for improvement in terms of performance and efficiency if more complex control methods are employed.

Field-oriented control (FOC), also known as vector control, can be used for ACI and PMSM motors and provides optimum control over the full torque and speed ranges (see Table 1). This allows for maximum torque at any speed, resulting in higher efficiency than scalar control. Starting torque is also increased while torque ripple is minimized. FOC responds faster to changes in the set point or load change, and the minimum speed at full load is essentially zero, allowing for good performance across the speed range of the motor. Because FOC is current controlled, the power inverter circuitry can be optimized. All of these factors reduce cost, allowing developers to size the motor for the task at hand. The trade-off is that implementing FOC is more complex, requiring measurement of the angle between the rotor and stator as well as independent control of flux and torque in real-time.

Typical performance comparison between control types Volts per Hertz control Field-oriented control
Velocity loop bandwidth in Hz 1 Hz 100 Hz
Minimum speed with full load (RPM) 90 0
Maximum speed with 25% load (RPM) 1.5x base speed 2x base speed
Minimum acceleration time (seconds) 3 0.01
Minimum deceleration time (seconds) 3 0.01
Maximum starting torque (%) 150% 200%
Speed regulation at full load (%) ±3% (base) ±0.01% (set)

Table 1: FOC provides full control over the full torque and speed ranges while responding faster to changes in the set point or load change.

There are several common ways to create a feedback loop for measuring angle and speed. In general, these measurements can be made using sensors or done sensorlessly. Sensors add cost and components to a system, but are often required in high-precision systems. Alternatively, sensorless implementations require software and processing resources to model the motor while using real-time current and voltage measurements to estimate angle and speed. Once the angle and speed have been measured or estimated, the feedback loop is regulated to control speed, position/angle, current, flux, and torque.

When using an ACI motor, developers can make a direct measurement by using a tachometer that produces a square wave output proportional to the speed. For a PMSM motor, developers can use an encoder or resolver to track position and calculate speed by measuring change in position over time. A sensorless approach for both uses the DC bus voltage and two of the three-phase currents to determine the phase angle through mathematical transform and calculation and estimates the speed and flux by modeling the specific ACI and PMSM motors using state observers like Sliding Mode, MRAS, and so on.

For BLDC, developers have the choice between trapezoidal and sinusoidal control methods. Trapezoidal control has traditionally been the more common method due to lower cost, simpler controllers. Sinusoidal control, however, offers smoother operation with better torque response and lower electrical noise. Lower electrical noise is important because electromagnetic interference (EMI) can affect motor circuits and input instability into the system which significantly reduces performance and can add intrusive audible noise.

Trapezoidal control also has torque ripple at commutations, is more difficult to control at high speeds, and doesn't work with distributed windings. Continued integration and price reductions along the C2000™ platform narrow the cost barrier of using higher performance MCUs, making it feasible to implement sinusoidal control in applications where OEMs need to differentiate themselves through more precise control and/or better efficiency.

With either trapezoidal or sinusoidal control, a feedback loop is required to control position, speed and, for torque reasons, current. Speed and position can either be measured with a sensor, or can be calculated by monitoring the back EMF voltages of the three phases to count the sequence of states or revolutions (position), and then speed is simply the rate of position change of over time. While there are many different ways to measure current, the most popular method for reasons of cost and reliability is to use a single DC shunt. A variety of motor control system solutions from TI can be found at

C2000 MCUs meet diverse motor control design requirements

TI's strategy is to provide C2000 MCUs as a common platform to control all motor types across the wide range of control techniques. C2000 offers the Piccolo™ family from under U.S. $2 up to 300 MHz floating-point Delfino™ family to serve in every motor application. Further, by providing a common hardware and development platform, developers can scale designs without limit, enabling reuse of software from simple motor applications up to high-end, high-precision applications.

Offering DSP capabilities within an MCU architecture, C2000 devices provide from 40 to 300 MHz performance complemented by an array of hardware-based features to accelerate code execution, including built-in DSP functions, single-cycle 32x32-bit MAC, and an 8-stage protected pipeline to enable the highest clock speeds. Optional CPU features include a floating-point unit for additional precision or a Control Law Accelerator for parallel processing and off-loading of an entire closed-loop FOC system. Although optimized to quickly execute 32-bit math-based operations, the C2000 architecture also efficiently processes general-purpose code, enabling a single C2000 MCU to manage an entire motor control system.

Fine-tuned for real-time control applications, C2000 MCUs offer a flexible interrupt system with fast responsiveness and non-intrusive real-time debugging capabilities built into silicon. One of the challenges particular to motor-control systems is that they must be debugged while running; halting the MCU at a breakpoint would cause the MCU to also break the feedback loop and stop driving the motor. While developers can implement a debug monitor to execute in parallel to the primary motor-control application, typically such code is removed when product is shipped. As a consequence, developers cannot debug systems in-field.

C2000 MCUs simplify real-time debugging with integrated Real-Time Data Exchange (RTDX™) circuitry which gives developers direct access to internal MCU resources. Specifically, developers can halt non-critical code and access memory and registers while real-time interrupts continue to be serviced. Because the RTDX is implemented in silicon, no CPU cycles are required, thus providing completely non-intrusive visibility into the system. In addition, RTDX functionality is always available, allowing debugging on customer returns or systems still in the field.

The C2000 platform also provides developers with a comprehensive selection of control-oriented peripherals, including best-in-class ADC performance and precision, multiple high-resolution PWMs with flexible configurability, integrated sensor interfaces, and all of the important industrial interfaces, including CAN, LIN, SPI, I²C, and UART. These are discussed in more detail later in this article.

C2000 Piccolo MCU family

The C2000 Piccolo MCU family brings real-time control to cost-sensitive applications. Piccolo MCUs are code-compatible across the C2000 platform and offer intelligent peripherals optimized for control applications with increased on-chip analog integration, including:
  • Hybrid ADCs allowing flexible start of conversion and continuous sampling up to 5 MSPS.
  • High-resolution PWMs with frequency and duty cycle modulation up to 150 ps.
  • On-chip voltage supervisor with POR/BOR eliminates external supervisor and has in built-in features to eliminate start-up glitches on all PWM pins.
  • Three-tier clock protection for IEC-60730.
    • Two internal and optional external oscillators.
    • Two watchdogs and clock-fail detection circuitry automatically switches to back-up OSC.
    • If both internal fail device automatically goes into limp mode with graceful shutdown.
  • GPIOs include internal digital filter which reduces noise and saves external system cost.
C2000 Delfino MCU family

The C2000 Delfino MCU family brings floating-point processing to real-time control applications. Delfino MCUs are code-compatible across the C2000 platform and offer intelligent peripherals optimized for control applications with the highest performance processing engine:
  • 32-bit single-precision floating-point with throughput of 200 to 600 MFLOPS.
  • Single code-compatible source with fixed-point devices through IQMath.
  • Optional on-chip dual sample and hold 12-bit ADCs with up to 12.5 MSPS.
  • High-resolution PWMs with frequency and duty-cycle modulation as good as 55 ps.
  • On-chip reprogrammable Flash memory or up to half a megabyte of on-chip RAM.
  • Up to 24 PWM outputs, 88 GPIO in up to 256-pin packaging.
  • DMA, external memory interface, dual CAN, and multiple serial interfaces.
Simplified design through controlSUITE™ DMC systems

controlSUITE for C2000 MCUs is a cohesive software suite designed to minimize development time. It includes device drivers, APIs, utilities, and libraries that are used to build technology examples and system frameworks that are demonstrated on open source hardware using TI's professional debug tools. A key component of controlSUITE is the Digital Motor Control (DMC) library and resulting system examples.

The DMC library is composed of functions represented as blocks. These blocks are categorized as Transforms & Estimators (Clarke, Park, Sliding Mode Observer, Phase Voltage Calculation, and Resolver, Flux, and Speed Calculators, and Estimators), Control (Signal Generation, PID, BEMF Commutation, Space Vector Generation), and Peripheral Drivers (PWM abstraction for multiple topologies and techniques, ADC drivers, and motor-sensor interfaces). Each block is a modular software macro with variable inputs and outputs and is separately documented with source code, use, and technical theory.

TI then used the DMC Library to build up complete system examples. At initialization all DMC library variables are defined and outputs of one block are set as inputs to the next. At run-time the macro functions are called in order. Each system is built using our Incremental Build approach, which allows an incremental section of code to be built so that the developer can verify each section of their application one step at a time. This is critical in real-time control applications with so many different variables that may affect the system, and so many unique challenges across motor parameters.

As an example (see Figure 2), in the sensorless PMSM FOC system the following incremental builds are built into the software. Figure 2 shows the first step in an incremental build of a dual sensorless FOC PMSM system. At this point, developers can verify target-independent modules, duty cycles, and PWM updating. The motors are disconnected at this level so as to prevent the accidental blowing out of a motor before the PWM has been verified. Build Level 1: Using a dummy signal, verify Inverse Park, Space Vector and PWM driver are producing correct waveforms. Level 2: Verify ADC conversion, Phase Voltage calculation, Clarke and Park transforms. Level 3: Closed loop PID current control verification. Level 4: Sliding Mode Observer and Speed Estimator verification. Level 5: Closed-loop PID speed control.

Build Level 1

Build Level 5

Figure 2: Build Level 1: Using a dummy signal to verify waveforms; Build Level 5: Closed-loop PID speed control.

Systems are verified on available hardware platforms. DMC hardware platforms are all built using a base power stage controlled from a modular controlCARD. A controlCARD is a standardized DIMM footprint-based card that allows you to plug in different versions of C2000 devices into varying motherboards. The latest DMC hardware platforms include a low-voltage (36 V) dual-axis with digital power factor correction that supports FOC (PMSM) and sinusoidal (BLDC) as well as a high-voltage (350 V) single-axis with digital power factor correction that supports FOC (ACI, PMSM) and sinusoidal or trapezoidal (BLDC). All systems include electrically isolated JTAG for debug and come with a start-up GUI, a free copy of the Code Composer Studio™ integrated development environment, complete working incremental build software, step-by-step user's guide, documented control theory, screen shots, hardware hook-ups, and debug tips. All hardware is open source, ready for developers to insert into their design and includes Gerber files, schematics, and BOM. TI also simplifies complex algorithm design with its powerful IQMath library which allows you to select your numeric range and resolution by choosing which bits of your binary represented number are integer (I) and which are the quotient (Q). When using a fixed-point MCU, developers become responsible for managing decimal points. At times, it may be necessary to move the decimal point to adjust range. For example, if the range is too small, numbers can be saturated (i.e., 10 can look the same as 10,000). Likewise, if the range is too big, the steps in resolution are too large and precision is lost. By abstracting management of the decimal point and allowing code to be written using floating-point conventions, developers can change scale and resolution at any time, thus making writing complex algorithmic code much easier, as the libraries take care of the rest of the work. This facilitates code reuse as well as "up and down code mobility" by simplifying the migration process to move code from one system/MCU to another, even when moving from fixed-point to floating-point MCUs. Developers can also tune – and re-tune after migration – systems for the best resolution and dynamic range, eliminating saturation and quantization effects. In addition, most DMC library blocks are IQMath-based, allowing each block to be tuned to the specific application.

TI has also worked extensively with its third parties to allow developers to further abstract their motor control design. With simulation, graphical development, and code generation tools such as MathWorks' Embedded Target and Visual Solutions' VisSim, developers can create motor control systems at a more intuitive level, and then have the tool generate, download and run the code on a C2000 DMC Hardware Kit.

Extended processing capability for advanced functionality

To implement the more complex algorithms required that increase efficiency and performance in motor-control applications requires the ability for the MCU to perform complex math operations. By accelerating math calculations, C2000 devices not only yield more precise motor control, they can perform these calculations quickly, leaving significant processing headroom available for other functions. Developers can exploit this added headroom in a number of ways that speed time-to-market and reduce system cost. For example, rather than have to create streamlined systems with little to no reusability, headroom allows developers to simplify designs by taking a modular approach that allows code to be carried over to other motor control applications.

Headroom also enables developers to introduce advanced features such as power factor correction (PFC). PFC increases power efficiency and prevents the losses incurred through the distortion caused by harmonic currents. PFC is being mandated in many regions and has become an integral part of most power supply designs. It is usually implemented with a dedicated PFC chip or a secondary MCU, but with the C2000 platform, PFC can be integrated directly onto the main MCU, resulting in board space and cost savings. The wide offering of C2000 devices enables developers to select a MCU with the optimal capacity to implement an entire motion control system with PFC and motion profiling all on a single chip.

Enhanced peripheral integration for design simplicity and reduced system cost

The extensive mix of C2000 peripherals integrate key functionality into systems, providing significant cost savings and board size reduction by eliminating the need for external components. Many of these peripherals also increase system precision and performance while off-loading the main CPU so that it can be freed to perform more advanced motor-control processing. Some of the more important C2000 peripherals include:
  • High-resolution and synchronized ADCs: One of the most critical considerations when implementing high-performance motor-control techniques is a system's ability to accurately read the current being drawn by the motors. The precision of sensorless systems is directly dependent upon accurate current measurements, and even sensor-based systems may need to measure current to control torque.

    Accurate current measurements require not only an accurate reading (i.e., resolution) but that the reading was done at a specific time. Advanced control techniques often have a short window in which a feedback sample must be acquired. As a result, precise timing has two parts: the ADC must be closely synchronized to PWM events and samples must be taken quickly. Sample latency can arise from context switching and both ADC latency and interrupt latency. To provide the best accuracy possible, C2000 devices offer a range of high-resolution ADCs to meet application requirements. In addition, TI's Piccolo family supports just-in-time (early) interrupts to synchronize an available ADC result with the CPU fetch, further improving system accuracy. All C2000 devices include a 12-bit, dual sample and hold, high-speed architecture (up to 12.5 MSPS) to enable the most demanding sampling techniques.

  • Feature-rich, hardware-based PWMs: Given the essential role played by pulse width modulators (PWM) in motor-control applications, TI has designed hardware-based PWM modules with a variety of enhanced features optimized for performance and efficiency. C2000 devices have between four and nine PWM modules with two PWM outputs each, enabling developers to support a wide range of switching topologies. Each module has its own 16-bit shadowed timer which can operate independently, synchronized, or phase delayed for the utmost in flexibility. The timer can run in up, down, or up-down mode to a programmed period. Waveforms are generated by taking action (PWM high, low, toggle, nothing) at events (zero, period, and two/four programmable compare values). This gives complete waveform generation flexibility. The PWM modules also support an optional programmable dead band on both the rising and falling edge.

    Synchronization with power stage switching is an important feature in a motor-control design, especially with the desire to sample currents during times when the PWMs are not switching so that you can get an accurate reading from the system and avoid system noise. Every event from the PWM time-base can be used as a CPU interrupt or signal a start of conversion to the ADC, allowing the ultimate flexibility in event synchronization.

    All C2000 MCUs offer a unique fault management system using dedicated Trip Zone pins. Each Trip Zone pin can be mapped to a programmable set of actions that are taken if a fault occurs. Actions can include setting PWM outputs, interrupting the CPU, starting an ADC conversion, or synchronizing PWM modules. Trips can be synchronous or asynchronous, can be blocked for an off-set or window, run in continuous or one-shot mode, and automatically record the timer value on faults. The most important feature is that the Trip Zone logic continues to work even if the MCU clocks go missing and there is a serious system issue. This can help protect expensive power stage circuitry.

  • CAP/QEP interfaces: For motor-control systems based on sensors, integrating CAP and QEP sensor interfaces can both simplify design and reduce cost. The sensor interfaces integrated into C2000 MCUs are built to work across different types of sensors with built in 32-bit hardware for capturing an absolute time or a delta time, in continuous or one-shot modes. This allows the interfaces to run in the background without requiring constant management from the CPU.

  • Enhanced Controller Area Network (eCAN): CAN is used for serial communications between controllers in electrically noisy environments. The eCAN interface on C2000 MCUs provides efficient distributed real-time control with data rates up to 1 Mbps, 32 fully configurable mailboxes, 32-bit time-stamping, and programmable wake-up for low-power operation.
TI understands the complex trade-offs involved in designing high-performance motor-control systems. With C2000 MCUs, TI offers a common platform that supports all motor types and control techniques, enabling developers to achieve the highest precision and accuracy at the lowest cost. Comprehensive development tools enable developers to custom tune hardware and software to specific motors while abstracting the complexity of control algorithms with the controlSUITE DMC Library and System while facilitating reuse through modular design and C programming. The high level of integration of the C2000 platform optimizes overall performance while lowering system cost by integrating complete system functionality on a single chip. Finally, OEMs will experience fast return on investment through system cost optimization, long-term software and tools compatibility, and the ability of developers to leverage the expansive C2000 portfolio across all their motor control applications.

Convergence Logo

Disclaimer: The opinions, beliefs, and viewpoints expressed by the various authors and/or forum participants on this website do not necessarily reflect the opinions, beliefs, and viewpoints of Digi-Key Corporation or official policies of Digi-Key Corporation.