SPRUJ26A September   2021  – April 2024

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
  5. 2Motor Control Theory
    1. 2.1 Mathematical Model and FOC Structure of PMSM
    2. 2.2 Field Oriented Control of PM Synchronous Motor
    3. 2.3 Sensorless Control of PM Synchronous Motor
      1. 2.3.1 Enhanced Sliding Mode Observer with Phase Locked Loop
        1. 2.3.1.1 Design of ESMO for PMSM
        2. 2.3.1.2 Rotor Position and Speed Estimation With PLL
    4. 2.4 Hardware Prerequisites for Motor Drive
      1. 2.4.1 Motor Phase Voltage Feedback
    5. 2.5 Additional Control Features
      1. 2.5.1 Field Weakening (FW) and Maximum Torque Per Ampere (MTPA) Control
      2. 2.5.2 Flying Start
  6. 3Running the Universal Lab on TI Hardware Kits
    1. 3.1 Supported TI Motor Evaluation Kits
    2. 3.2 Hardware Board Setup
      1. 3.2.1  LAUNCHXL-F280025C Setup
      2. 3.2.2  LAUNCHXL-F280039C Setup
      3. 3.2.3  LAUNCHXL-F2800137 Setup
      4. 3.2.4  TMDSCNCD280025C Setup
      5. 3.2.5  TMDSCNCD280039C Setup
      6. 3.2.6  TMDSCNCD2800137 Setup
      7. 3.2.7  TMDSADAP180TO100 Setup
      8. 3.2.8  DRV8329AEVM Setup
      9. 3.2.9  BOOSTXL-DRV8323RH Setup
      10. 3.2.10 BOOSTXL-DRV8323RS Setup
      11. 3.2.11 DRV8353RS-EVM Setup
      12. 3.2.12 BOOSTXL-3PHGANINV Setup
      13. 3.2.13 DRV8316REVM Setup
      14. 3.2.14 TMDSHVMTRINSPIN Setup
      15.      34
      16.      35
    3. 3.3 Lab Software Implementation
      1. 3.3.1 Importing and Configuring Project
      2.      38
      3.      39
      4. 3.3.2 Lab Project Structure
      5. 3.3.3 Lab Software Overview
    4. 3.4 Monitoring Feedback or Control Variables
      1. 3.4.1 Using DATALOG Function
      2. 3.4.2 Using PWMDAC Function
      3. 3.4.3 Using External DAC Board
    5. 3.5 Running the Project Incrementally Using Different Build Levels
      1. 3.5.1 Level 1 Incremental Build
        1. 3.5.1.1 Build and Load Project
        2. 3.5.1.2 Setup Debug Environment Windows
        3. 3.5.1.3 Run the Code
      2. 3.5.2 Level 2 Incremental Build
        1. 3.5.2.1 Build and Load Project
        2. 3.5.2.2 Setup Debug Environment Windows
        3. 3.5.2.3 Run the Code
      3. 3.5.3 Level 3 Incremental Build
        1. 3.5.3.1 Build and Load Project
        2. 3.5.3.2 Setup Debug Environment Windows
        3. 3.5.3.3 Run the Code
      4. 3.5.4 Level 4 Incremental Build
        1. 3.5.4.1 Build and Load Project
        2. 3.5.4.2 Setup Debug Environment Windows
        3. 3.5.4.3 Run the Code
  7. 4Building a Custom Board
    1. 4.1 Building a New Custom Board
      1. 4.1.1 Hardware Setup
      2. 4.1.2 Migrating Reference Code to a Custom Board
        1. 4.1.2.1 Setting Hardware Board Parameters
        2. 4.1.2.2 Modifying Motor Control Parameters
        3. 4.1.2.3 Changing Pin Assignment
        4. 4.1.2.4 Configuring the PWM Module
        5. 4.1.2.5 Configuring the ADC Module
        6. 4.1.2.6 Configuring the CMPSS Module
        7. 4.1.2.7 Configuring Fault Protection Function
      3. 4.1.3 Adding Additional Functionality to Motor Control Project
        1. 4.1.3.1 Adding Push Buttons Functionality
        2. 4.1.3.2 Adding Potentiometer Read Functionality
        3. 4.1.3.3 Adding CAN Functionality
    2. 4.2 Supporting New BLDC Motor Driver Board
    3. 4.3 Porting Reference Code to New C2000 MCU
  8.   A Appendix A. Motor Control Parameters
  9.   References
  10.   Revision History

Lab Software Overview

Figure 3-22 shows the project software flow diagram of the firmware that includes one ISR for real time motor control and the main loop for motor control parameters that updates in a background loop. The ISR will be triggered by ADC End of Conversion (EOC).

 Project Software Flowchart DiagramFigure 3-22 Project Software Flowchart Diagram

