0755-82557621 sales@chiplinkstech.com Mon–Fri 09:00–18:00 (UTC+8)
Precision motion control · Components and solutions

Using RTMI to Tune TMC4671 PI

AN53: TMC4671 PI Tuning Document Revision V1.2.2 – 2020-Feb-05 This document describes step by step how to use USB-2-RTMI (RTMI) to tune the TMC4671. The communication converter uses an FTDFT422-based [...]

2020-02-16 New Product Information
使用 RTMI 调试TMC4671 PI

使用 RTMI 调试TMC4671 PI

AN53: TMC4671 PI Tuning

Document Revision V1.2.2 - 2020-Feb-05

This document describes step by step how to use USB-2-RTMI (RTMI) to tune the TMC4671. The communication converter uses an FTDFT4222H-based high-speed USB-to-SPI bridge. It is USB-powered and has a compact 10-pin connector that matches the RTMI interface pins of the TMC4671-EVAL, and the same pin assignment can be found on the TMC4671 evaluation board. TMCL-IDE provides software tools for tuning different control loops. Therefore, RTMI is the easiest way to tune, monitor, and configure the system.

1 Items used

  • Brushless DC servo motor, (e.g. QBL4208-61-04-013-1024-AT)
  • TMC4671-EVAL-Kit
  • USB-2-RTMI
  • TMCL-IDE (3.0.24)
  • Power supply (24 V)
  • Micro-USB communication cable
  • Mini-USB communication cable
    使用 RTMI 调试TMC4671 PI
    mark

2 USB-2-RTMI Driver Installation

Refer to the USB-2-RTMI guide to complete driver installation.

3 Basic Configuration

Before using the debugging tool, the TMC4671 must first be configured (e.g., using the TMC4671 Wizard).

使用 RTMI 调试TMC4671 PI
mark

After completing the basic parameter configuration, it can be saved as C code or a .tpc script.

 

  • In the Summary, select ABN encoder.
  • Use Export Script to export the script.

4 Tuning

4.1 Overview

The TMC4671 supports three main operating modes, which require PI configuration:

  • current/torque mode
  • velocity mode
  • position mode
    Each mode can be tuned for each loop via PI. The following figure provides an overview:
    使用 RTMI 调试TMC4671 PI
    mark

    This is a cascaded loop, so the outer loop depends on the tuning of the inner loop. For example, the current loop must be configured before using the speed loop. Software tools are provided for tuning each PI controller. In TMCL-IDE, these tuning tools can be accessed via the Tuning Group. The tuning tools include:
  • Biquad tuning: used to filter the target value of each loop
  • Torque/Flux tuning: identify PI parameters via open-loop step response
  • Step response: closed-loop step response for all control loops
  • Bode plot: Bode plot for all loops
  • IC scope: monitoring, readout of register values and PWM frequency

4.2 Limits

  • Before using the tuning tools, it is recommended to set the output voltage to maximum (set PIDOUT_UQ_UD_LIMITS = 32767). For
    For step operation, the default value is sufficient.
  • Set PID_TORQUE_FLUX_LIMITS to the maximum current value allowed in the application.
  • Set PID_POSITION_LIMIT_HIGH = 2,147,400,000
  • Set PID_POSITION_LIMIT_LOW = -2,147,400,000
    使用 RTMI 调试TMC4671 PI
    mark

5 Tuning of the current loop

The current loop consists of two control loops: one for torque (current) and the other for flux (current). Both can be adjusted using the RTMI tool in the TorqueFlux / Tuning tool and the Step response tool. The Torque/Flux tool determines the PI parameters in open-loop mode.

5.1 Torque/Flux Tuning Tool (Open Loop)

The Torque Flux tuning tool automatically determines initial PI parameter values by identifying the motor parameters. During this process, a voltage step is set and the current step response is evaluated. Only the flux current is excited to a minimum; there is no motion during this tuning phase. It is recommended to use a PWM frequency of 25 kHz for the best identification results.

  1. The TMC4671-EVAL is connected to the RTMI and the PC.

  2. Open the “Torque/Flux Tuning Tool”.

  3. Click the "Start" button to start tuning

  4. Shows the current response to a voltage step and the system identification result

    使用 RTMI 调试TMC4671 PI
    mark
    使用 RTMI 调试TMC4671 PI
    mark
  5. Check and manually adjust the Y range for a better view

  6. Click the "Start" button to re-identify the system; if the motor matches consistently, a better identification result will be provided

  7. If necessary, adjust the required computer display window. In most cases, the default settings will provide good results. - The dynamic step response is covered in the identification area (inside the dashed box):

    • The dynamic step response should be covered in the identification area (dashed box)

      使用 RTMI 调试TMC4671 PI
      mark
      使用 RTMI 调试TMC4671 PI
      mark
    • In Figure 11, the step response is not fully covered. The identification area is too small.

      使用 RTMI 调试TMC4671 PI
      mark
    • In Figure 12, the identification area is too large

      使用 RTMI 调试TMC4671 PI
      mark
  8. Write the identified PI values to the current controller

    • Use the button below to update the PI values in the current controller
      使用 RTMI 调试TMC4671 PI
      mark
    • Note: For very high values, the identified I-parameter is displayed as 0. In this case, the I parameter must be set manually (e.g., set to 18000).
    • Use the PI control box to confirm the new PI values. The values must be updated using the Reload button.
      使用 RTMI 调试TMC4671 PI
      mark

5.2 Step Response Toolbox (Closed Loop)

