MATLAB Examples

Permanent Magnet Synchronous Motor Field-Oriented Control

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 DMC library blocks.

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

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

Available versions of this example:

Contents

Prerequisites

This demo works on the C28x CPU of Concerto Processor expects that ARM core is running already and all GPIOs necessary for C28x are allocated to it from the ARM Cortex M3 CPU. To know more, refer to Getting Started Demos

Model

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

Description

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 and C28x DMC library blocks from the Embedded Coder Support Package for Texas Instruments C2000 Processors.

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)
  • 3 Hall sensors attached to connector J10 of the DRV8312EVM (optional)

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

  • Open the example model that matches your hardware.
  • Open Model Configuration parameters and select the required tool chain under Code Generation pane. Before running the code on the C28x core, make sure that code is running on the ARM Cortex M3 CPU. Refer to Getting Started Demos

For More Information on Motor Control kits supported on other C28x Targets, refer to PMSM Demos Targets PMSM Demos

  • 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.

Summary

This example showed how to control the speed of three-phase Permanent Magnet Synchronous Motors in a closed-loop fashion via Field-Oriented Control using the Concerto processor C28x CPU peripherals and DMC library blocks. Multiple positioning techniques have been studied running on different hardware platforms.