To simplify the system bring up and design, the software is organized in four incremental builds, which makes learning and getting familiar with the board and software easier. This approach is also good for debugging and testing boards.

Table 3-5 lists the framework modules to be used in this lab project.

Table 3-5 Using Motor Control Modules in Lab Project
Module NamesExplanationAlgorithm
ANGLE_GEN_runRamp angle generator for open-loop runningeSMO, ENC, HALL
CLARKE_runClarke transformation for current or voltageFAST, eSMO, ENC, HALL
collectRMSData, calculateRMSDataCollect sampling values to calculate the RMS value of phase current and voltageFAST, eSMO, ENC, HALL
DAC128S_writeDataConverts and send software variables to external DAC with SPIAll Algorithms
DATALOGIF_updateStores the real-time values into for displaying with graph toolAll Algorithms
ENC_runCalculate rotor angle based on encoderENC
ESMO_runEnhance Sliding Mode Observer (eSMO) for sensorless-FOCeSMO
EST_runFAST estimator for sensorless-FOCFAST
EST_runTrajTrajectory generator for current and speed for motor identificationFAST
EST_setupTrajStateTrajectory generator setup for current and speed for motor identificationFAST
HAL_readADCDataReturns ADC conversion values with floating-point formatAll Algorithms
HAL_writePWMDACDataConverts software variables into the PWM signalsAll Algorithms
HAL_writePWMDataPWM drives for motorAll Algorithms
HALL_runCalculate rotor angle ans speed based on Hall sensorsHALL
IPARK_runInverse Park transformationFAST, eSMO, ENC, HALL
PARK_runPark TransformationFAST, eSMO, ENC, HALL
PI_runPI Regulators for current and speedAll Algorithms
SPDCALC_runSpeed Measurement based on the angle from encoder signalENC
SPDFR_runSpeed measurement based on the angle from observereSMO
SVGEN_runSpace Vector PWM with quadrature controlFAST, eSMO, ENC, HALL
TRAJ_runTrajectory for setting speed referenceAll Algorithms
VS_FREQ_runGenerate vector voltage with v/f profileFAST, eSMO, ENC, HALL

Table 3-6 summarizes the modules tested in each incremental system build.

Table 3-6 Motor Control Modules Used per Incremental Build
Software ModuleDMC_LEVEL_1DMC_LEVEL_2DMC_LEVEL_3DMC_LEVEL_4
50% PWM duty, verify ADC offset calibration, PWM output, and phase shiftOpen loop control to verify the motor current and voltage sensing signalsClosed current loop to validate the current

sensing on the board and the current control with the PID

Closed-loop run with estimators/observersMotor parameters identify with FAST estimators
HAL_readADCData√√1
HAL_writePWMData√√
ANGLE_GEN_run√√√(eSMO, ENC, HALL)*
VS_FREQ_run√√
CLARKE_run (current)
CLARKE_run (voltage)√ (FAST)* 2√ (FAST)*√ (FAST)*
TRAJ_run√√√√
EST_run√(FAST)*√ (FAST)*√√ (FAST)*√√ (FAST)*
EST_setupTrajState√√ (FAST)*
EST_runTraj√√ (FAST)*
ESMO_run√(eSMO)*√(eSMO)*√√ (eSMO)*
SPDFR_run√(eSMO)*√(eSMO)*√√ (eSMO)*
ENC_run√(ENC)*√(ENC)*√√(ENC)*
SPDCALC_run√(ENC)*√(ENC)*√√(ENC)*
HALL_run√(HALL)*√(HALL)*√√(HALL)*
PARK_run
PI_run (Id)√√
PI_run (Iq)√√
PI_run (speed)√√
IPARK_run√√
SVGEN_run√√
HAL_writePWMDACData√** 3√**√**√**
DATALOGIF_update
DAC128S_writeData√**√**√**√**
  1. √ means this module is used. √√ means this module is being tested.
  2. √(FAST)* means this module is only used by FAST. √ (eSMO)* means this module is only used by eSMO. √ (ENC)* means this module is only used by ENC. √ (HALL)* means this module is only used by HALL.
  3. √** means this module is supported by some hardware kit as shown in Table 3-1.

The universal lab project can use one of the FOC algorithms separately for motor control, or use two of the FOC algorithms simultaneously as shown in Table 3-7. The estimator in use can be switched smoothly on the fly if two algorithms are implemented in the lab project.

Table 3-7 Supporting Estimator Algorithms in Lab Project
FAST(MOTOR1_FAST)eSMO (MOTOR1_ESMO)ENCODER (MOTOR1_ENC)HALL (MOTOR1_HALL)ISBLDC
(MOTOR1_ISBLDC)
FAST1
eSMO
ENCODER
HALL
ISBLDC

  1. √ means these two algorithms can be used simultaneously in project. ✕ means these two algorithms can not be used simultaneously in project.