Home

Resource Library

AN-064: How to run a linear motor with TMC4671

Back to Resource Library

AN-064: How to run a linear motor with ADI Trinamic's TMC4671

Download PDF

The TMC4671 hardware controller performs Field Oriented Control (FOC) for two-phase stepper motors and for three-phase permanent magnet synchronous motors (PMSM) and it supports linear motor control.

Why use TMC4671 for linear motor servo control? The TMC4671 provides hardware closed loop torque control, velocity control, and position control even for linear motors decoupling motor control from application.

Linear Motor and TMC4671

When using the TMC4671 to control a linear motor the servo control modes torque control, velocity control, and position control for three-phase permanent magnet synchronous motors (PMSM) are applicable. To close the loop the TMC4671 provides an ADC engine, as well as multiple position feedback options which can be configured to the linear motor.

Linear Motor with Incremental Encoder Feedback

In this architecture a linear incremental encoder (ABN) provides the feedback for commutation/torque as well as velocity and position control.

Figure 1: Linear Motor with ABN Encoder and TMC4671

Linear Motor Configuration

The table below gives an overview on the most important registers to configure the TMC4671 for a linear motor:

Address

Register Name

Function

0x1Bh

MOTOR_TYPE_N_POLE_PAIRS

set motor type and number of pole pairs.

0x50h

VELOCITY_SELECTION

selection of velocity signal source

0x51h

POSITION_SELECTION

selection of position signal source

0x52h

PHI_E_SELECTION

selection of electrical angle used for commutation by FOC

0x25h

ABN_DECODER_MODE

ABN encoder mode (direction, ABN pulse
polarities and handling)

0x26h

ABN_DECODER_PPR

ABN encoder positions per revolution, PPR =lpr · 4

In the following a guideline for the configuration is given.

Motor Type and Pole Pairs

The TMC4671 supports several motor types such as one phase, two phase as well as three-phase motors. Depending on the selected motor in register MOTOR_TYPE_N_POLE_PAIRS (0x1Bh) the PWM output for the gatedrivers are selected accordingly. The pole pairs define the electrical periods per mechanical period for
an rotating motor. For a linear motor the pole pair is set set to one. Thus the MOTOR_TYPE_N_POLE_PAIRS (0x1B) will be set as follows for a three-phase linear motor:

Address

Register Name

Value

0x1Bh

MOTOR_TYPE_N_POLE_PAIRS

N_POLE_PAIRS = 1 (number of pole pairs)

MOTOR_TYPE = 3 (three phase BLDC)

Result: The electrical revolution equals the mechanical revolution matching a linear motor. The FOC is using three-phase control scheme.

Feedback Selection

The feedback selection registers define the type of the position feedback (e.g., digital hall, analog hall, incremental encoder,...) For a linear motor with an ABN incremental encoder the TMC4671 is configured as follows:

Address

Register Name

Value

0x50h

VELOCITY_SELECTION

3 (phi_e_abn)

0x51h

POSITION_SELECTION

3 (phi_e_abn)

0x52h

PHI_E_SELECTION

3 (phi_e_abn)

Result: Primary ABN encoder interface (pins 33, 34, 35) of the TMC4671 is used as feedback for torque, velocity and position mode.

2.4 Encoder Resolution

The encoder feedback selected in the Feedback Selection chapter 2.3 will be used for commutation. For correct commutation it is important to set the encoder feedback resolution (ABN_DECODER_PPR, 0x26) which is defined by pulses per electrical period. For a linear motor the electrical period covers exactly the magnet pole pair distance as depicted in figure 2:

The encoder resolution is determined by linear encoder resolution and magnetic pole pair length of the linear motor:

ABN_DECODER_PPR = pole pair length / linear encoder resolution (1)

Example: A linear motor with a pole pair length of 3cm and a linear encoder resolution of 1µm results in ABN_DECODER_PPR (0x26) = 30000.

The TMC4671 supports encoder resolutions up to 2 24 − 1. The ABN decoder count is mapped to the mechanical angle PHI_M in the range of 0... 65535. As mentioned in section 2.2 the mechanical angle PHI_M is equal to the electrical angle due to the polepair count = 1.

2.5 Encoder Initialisation

A linear incremental encoder does not provide information on the absolute motor position within an electrical period. The purpose of the encoder initialization is to obtain a known motor position within its electrical period. For a linear motor the electrical period equals the pole pair length. To initialise an encoder the wizard in the TMCL-IDE provides several inbuilt functions.

For the linear motor with only incremental feedback the encoder initialization mode 0 is suitable. Principle is to align the motor into a known position by applying a defined magnetic field. For this initialization method the linear motor should be able to move one pole pair. The resulting motor position is then well defined as it is the beginning of the electrical period thus the commutation angle can be set to zero as shown in figure 3:

Figure 3: Encoder initialization mode 0 principle

