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

Run the Code

  1. Run the code by pressing on the run button, or click RunResume in the Debug tab.
  2. The project should now run, and the values in the graph and watch window should keep updating.
  3. In the Expressions window, set the variables motorVars_M1.flagEnableRunAndIdentify to 1 after systemVars.flagEnableSystem was automatically set to 1 in the watch window.
  4. The project should now run, and the values in the graphs and expressions window should continuously update as shown in Figure 3-30 while using this project. You may want to re-size the windows according to your preference.
  5. In the watch view, the variables motorVars_M1.flagRunIdentAndOnLine should be set to 1 automatically if there are no faults. The ISRCount should be increasing continuously. If the ISRCount is not increasing, ensure that the TEST_ENABLE predefine is defined. If this predefine is not defined, then the ISRCount will not increment in the code.
  6. Check the calibration offsets of the motor driver board. The offset values of the motor phase current sensing values should be equal to approximately half of the ADC scale current and the phase voltage offsets should be equal to approximately 0.5 as shown in Figure 3-30.
  7. If using the graph tool, the variables shown in the graphs are the phase currents for phase u and v. These should be close to 0 in magnitude.
  8. Expand and check the MotorVars_M1.faultMtrPrev.bit structure to ensure that there are no fault flags set.
  9. Using an oscilloscope, probe the PWM outputs that are used for motor drive control. The duty cycles of the three PWMs are set to 50% in this build level. The expected PWM output waveforms are as shown in Figure 3-31. The PWM switching frequency will be the same as the value that was set for the USER_M1_PWM_FREQ_kHz define in the user_mtr1.h file.
  10. Set the motorVars_M1.flagEnableRunAndIdentify variable to 0 to disable the PWMs.
  11. If any of the previous steps provide unexpected results, additional debug will be necessary. A few things to check are:
    1. Ensure that the DRV board is properly set up, with the proper capacitors/resistors populated on the EVM.
    2. Ensure that the motor driver board being used is the same as the board selected in the build configurations (see 1).
    3. Ensure that the proper predefines are set.
    4. Ensure that the switches are configured properly on the C2000 MCU Lunchpad/ControlCARD as described in Section 3.2.
  12. Once the previous steps are complete, the controller can now be halted, and the debug connection terminated. Halt the controller by first clicking the Halt button  on the toolbar or by clicking TargetHalt. Finally, reset the controller by clicking on the button or clicking RunReset→CPU Reset.
  13. Close the CCS debug session by clicking the Terminate Debug Session  button or clicking RunTerminate. This will halt the program and disconnect Code Composer from the MCU.
  14. It is not necessary to terminate the debug session each time the user changes or runs the code again. Instead, the following procedure can be followed. After rebuilding the project, press the button or click RunReset→CPU Reset, and then press the button or click RunRestart. The project must be terminated if the target device or the configuration is changed, and before shutting down CCS.
 Build Level 1: Variables in
                    Expressions Window Figure 3-30 Build Level 1: Variables in Expressions Window

The C2000 PWM with deadband outputs to the input of the gate drive as shown in Figure 3-31

 Build Level 1: PWM Output
                    Waveforms Figure 3-31 Build Level 1: PWM Output Waveforms