Main Content

Permanent Magnet Synchronous Motor Field-Oriented Control Using Concerto Processors

This example shows how to control the speed of a three-phase Permanent Magnet Synchronous Motor in a closed-loop fashion via Field-Oriented Control using the C28x peripherals and MCB blocks from Motor Control Blockset™ library. For the complete hardware in the loop (HIL) PMSM example, see Field-Oriented Control (FOC) of PMSM Using Hardware-In-The-Loop (HIL) Simulation (Motor Control Blockset).

Required Hardware

This example supports the following hardware configuration:

DRV8312 Configuration:

  • TI® DRV8312 Three-Phase Brushless Motor Control Kit (DRV8312-C2-KIT or DRV8312-69M-KIT) with F28M35x or F28M36x Concerto processor Note: To use the DRV8312 kit with F28M36x, you need an additional hardware for converting 180DIMM of F28M36x to 100 DIMM slot.

  • Three-phase PMSM with optional Hall sensors attached to connector J10 of the DRV8312EVM board

For connections related to the preceding hardware configuration, see Hardware Connections

Note: Match the characteristics of the power supply and the amplifier with the input characteristics of the selected motor.

Available models of this example:


For the model to work on the C28x CPU of Concerto Processor, the ARM core must be running already and all GPIOs necessary for C28x must be allocated to C28x from the ARM Cortex M3 CPU. For more information, see Getting Started with C2000 Microcontroller Blockset for F28M3x Concerto Processors.


The following figure shows the Permanent Magnet Synchronous Motor Field-Oriented Control example model.


This example shows how to use a closed-loop Field-Oriented Control (FOC) algorithm to regulate the speed and torque of a three-phase permanent magnet synchronous motor (PMSM). To run this example, there needs to be an application code running on the ARM Cortex M3 CPU and allocate all GPIOs required for the C28x CPU core. This example uses C28x peripheral blocks from the F28M35x or F28M36x C28x Library blocks from the C2000™ Microcontroller Blockset and MCB blocks from Motor Control Blockset™ library.

The algorithm in this example uses an asynchronous scheduling. The pulse width modulation (PWM) block triggers the ADC conversion. At the end of conversion, the ADC posts an interrupt that triggers the main FOC algorithm.

The model is set up for motors that have the following characteristics:

DRV8312 Configuration:

  • 4 pole pairs

  • Sensorless using sliding mode observer (SMO)

You may need to change the model parameters to match to your specific motor. Match motor voltage and power characteristics to the controller.

A conventional voltage-source inverter drives the motor. The controller algorithm generates six pulse width modulation (PWM) signals using a vector PWM technique for six power switching devices. The inverter measures the current of the two motor input currents (ia and ib) of the motor using two analog-to-digital converters (ADCs) and sends the measurements to the processor.

How to Run the Example with Code Composer Studio v5.5/v6

For More Information on Motor Control kits supported on other C28x Targets, refer to Sensorless Field-Oriented Control of PMSM Using C2000 Processors

  • Default settings are set to execute the code from RAM on C28x Core

  • Press Ctrl+B to build a binary executable from example model.

  • Ctrl+B automatically loads and runs the executable on the target selected.

High power must be applied to the Inverter before running the program. Stopping the program in the middle of its execution with high power on can damage the hardware. Use "Reset" to stop the execution of the program.