SPRAD03 March   2022 AM2431 , AM2431 , AM2432 , AM2432 , AM2434 , AM2434 , AM6411 , AM6411 , AM6412 , AM6412 , AM6421 , AM6421 , AM6422 , AM6422 , AM6441 , AM6441 , AM6442 , AM6442

 

  1.   Trademarks
  2. System Overview
  3. Hardware Prerequisites
  4. Hardware Configuration
  5. HW Pinouts, Default Jumpers, and Connections
  6. Schematics
  7. Jumper Settings and Descriptions
  8. LEDs
  9. Software Architecture
  10. Actuation and Feedback Timing
  11. 10Benchmark Results
    1. 10.1 Motor Control R5F Processing Time
    2. 10.2 Trigger/Capture Point to R5F ISR Entry
  12. 11Detailed Demo User's Guide
    1. 11.1 Step 0. Getting the Software and Building
    2. 11.2 Step 1. Getting Started With the Hardware
    3. 11.3 Step 2. Configure ROQ437 EnDat2.2 Encoder for Faster EnDat 2.2 Recovery Time (only needs to be done once the first time you use the ROQ437 encoder)
    4. 11.4 Step 3. Open Loop Iq Control (BUILDLEVEL == OPEN_LOOP_IQ_ID)
    5. 11.5 Step 4. Closed Loop Iq/Id Control (BUILDLEVEL == CLOSED_LOOP_IQ_ID)
    6. 11.6 Step 5. Closed Loop Speed Control (BUILDLEVEL == CLOSED_LOOP_SPEED)
    7. 11.7 Step 6. Closed Loop Position Control (BUILDLEVEL == CLOSED_LOOP_POSITION)
  13. 12Build Using MCU+SDK 08.00.00.21 & CCS 10.3.1
  14. 13Summary
  15. 14Appendix A: Detailed Motor Control R5F Processing Time
  16. 15References

Step 6. Closed Loop Position Control (BUILDLEVEL == CLOSED_LOOP_POSITION)

This build level closes the position loop in addition to the speed and current loops.

  1. Go to the settings.h file and change the definitions to match the following (closed loop position control, debug buffers on, 8000 cycles per set point):
    GUID-20211108-SS0I-XT6W-JFSK-B9HCX3HDVB0H-low.png Figure 11-28 Closed Loop Position - BUILDLEVEL
  2. If desired, go to the single_chip_servo.c file and modify the Speed set point array. Default values shown below.
    GUID-20211108-SS0I-LTNR-XHLB-0TGV8HBKT3JJ-low.png
    1. Values are duplicated to give the motor time to get to the position before the setpoint cycle count is up.
  3. Once the project is loaded, open the 'single_chip_servo.c' file and find the following line, then right-click and select 'Run to Line'.
    GUID-20211108-SS0I-KNV4-SPJB-HM446TL4HMCR-low.png Figure 11-29 Closed Loop Position - Run to Line
  4. Running to this line allows the control code to run through the eight different setpoints and fill up the debug buffer so that the grap can be viewed.
  5. Check the output by importing the following graphs:
    GUID-20211108-SS0I-C2W9-HQ2H-RDT9M61KCFWC-low.png Figure 11-30 Closed Loop Position - Position and Speed Graph 1
  6. Example output shown below (speed and position graphed from top to bottom). Notice how speed goes to +-500RPMs during the position changes and stays there until the position is reached. The position ramp slope is determined by the MAX_POS_CHANGE definition in the settings.h file.
    GUID-20211108-SS0I-0MZQ-DQRF-MCW9HTPG1Z4M-low.png Figure 11-31 Closed Loop Position - Position and Speed Graph 2
  7. It is a difficult to see how accurate the position is in the CCS graph above, so you can also use the CCS memory browser to dump 'gDebugBuff5' to a text file in order review in Excel or Matlab. Once you do that, you can see how accurate the position actually is: typically +-0.001° from the requested target once the position has settled (shown in Figure 11-32 for two of the requested positions):
    Figure 11-32 Closed Loop Position - Position Control Accuracy