In the previous step, the PI parameters of the torque/flux current loop were identified in open-loop mode. Now, the step response tool will be used to analyze the closed-loop
behavior.

  1. Open the Step Response Toolbox
    使用 RTMI 调试TMC4671 PI
    mark
  2. Configure the flux current settings for current control
    • Target value: 0x64 PID_FLUX_TARGET
    • Measurement 1: 0x69 PID_FLUX_ACTUAL
    • Sampling rate: PWM
    • Next step
      Set Start value = 0
      Determine the final flux target current target value (value here is 4000)
    • Use the Start button to start the step response
  3. Display the actual current and target current
    使用 RTMI 调试TMC4671 PI
    mark
  4. Lower the sampling rate for better results
    使用 RTMI 调试TMC4671 PI
    mark
  5. Optimize performance by modifying different P and I values
  6. Repeat starting from step 2, modifying PID_TORQUE_TARGET and PID_TORQUE_ACTUAL.

5.3 Bode Plot

The Bode plot tool is used to confirm the dynamic performance of the current loop.

  1. Open Bode Plot

  2. Select 1: torque control loop

  3. Start the measurement by clicking the Start button (keep other settings at their default values)

  4. Comparison example: the two measurements below show Bode plots with and without tuning using the default PI parameters.

  5. Default PI values

    使用 RTMI 调试TMC4671 PI
    mark
    使用 RTMI 调试TMC4671 PI
    mark
  6. Adjust PI parameters

    使用 RTMI 调试TMC4671 PI
    mark
    使用 RTMI 调试TMC4671 PI
    mark
  7. After tuning the PI, the control system has a higher cutoff frequency and therefore higher dynamic performance.

    使用 RTMI 调试TMC4671 PI
    mark

6 Tuning of the velocity loop

This section describes speed-loop tuning. The prerequisite is that the current loop has already been tuned. To adjust the speed-loop PI parameters, use the step response tool (closed loop).

  1. For ease of speed unit confirmation, VELOCITY_SELECTION (0x52) in the Selectors toolbox needs to be set from phi_e_selection to phi_m_abn.
    • phi_m: The unit for displaying and calculating mechanical speed is RPM (revolutions per minute).
    • phi_e: The unit for displaying and calculating electrical speed is electrical cycles.
  2. Set the speed-loop PI parameters.
    At the beginning, set a relatively low P value; set I = 0
  • 0x58: PID_VELOCITY_I = 0
  • 0x58: PID_VELOCITY_P = 100
    使用 RTMI 调试TMC4671 PI
    mark
  1. Open the Step Response toolbox

  2. Use the step-response example configuration

  3. Click the Start button to start the step response

    使用 RTMI 调试TMC4671 PI
    mark
  4. Gradually increase PID_VELOCITY_P until the actual velocity (PID_VELOCITY_ACTUAL) reaches 50-75%
    Target velocity (PID_VELOCITY_TARGET)

    使用 RTMI 调试TMC4671 PI
    mark
    使用 RTMI 调试TMC4671 PI
    mark
  5. Increase the PID_VELOCIT_I value until the actual velocity reaches the target velocity

    使用 RTMI 调试TMC4671 PI
    mark
    使用 RTMI 调试TMC4671 PI
    mark

7 Tuning of the position loop

This section describes position loop tuning. Before using the position loop, the current loop and speed loop must first be configured. Use the step response tool for tuning, and then
Use the Landungsbruecke MCU board from the development board kit to improve dynamic performance and accuracy.

7.1 Step Response Tool

  1. Set POSITION_SELECTION to phi_m_abn
    Therefore, the motor has 65535 counts per revolution.

  2. Set the initial values of the PI position controller

    • PID_POSITION_I = 0 (for most setups, it is recommended to set this to 0)
    • PID_POSITION_P = 10
      使用 RTMI 调试TMC4671 PI
      mark
  3. Open the step response tool

  4. Click the Start button to start the step response. The motor will move back and forth to the end value. Here, this is 1 revolution.

  5. When PID_POSITION_P = 10, the motor does not move.

    使用 RTMI 调试TMC4671 PI
    mark
  6. Increase the proportional value P: PID_POSITION_P = 50

    使用 RTMI 调试TMC4671 PI
    mark
  7. Increase the proportional parameter P value: PID_POSITION_P = 100

    使用 RTMI 调试TMC4671 PI
    mark
  8. Adjusted PI configuration.

    使用 RTMI 调试TMC4671 PI
    mark

7.2 Motion Controller

The MUC board Landungsbrücke in the development board kit has a trapezoidal ramp generator and can be used together with the TMC4671-EVAL. TMC4671 chip
does not integrate motion control functions.

1. 通过 Mini USB 将MUC板 Landungsbruecke 连接到电脑

2. In the Landungsbruecke dialog box (USB-2-RTMI unavailable), open the position mode toolbox.
3. Enable the velocity control curve and acceleration limit.

使用 RTMI 调试TMC4671 PI
mark
  1. In the position control toolbox (position mode toolbox), control the motor to rotate 10 revolutions.

    • Clear the position value
    • Set target position Target pos. = 655350
    • Click the Absolute button to start motor motion
      使用 RTMI 调试TMC4671 PI
      mark
  2. Increase deceleration

    使用 RTMI 调试TMC4671 PI
    mark
  3. Use motion control to repeat 10 revolutions while increasing the deceleration parameter; PI parameters can also be adjusted at the same time:

    使用 RTMI 调试TMC4671 PI
    mark
  4. Adjust the PI configuration after adding the motion control function

    使用 RTMI 调试TMC4671 PI
    mark
  5. Select the Export option to save the PI configuration

    8 Summary

    The RTMI communication interface provides a powerful option for debugging the TMC4671 chip. Fast real-time access to the chip can be used to debug and monitor each loop. TMCL-IDE provides ready-made software tools for system development. For more information about the TMC4671 and how to use it, please refer to the TMC4671 datasheet.

    9 Revision History

    使用 RTMI 调试TMC4671 PI
    mark
← Back to News