SPRACO3 October   2019 INA240 , LMG5200 , TMS320F280021 , TMS320F280021-Q1 , TMS320F280023 , TMS320F280023-Q1 , TMS320F280023C , TMS320F280025 , TMS320F280025-Q1 , TMS320F280025C , TMS320F280025C-Q1 , TMS320F280040-Q1 , TMS320F280040C-Q1 , TMS320F280041 , TMS320F280041-Q1 , TMS320F280041C , TMS320F280041C-Q1 , TMS320F280045 , TMS320F280048-Q1 , TMS320F280048C-Q1 , TMS320F280049 , TMS320F280049-Q1 , TMS320F280049C , TMS320F280049C-Q1 , TMS320F28374D , TMS320F28374S , TMS320F28375D , TMS320F28375S , TMS320F28375S-Q1 , TMS320F28376D , TMS320F28376S , TMS320F28377D , TMS320F28377D-EP , TMS320F28377D-Q1 , TMS320F28377S , TMS320F28377S-Q1 , TMS320F28378D , TMS320F28378S , TMS320F28379D , TMS320F28379D-Q1 , TMS320F28379S

 

  1.   Dual-Axis Motor Control Using FCL and SFRA On a Single C2000 MCU
    1.     Trademarks
    2. 1 Introduction
      1. 1.1 Acronyms and Descriptions
    3. 2 Benefits of the C2000 for High-Bandwidth Current Loop
    4. 3 Current Loops in Servo Drives
    5. 4 PWM Update Latency for Dual Motor
    6. 5 Outline of the Fast Current Loop Library
    7. 6 Evaluation Platform Setup
      1. 6.1 Hardware
        1. 6.1.1 LAUNCHXL-F28379D or LAUNCHXL-F280049C
          1. 6.1.1.1 DACs
          2. 6.1.1.2 QEPs
        2. 6.1.2 Inverter BoosterPack - GaN + INA240
        3. 6.1.3 Two Motor Dyno
        4. 6.1.4 System Hardware Connections
        5. 6.1.5 Powering Up the Setup
      2. 6.2 Software
        1. 6.2.1 Incremental Build
        2. 6.2.2 Software Setup for Dual-Axis Servo Drive Projects
    8. 7 System Software Integration and Testing
      1. 7.1 Incremental Build Level 1
        1. 7.1.1 SVGEN Test
        2. 7.1.2 Testing SVGEN With DACs
        3. 7.1.3 Inverter Functionality Verification
      2. 7.2 Incremental Build Level 2
        1. 7.2.1 Connecting motor to INVs
        2. 7.2.2 Testing the Motors and INVs
        3. 7.2.3 Setting Over-current Limit in the Software
        4. 7.2.4 Setting Current Regulator Limits
        5. 7.2.5 Position Encoder Feedback
      3. 7.3 Incremental Build Level 3
        1. 7.3.1 Observation One – Latency
      4. 7.4 Incremental Build Level 4
        1. 7.4.1 Observation
        2. 7.4.2 Dual Motor Run With Speed Loop
      5. 7.5 Incremental Build Level 5
        1. 7.5.1 Dual Motor Run with Position Loop
      6. 7.6 Incremental Build Level 6
        1. 7.6.1 Integrating SFRA Library
        2. 7.6.2 Initial Setup Before Starting SFRA
        3. 7.6.3 SFRA GUIs
        4. 7.6.4 Setting Up the GUIs to Connect to Target Platform
        5. 7.6.5 Running the SFRA GUIs
        6. 7.6.6 Influence of Current Feedback SNR
        7. 7.6.7 Inferences
        8. 7.6.8 Phase Margin vs Gain Crossover Frequency
    9. 8 Summary
    10. 9 References

Incremental Build Level 5

Assuming the previous build levels are verified successfully, this section verifies the position PI module and position loop with a QEP. When the motor is commanded to run, it is subjected to an initial alignment stage where the electrical angle and the QEP angle count are set to zero. After ensuring a stable alignment, the motor starts to run.

