SPRAD24 august   2023 AM2631 , AM2632 , AM2632-Q1 , AM2634 , AM2634-Q1

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
    1. 1.1 Key System Specifications
  5. 2AM263x Overview
    1. 2.1 AM263x Control Card and Traction System Framework
  6. 3Guide to Running TIDM-02014 Traction Inverter
    1. 3.1 Software Set-up
      1. 3.1.1 Code Composer Studio Project
      2. 3.1.2 Software Structure
    2. 3.2 Create Real Time Debug Interface
      1. 3.2.1 Confirm CCS Features
      2. 3.2.2 Create Target Configuration File
      3. 3.2.3 Add Serial Command Monitor Software
      4. 3.2.4 Launch Real Time Debug
    3. 3.3 Running the Code
      1. 3.3.1 Project Setup
      2. 3.3.2 Running the Application
    4. 3.4 Get Samples From ADC and Read Samples Through CCS
      1. 3.4.1 Register and Enable Interrupt
      2. 3.4.2 Add Log Code to Read Samples in Graph at Fixed Rate
      3. 3.4.3 Read ADC Samples in Expression and Graph Windows
    5. 3.5 Generate Space Vector PWM and Drive Motor in Open Loop
      1. 3.5.1 Setup SVPWM Generator Inputs
      2. 3.5.2 Read SVPWM Duty Cycles in Graph Window
      3. 3.5.3 Power Up Inverter and Spin Motor in Open Loop
    6. 3.6 Close Current Loop With Mock Speed
      1. 3.6.1 Add Transformations and Read Id-Iq in Open Loop
      2. 3.6.2 Add Controllers to Close Current Loop
      3. 3.6.3 Read Id-Iq to Close Current Loop
    7. 3.7 Add Software Resolver to Digital Converter
      1. 3.7.1 Generate Excitation for Resolver Hardware
      2. 3.7.2 Add Resolver Software
      3. 3.7.3 Read Resolver Software Outputs
  7. 4Brief Guide to Code Migration
    1. 4.1 SDK Resources Overview
    2. 4.2 Code Migration From C28
    3. 4.3 Code Migration From AM24
  8. 5Summary
  9. 6References

Setup SVPWM Generator Inputs

The inputs to SVPWM generator is Vd and Vq. The following lines need to be called for assignment of the values. Motor1 is a structure stored in TCM. More details on its definition can be found in the program files. Couple simple Ctrl + left click on the variable name will help trace the location where is defined. The code shares the same logic as the C28 program for TIDM-02014. Vd and Vq are in real value other than per unit value.

  1. motor1.Vout_dq_V[0] = VdTesting;
  2. motor1.Vout_dq_V[1] = VqTesting;

Motor speed and motor angle are generated by the following lines. Lines 1 to 4 setup ramp controller, rc1, and ramp generator, rg1. SpdRef is per unit value between 0 and 1. The generated omega and theta are assigned to motor1 in lines 5 and 6. Line 7 limits the theta to a range from 0 to TWO_PI. The TWO_PI value is defined in the files. Couple simple "Ctrl + left click" on the variable name will help trace the location where is defined. It is worth attention that rc1, rg1, and motor1 need to be initialized accordingly before starting hardware interrupt.

  1. rc1.TargetValue = SpdRef;
  2. rampControl(&rc1);
  3. rg1.Freq = rc1.SetpointValue;
  4. rampGen(&rg1);
  5. motor1.omega_e = rg1.Freq * BASE_FREQ * TWO_PI;
  6. motor1.theta_e = rg1.Out * TWO_PI;
  7. theta_limiter(&(motor1.theta_e));

The next couple lines are to feed the inputs into SVPWM generator and keep the output in per unit values. Line 1 keeps inputs within limits. Line 2 is inverse park transformation. Similar functions can be found in CMSIS DSP library and others. The angle information is already included in the structure of motor1. Line 3 is SVPWM generator. The logic is the same as C28 program for TIDM-02014. There are other implementations in previous C28 libraries. It is worth attention that there is a real value to per unit value conversion in this version. Line 4 keeps per unit output within limits.

  1. dq_limiter_run(&motor1);
  2. ipark_run(&motor1);
  3. SVGEN_run(&motor1, &pwm1);
  4. PWM_clamp(&pwm1);

After SVPWM generated, the per unit outputs are passed to EPWM Counter Compare by the function in following line 1. Line 2 gives details on setting EPWM0 Counter Compare. EPWM_setCounterCompareValue is the name of SDK API to set Counter Compare value. Here, the value is computed for Up-Down mode or Center-line mode.

  1. TRINV_HAL_setPwmOutput(&pwm1);
  2. EPWM_setCounterCompareValue(CONFIG_EPWM0_BASE_ADDR, EPWM_COUNTER_COMPARE_A,(uint16_t)((pwm->inv_half_prd * pwm->Vabc_pu[0]) +pwm->inv_half_prd));