i
3a. Before initialization

3b. After initialization

The encoder function is implemented in the TMCL-IDE and in the TMC4671 API function tmc4671_doEncoderInitializationMode0()

2.6 Linear Scaling Factor

To map from internal units to linear units (e.g. one micrometer) a linear scaling factor is introduced which translates between electrical period and linear position.

For a linear motor (as depicted in figure 1) the linear scaling factor is determined by the pole pair length in µ m:

linear scaling factor = pole pair length[µm] (2)

Linear scaling unit is µm / mechanical revolution with the mechanical revolution being equal to one.

Example: A magnetic pole pair length of 3cm results in a linear scaling factor of 30000 µm mechanical revolution.

With this scaling factor one position step will be equal to one micrometer.

The linear scaling factor is implemented in the TMC-API and available in the TMCL-IDE. It is not part of the TMC4671 registers.

3 Linear Motor Setup with TMCL-IDE and Wizard

3.1 TMC4671 Evaluation Board

The ADI Trinamic evaluation boards are being used as an exemplary hardware platform for this application note. Following parts are used:

TMC-45671 EVAL

TMC-6100 EVAL (powerstage)

TMCL-IDE

Linear motor with an incremental linear encoder (ABN)

pole pair length = 3cm

linear encoder resolution = 1µm

3.2 Overview

Configuration by TMCL-IDE wizard

Motor and pole pairs

Motor current ADC

Encoder (resolution and initialization)

Configuration with TMCL-IDE tools

Feedback Selection

Linear Scaling Factor

PI tuning

Position mode

3.3 Open TMC4671 Wizard

Figure 4: Selector settings

3.4 Wizard Selection

3.5 Settings

Set number of pole pairs = 1 for the linear motor.

3.6 Open Loop

Run the motor in open loop for ADC and encoder configuration.

3.7 ADC config

3.8 ABN encoder

Init with offset estimation (Wizard) or init with offset estimation (Firmware).

3.9 Encoder Test Drive (Torque Mode)

3.10 Save Configuration

On the summary page choose ABN encoder for a preconfigured script. This will include the encoder alignment (mode 0) Then save the script using the Export Script button.

3.11 Feedback Selection

Figure 5: Selector settings

3.12 Linear Scaling Factor

Clear the position and enable linear scaling factor.

Figure 6: Linear motor settings

3.13 PI Tuning

Figure 7: Example PI values after tuning

For PI tuning refer to the PI tuning appnote.

3.14 Position Mode

Figure 8: Position mode tool with linear units

Position mode test run:

Figure 9: Position mode with target position of 100000 micrometer with linear units

4 Additional Resources

TM4671 product page

TMC4671 PI tuning appnote

Driving a linear stage with TMC4671

TMC4671 API on github

TMC4671 Python resources

Related Content

Products

TMC4671

RECOMMENDED FOR NEW DESIGNS

Fully integrated servo controller, providing Field Oriented Control for...

Show More

Who We Are

Careers

Newsroom

What We Do (Signals+)

Investor Relations

Quality & Reliability

Sales and Distribution

What's New on Analog.com

Contact Us

Support

EngineerZone

Resources

Wiki

Analog Dialogue

ADI Developer Portal

Legal and Risk

Accessibility

Privacy Policy

Privacy Settings

Cookie Settings

×

×
Close

Modal title

Manage Cookie Settings

When you visit our website, we store cookies on your browser to collect information. The information collected might relate to you, your preferences, or your device. It is mostly used to make the site work as you expect it to and to provide a more personalized web experience. However, you can choose not to allow certain types of cookies, which may impact your experience of the site and the services we are able to offer. Click on the different category headings below to learn more and to set your preferences. You cannot disable the Strictly Necessary Cookies as they are deployed to ensure the proper functioning of our website (such as prompting the cookie banner and remembering your settings, to log into your account, or to redirect you when you log out). For more information about the cookies click the following link.

Cookie Policy
Allow All

Manage Consent Preferences

Strictly Necessary Cookies

Always Active

These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.

Functional Cookies

Functional Cookies

These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.

Performance Cookies

Performance Cookies

These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.

Targeting Cookies

Targeting Cookies

These cookies may be set through our site by our advertising partners, to create a profile of the device owner’s interests in order to show relevant advertising on other sites. The technology does this by uniquely identifying your device. These cookies collect information to build a profile of your interests and to personalize your experience with targeted ads. If you do not allow these cookies, you will experience less targeted advertising (but will still see ads on other websites). If you have enabled privacy controls on your browser (such as the Do Not Track setting or Global Privacy Control signal), Targeting cookies will be disabled by default.

Cookie List

Clear

checkbox label label

Apply Cancel

Consent Leg.Interest

checkbox label label

checkbox label label

checkbox label label

Confirm My Choices

Site Feedback