The implementation block diagram is given in Figure 30. The motor shafts must be kept disconnected to run these motors at different position settings simultaneously or only one motor can be tested at a given time.

  1. Open "dual_axis_servo_drive_settings.h" and select level 5 incremental build option by setting the BUILDLEVEL to FCL_LEVEL5 (#define BUILDLEVEL FCL_LEVEL5). The current loop regulator can be selected to be the PI controller or the complex controller by setting FCL_CNTLR to PI_CNTLR or CMPLX_CNTLR.
  2. Right-click on the project name, and then click Rebuild Project.
  3. When the build is complete, click the Debug button, reset the CPU, restart, enable real-time mode, and run.
  4. figure_30.gifFigure 30. Level 5 Block Diagram Showing Position Loop for Dual Motor With Inner FCL
  5. The software runs the motor through predefined motion profiles and position settings as set by the refPosGen() module. This module basically cycles the position reference through a set of values as defined in an array 'posArray[]'. These values represent the number of the rotations and turns with respect to the initial alignment position. Once a certain position value as defined in the array is reached, it pauses for a while before slewing toward the next position in the array. Therefore, these array values can be referred to as parking positions. During transition from one parking position to the next, the rate of transition (or speed) is set by 'motorVars[0].posSlewRate'. The number of positions in 'posArray[]' through which it passes before restarting from the first value is decided by 'ptrMax'. Hence, add the key variables 'posArray', 'ptrMax', and 'motorVars[0].posSlewRate' to the Expressions window as follows:
    1. motorVars[0].runMotor : flag to MOTOR_RUN or MOTOR_STOP
    2. motorVars[0].ptrFCL->lsw: the soft-switch flag that is auto promoted in a sequence inside the FCL.
    3. motorVars[0].posSlewRate: the rate of transition from one parking position to the next position.
    4. motorVars[0].pi_pos: the position PI controller structure variable.
    5. posArray: the position reference for dual motor.
    6. ptrMax: the maximum position sets.
  6. Set “enableFlag” to 1 in the expressions window. The variables named 'motorVars[0].isrTicker' and 'motorVars[1].isrTicker' are incrementally increased as shown in Expressions window to confirm the interrupts are working properly.
  7. Gradually increase voltage at DC power supply to get an appropriate DC-bus voltage.
  8. Set 'motorVars[0].runMotor' flag to MOTOR_RUN to run the motor, now the motor must be turning to follow the commanded position (see the following note if the motor does not turn properly).
  9. The parking positions in 'posArray[]' can be changed to different values to determine if the motor turns as many rotations as set.
  10. The number of parking positions 'ptrMax' can also be changed to set a rotation pattern.
  11. The position slew rate can be changed using 'motorVars[0].posSlewRate'. This rate represents the angle (in pu) per sampling instant.
  12. The proportional and integral gains of the speed and position PI controllers may be returned to get satisfactory responses. TI advises to first tune the speed loop and then the position loop.
  13. Set 'motorVars[0].runMotor' to MOTOR_STOP to stop the motor.
  14. Bring the system to a safe stop by reducing the bus voltage, taking the controller out of real-time mode, and resetting.

The same set of tests can be done on motor 2 by working with structure variable 'motorVars[1]'.

Figure 31 shows the position reference, and position feedback are plotted in the scope plot using DACs. They are aligned with negligible lag, which may be attributed to software. If the Kp and Ki gains of the position loop controller are not chosen properly, this may lead to oscillations in the feedback or a lagged response.

figure_31.gifFigure 31. DACs in Scope Plot of Reference Position to Servo and Feedback Position

NOTE

  • If the motor response is erratic, then the sense of turn of the motor shaft and the encoder may be opposite. Swap any two phase connections to the motor and repeat the test.
  • The position control implemented here is based on an initial aligned electrical position (=0). If the motor has multiple pole pairs, then this alignment can leave the shaft in different mechanical positions depending on the prestart mechanical position of the rotor. If the mechanical position repeat ability or consistency is needed, then the QEP index pulse must be used to set a reference point. This may be taken as an exercise .