TMC457 – DATA SHEET
S-profile motion controller with PID feedback
control and high resolution micro stepping
sequencer for stepper motors and piezo motors
®
TRINAMIC Motion Control GmbH & Co. KG
Sternstraße 67
D – 20357 Hamburg
GERMANY
www.trinamic.com
1 Features
The TMC457 is a high end single axis micro stepping motion controller. It adds to any microcontroller
TM
or processor with SPI (SPI is Trademark of Motorola) interface. It is intended for applications, where
a precise and fast, jerk-free motion profile is desired. An encoder can be added for extremely quick
and precise positioning using the internal hardware PID regulator and provides for increased reliability /
fault detection. The high-resolution micro step sequencer directly controls stepper motors and piezo
motors. Wide range motion control parameters eliminate any “gear switching”. The TMC457 supports
linear velocity ramps and S-shaped velocity ramps. For maximum flexibility all motion control
parameters (target position, target velocity, acceleration, deceleration and bow) can be changed any
time during motion.
Highlights
• S-shaped and linear ramps with on-the-fly alteration of all parameters
• Programmable high resolution sequencer with (12 bit, 8192 entry) micro step look-up table
• Incremental encoder interface with flexible up- and down scaling to match drive resolution
TM
• Fast and stable easyPID PID controller
• 32 bit registers – from mHz to MHz / from nanometer to meter
• SPI interface to microcontroller
• Reference switch processing / virtual stop switches (programmable soft limits)
• Step / direction output (with programmable timing)
• Position pulse output to trigger external events
• Synchronization of multiple axis via scalable step / direction input
• Direct interface for TMC246/TMC249 family stepper motor drivers supports StallGuard™ (pat.)
• ChopSync™ (pat. fil.) built in for best motor velocity range
• Analog high resolution motor driver control via external dual 12 bit DAC
• Automatic load angle limitation using encoder for stepless servo behaviour
Types of Motors
• Two phase stepper motors (direct sequencer support)
®
• PiezoMotors (direct sequencer support for PiezoMotor’s PiezoLEGS motor)
• Any type of motor via step/direction interface
Applications
• Medical and laboratory equipment with high speed motion e.g. for liquid handling
• High end placement and positioning systems / High reliability drives
• Sub-micrometer positioning (piezo motors)
• Active stabilization with incremental encoder and fast PID regulator
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
Life support policy
TRINAMIC Motion Control GmbH & Co. KG does not
authorize or warrant any of its products for use in life
support systems, without the specific written consent
of TRINAMIC Motion Control GmbH & Co. KG.
Life support systems are equipment intended to
support or sustain life, and whose failure to perform,
when properly used in accordance with instructions
provided, can be reasonably expected to result in
personal injury or death.
© TRINAMIC Motion Control GmbH & Co. KG 2013
Information given in this data sheet is believed to be
accurate and reliable. However no responsibility is
assumed for the consequences of its use nor for any
infringement of patents or other rights of third parties
which may result from its use.
Specification is subject to change without notice.
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
2
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
3
2 Contents
1
FEATURES ...................................................................................................................................... 1
2
CONTENTS ...................................................................................................................................... 3
2.1
2.2
Figures ...................................................................................................................................... 4
Tables........................................................................................................................................ 4
3
GENERAL DESCRIPTION .............................................................................................................. 5
4
TMC457 BLOCK DIAGRAM AND INTERFACES ........................................................................... 6
TM
4.1
Microcontroller Interface (SPI ) ............................................................................................... 6
4.2
Step Direction Inputs ................................................................................................................. 6
4.3
DAC (LTC2602) Interface ......................................................................................................... 6
4.3.1
Piezo Motor Driver ............................................................................................................. 6
4.4
Stepper Motor Driver Interface (TMC236, TMC239, TMC246, TMC249) ................................. 7
4.4.1
Stepper Motor Driver (high resolution micro stepping) ...................................................... 7
4.4.2
Stepper Motor Driver (low resolution micro stepping) ........................................................ 7
5
FUNCTIONAL BLOCKS AND REGISTERS ................................................................................... 8
5.1
Ramp Generator ....................................................................................................................... 8
5.2
ABN Incremental Encoder Interface.......................................................................................... 8
5.2.1
Setting the encoder to match the motor resolution: ........................................................... 9
5.3
Vector control ............................................................................................................................ 9
5.3.1
Initialization of vector control mode .................................................................................. 10
TM
5.4
PID Controller - easyPID ...................................................................................................... 10
5.5
Step Direction Output Interface ............................................................................................... 11
5.6
Step Direction Input Interface for multi axis interpolation ........................................................ 11
5.7
Reference Switch and Stop Switch Interface .......................................................................... 11
5.8
Micro Step Sequencer ............................................................................................................. 11
TM
5.8.1
ChopSync CHOPCLK .................................................................................................. 11
5.9
Type and Version Register / Version specific notes and known bugs .................................... 12
5.10
Interrupt Controller ............................................................................................................... 12
5.11
Sine Wave Look-up Table (SIN-LUT) Access and Parameterization .................................. 13
5.11.1 Calculation of the Sine Wave Look-Up-Table to drive a Piezo Motor .............................. 13
5.11.2 Calculation of the Sine Wave Look-Up-Table to drive a Stepper Motor .......................... 13
6
REGISTER MAPPING ................................................................................................................... 14
6.1
SPI Datagram Structure .......................................................................................................... 14
6.1.1
Selection of Write / Read (WRITE_notREAD) ................................................................. 14
6.1.2
Data Alignment ................................................................................................................ 14
6.2
Register Block Structure – Register Mapping ......................................................................... 14
6.2.1
Nomenclature of Read / Write / Clear on Read / Clear on Write of Registers ................. 15
6.2.2
Time Scaling by Clock Frequency ................................................................................... 15
6.2.3
Real World Units vs. Units of the TMC457 ...................................................................... 26
7
EXAMPLES .................................................................................................................................... 27
7.1
7.2
How to Get a Motor Running ................................................................................................... 27
Set Incremental Encoder Interface Parameters ...................................................................... 27
8
NOTATION OF NUMBER SYSTEMS ........................................................................................... 28
9
PINNING, PACKAGE, AND ELECTRICAL DATA OF THE TMC457 ........................................... 29
9.1
Pinning of TMC457.................................................................................................................. 29
9.1.1
Pull-Up / Pull-Down Resistances ..................................................................................... 32
9.1.2
Blocking Capacitors ......................................................................................................... 32
9.2
Package Outlines and Dimensions ......................................................................................... 33
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
9.2.1
4
Fine Pitch BGA Package with 144 Balls (FBGA144) of TMC457-BC .............................. 33
10
MICRO CONTROLLER INTERFACE (SPI) ............................................................................... 34
11
CHARACTERISTICS .................................................................................................................. 35
12
LITERATURE ............................................................................................................................. 36
13
REVISION HISTORY .................................................................................................................. 37
2.1
Figures
Figure 1 : Functional Block Diagram of the TMC457............................................................................... 5
Figure 2 : TMC457 with Piezo Motor Interface ........................................................................................ 6
Figure 3 : High Resolution Micro Stepping Configuration ........................................................................ 7
Figure 4 : Stepper Motor Driver Configuration (SPI)................................................................................ 7
Figure 5 : Outline of ABN Signals of an Incremental Encoder ................................................................. 8
Figure 6 : Incremental Encoder Signals Outline (AB w/o clear pulse N) ............................................... 28
Figure 7 : Package Outline Drawing FBGA144 – (JEDEC MO-192 VAR DAD-1) ................................. 33
Figure 8 : Timing Diagram of the Serial Micro Controller Interface ....................................................... 34
Figure 9 - General IO Timing Parameters ............................................................................................. 35
2.2
Tables
TM
Table 1 : PWM frequency calculation for ChopSync .......................................................................... 12
Table 2: TMC457-BC Pin Out ................................................................................................................ 32
Table 3 : Dimensions of FBGA144 (Note: BSC = Basis Spacing Between Centers) ............................ 33
Table 4: Timing Characteristics of the Micro Controller Serial Peripheral Interface (SPI) ..................... 34
Table 5 - Absolute Maximum Ratings .................................................................................................... 35
Table 6 – DC Ccharacteristics Operating Conditions ............................................................................ 35
Table 7 - Power Dissipation ................................................................................................................... 35
Table 8 - General IO Timing Parameters .............................................................................................. 35
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
5
3 General Description
one capacitor
per supply pin
CLK
ENABLE
NSCS
Host CPU SPI
Interface
SCK
SDI
SDO
NINT
POSCOMP
Optional Step/
Dir Input
STEP_IN
DIR_IN
+3.3V
+1.5V
100n
100n
GND
RES
+3.3V
+1.5V
The TMC457 has been designed with TRINAMIC's background of more than 10 years of dedicated
motion control ICs for stepper motors, like the 6 axis controller TMC406, the low cost 3 axis controller
TMC428 and the high end controller TMC453 with its compatible successor TMC454. While there lie
10 years of development and experience between the TMC453 and the TMC457, the basic features
look similar, but a lot of ideas, application know-how and customer feedback have been evaluated,
sorted and flown into the design. The intention in creating the TMC457 was to provide a motion
controller that provides superior performance, which can hardly be achieved by software in a processor
system, while providing a very easy-to-use interface to the programmer, which looks similar to the
peripherals found in a microcontroller. The electronic gear shift / pre-scaling found in our other motion
controllers was eliminated by extending position and velocity registers to 32 bits. This direct control
makes it easy to use the full range and precision of parameter setting. The easyPID™ closed loop PID
regulator eases the achievement of control loop stability by providing a programmable hysteresis.
Some features found in the TMC453 and TMC428 have been streamlined, to make them easier to use
and some options have been removed, like the programmable sequencer for many different motor
types, bearing in mind the most common applications.
TMC457
RES
I
I
CLK
Interface
Section
I
Motion profile
generation
Sequencer
O
I
I
I
SPI bus
interface
Register
Block
O
O
O
I
I
Interrupt
control
target
S-Ramp
generator
O
v
Trapezoid
Ramp
generator
Output
Pulse
generator
Pulse
generator
O
STEP/
DIR
Position
Counter
Microstep
RAM
8192*12
Position
compare
Stop /
Reference
Switches
Optional
Incremental
Encoder
STOPR
ENC_A
ENC_B
ENC_N
I
I
I
I
I
2 phase
stepper &
piezo
sequencer
O
O
O
O
O
easyPID
PID
controller
STEP DIR
Prescaler
Stop input
processing
& virtual
stop
switches
O
O
control &
status
I
O
TMC24x
SPI
interface
PID
STOPL
O
O
O
I
I
Encoder
quadrature
decoder
ChopSync
Encoder
Scaler &
Counter
Figure 1 : Functional Block Diagram of the TMC457
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
O
STEP_OUT
DIR_OUT
XSTEP_OUT
Step/Dir Output
HIRES_OUT
STDBY_OUT
PHA
PHB
Classic stepper
driver
NCS_DAC
SCK_DAC
SDO_DAC_A
SDO_DAC_B
PZO_EN
Analog control of
Stepper / Piezo
via DAC
(LTC2622)
NCS_DRV
SCK_DRV
SDO_DRV
SDI_DRV
NANA_SPI
TMC246 /
TMC249 stepper
driver
ChopClk
synchronized
chopper clock
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
6
4 TMC457 Block Diagram and Interfaces
Figure 1 shows the block diagram of the TMC457 motion controller. The TMC457 is equipped with a
SPI interface for communication with the microcontroller. It uses a fixed data length of 40 bit – 8 bit
address and 32 data. The TMC457 has a driver SPI to directly control the TRINAMIC stepper motor
drivers TMC236, TMC239, TMC246, and TMC249. It supports processing of StallGuard information to
emulate a reference switch, when using TMC246 or TMC249. The TMC457 has step direction input
and step direction outputs as well to allow the control of step direction power stages (like the TMC332)
or for external monitoring of motion by step pulse counting. For high precision micro stepping the
TMC457 is equipped with a DAC interface for LTC2602. This allows control of the TMC236 family with
extended microstep resolution or control of external power drivers with the classical analog control. An
incremental encoder interface is added for processing incremental encoders with digital quadrature
signal outputs (ABN). The position available from the quadrature signal decoder is directly available as
an input for the PID position regulator. The PID regulator is for position stabilization also during motion.
The PID regulator runs at an update rate of 100kHz and thus provides fastest response times.
4.1
Microcontroller Interface (SPITM)
The SPI for communication with the microcontroller to set motion control parameters (velocity,
acceleration, bow, …) of the TMC457 and to send motion command for positioning (set target position)
and continuous motion applications (set velocity).
4.2
Step Direction Inputs
In addition to the SPI for micro controller communication with the TMC457, the motion can be
controlled externally via the step direction inputs STEP_IN and DIR_IN.
4.3
DAC (LTC2602) Interface
The DAC interface directly controls LTC2602 from Linear Technologies to generate analog output
signals (two channels for micro stepping of bipolar two phase stepper motors) and four channels as
required for PiezoLEGS motors from the company Piezo-Motors.
4.3.1 Piezo Motor Driver
The power four required power stages of the driver for the piezoelectric motor (PiezoLEGS) must be
able to drive a 100nF capacitance at 3kHz with an amplitude of 48V each. A power stage with these
capabilities is realized for the TMC457 evaluation board.
V_REF
#1
REF
Vout A
DAC A
PZO_EN
+3.3V
+3.3V
VCC
GND
GND
Vout B
LTC2602 Interface
nCS_DAC
nCS_LD
SCK_DAC
SCK
M2
Control Logic
SDI
SDO_DAC_A
SDO_DAC_B
P1
P2
Power Stage Amplifier
DAC B
M1
LTC2622 2 x DAC 12 Bit
# 2 (for Piezo-Motor)
REF
Vout A
DAC A
+3.3V
VCC
GND
GND
Vout B
DAC B
M3
M4
nCS_LD
SCK
Control Logic
SDI
TMC457
LTC2622 2 x DAC 12 Bit
Figure 2 : TMC457 with Piezo Motor Interface
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
P3
P4
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
4.4
7
Stepper Motor Driver Interface (TMC236, TMC239, TMC246, TMC249)
The direct TRINAMIC driver interface of the TMC457 allows the TRINAMIC drivers to be controlled by
the TMC457.
4.4.1 Stepper Motor Driver (high resolution micro stepping)
For high resolution micro stepping the TMC457 has an interface for dual SPI DAC LTC2602.
CHOPCLK
OSC
TMC457
#1
V_REF
Vout A
REF
RA1
DAC A
INA
RA2
+3.3V
VCC
GND
GND
Vout B
RB1
DAC B
PZO_EN
LTC2602 Interface
GND
nCS_DAC
nCS_LD
SCK_DAC
SCK
TMC236
TMC239
TMC246
TMC249
Control Logic
SDI
SDO_DAC_A
SDO_DAC_B
INB
RB2
(open)
LTC2622 2 x DAC 12 Bit
+3.3V
nCS_DRV
TMC236 / TMC239
TMC246 / TMC249
SPE
CSN
SCK_DRV
SCK
SDO_DRV
SDI
Interface
SDI_DRV
SDO
nANA_SPI
ANN
Figure 3 : High Resolution Micro Stepping Configuration
4.4.2 Stepper Motor Driver (low resolution micro stepping)
For low resolution micro stepping, a TRINAMIC driver can be connected directly via SPI without an
additional DAC. With this, one can drive with 16 times micro stepping.
TMC457
CHOPCLK
PZO_EN
nCS_DAC
SCK_DAC
LTC2602 Interface
SDO_DAC_A
SDO_DAC_B
OSC
(open)
INA
(open)
INB
GND
TMC236
TMC239
TMC246
TMC249
(open)
(open)
(open)
(open)
+3.3V
nCS_DRV
TMC236 / TMC239
TMC246 / TMC249
SPE
CSN
SCK_DRV
SCK
SDO_DRV
SDI
Interface
SDI_DRV
SDO
+3.3V
nANA_SPI
ANN
Figure 4 : Stepper Motor Driver Configuration (SPI)
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
8
5 Functional Blocks and Registers
5.1
Ramp Generator
The ramp generator is the heart of the motion controller. It runs either ramp with linear velocity profile
or ramp with s-shape velocity profile. The selection is done by the bow parameter. Setting bow to 0
selects linear velocity profile. Linear ramps perform the quickest motion, by using the maximum
available acceleration at all times. But, since the acceleration becomes switched on and off abruptly,
system resonances can occur. They appear like an additional load on the motor, thus reducing the
available useful portion of motor torque. Further, system resonances need some time to fade away,
and this can costs valuable system time, if a complete stand still is required, before other actions can
start. With the S-shaped ramp, resonances can be reduced. However, it is advised to choose the bow
parameter as high as possible, in order to optimize positioning time.
The ramp generator provides four modes of operation:
[…]
It should be noted, that the choice of the microstep resolution directly influences the complete ramp
generator parameter settings, because a higher microstep resolution means a higher end velocity
setting, and thus a higher acceleration and a higher bow parameter to yield the same results. This way,
the settings are scaled in a huge range, e.g. when changing between fullstep and highest resolution
microstep.
Attention:
At all times, all parameters may be changed, but it should be noted, that unexpected results may
occur, when changing the bow parameter to a lower value during an acceleration phase, or when
changing the acceleration or deceleration parameter to a lower value. In these cases, the maximum
positioning velocity, respectively the target position could be exceeded, in case the new values do not
allow decelerating quickly enough. Even an overrun of the register value could occur and lead to
unexpected results. Under normal circumstances, the bow parameter will be fixed in an application.
position
-4 -3 -2 -1
0
1
2
3
4
5
6
7
A
B
N
t
Figure 5 : Outline of ABN Signals of an Incremental Encoder
5.2
ABN Incremental Encoder Interface
The TMC457 is equipped with an incremental encoder interface for ABN encoders that gives positions
via digital incremental quadrature signals (usually named A and B) and a clear signal (usually named N
for null of Z for zero). The N signal can be used to clear a position. It might be necessary to disable the
clearing of the encoder position after the first N signal event because the encoder gives this signal
once for each revolution and for most applications a motor turns more than one revolution.
The encoder constant named enc_const is added or subtracted on each position change of the
quadrature signals AB of the incremental encoder. The encoder constant enc_const represents an
unsigned fixed point number (16.16) to facilitate the generic adaption between motors and encoders. In
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
9
decimal mode, the lower 16 bit represent a number between 0 and 9999. This is especially important
for piezo motors (PiezoLEGS) because they do not have a fixed step length they achieve their very
high positioning precision in the range of nanometers via closed loop control together with a position
encoder. For stepper motors equipped with incremental encoders the fixed number representation
allows very comfortable parameterization. Additionally, gear can easily be taken into account.
The encoder counter named x_enc holds the current determined encoder position. Different modes
concerning handling of the signals A, B, and N take active low and active high signals of usual
incremental encoders into account. For details please refer to the register mapping section 6 Register
Mapping, page 14 ff.
The register enc_status holds the status concerning event of the ABN signals. The register enc_latch
stores the actual encoder position on an N signal event. The register x_latch stores the position while a
reference switch event occurs.
A register named enc_warn_dist (encoder warning distance) is used to generate an interrupt via the
TMC457 interrupt controller if the distance between encoder position and actual position is larger then
enc_warn_dist. The calculated error pid_e is available from the PID controller unit. Therefore, the PID
controller needs to be enabled.
5.2.1 Setting the encoder to match the motor resolution:
Encoder example settings for motor parameters: 2048 µsteps, 200FS 409600 / U
Factor = FS*µS / encoder resolution
Encoder example settings for a 200 fullstep motor with 2048 microsteps
Encoder resolution
200
360
500
1000
1024
3600
4000
4096
8192
16384
32768
5.3
required encoder factor
2048
1137,7778
= 74565404,4444 / 2^16
= 11377777,7778 / 10000
819,2
= 53687091,2 / 2^16
= 8192000 / 10000
409,6
400
113,7778
102,4
100
50
25
12.5
comment
No exact match possible!
exact match with decimal setting
exact match with decimal setting
No exact match possible!
exact match with decimal setting
Vector control
The vector control unit allows a load angle based motor control. This makes the motor behave like a
servo motor, i.e. it can be overloaded or stopped, and will later on catch up again, using the PID
regulator. Therefore, be careful to also activate the PID regulator!
Vector control is only possible using binary encoder resolutions, because no decimal setting is
available. Low resolution decimal encoders still give a match.
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
10
Vector control example settings for a 200 fullstep motor
Encoder resolution
512
1024
2048
4096
8192
16384
32768
required vector encoder factor
25
12.5
6.25
3.125 = 3 1/8
1.5625 = 1 9/16
0.78125 = 25/32
0.390625 = 25/64
venc_us_const
1600
800
400
200
100
50
25
A 400 fullstep motor needs the double setting
Different load angle limits above 90° allow for field weakening operation, which gives a faster motor
operation.
5.3.1 Initialization of vector control mode
A precise initialization of the vector control mode is critical for best functionality. Also, the encoder
needs to have an absolute precision, which is at least ½ fullstep of the motor.
For a newly assembled drive, an initial initialization is necessary. This initialization requires that the
motor does not see any mechanical load during initialization. Later on, the vector control can be
initialized with a stored offset from the initial initialization, using absolute position information, for
example based on the encoder N channel.
For initial initialization, the following procedure can be followed:
The actual encoder position venc_us_pos needs to be initialized for vector control. The position must
match selected microstep_adr bits, when the motor is unloaded in its exact position. This for example
can be accomplished, by switching the motor to a high standby torque after power on. Directly after a
power on, all microstep_adr bits are zero. Now, the motor will be in the exact zero position, as long as
it sees no mechanical load. Therefore, now the venc_us_pos can be initialized with zero, in order to
match the encoder angle to the electrical angle of the motor.
When the absolute position of the encoder is known, the vector control register venc_us_pos can be
initialized based on this information. Therefore, the encoder needs to be read out, or the N channel
needs to be found, and afterwards the stored offset can be added to the absolute position and be
written to venc_us_pos. Be sure to do this in a high priority procedure, because the encoder should not
advance a step in the meantime. If this cannot be guaranteed, a check and iteration should be done.
5.4
PID Controller - easyPIDTM
The PID (Proportional Integral Differential) controller calculates a velocity v based on a position
difference error pid_e = enc_x – x_actual where enc_x is the actual position- the real mechanical
position -determined by the incremental encoder interface and x_actual is the actual position of the
micro step sequencer –the position the TMC457 assumes to be the actual one. With this, the TMC457
moves with this (signed) velocity v until the actual position- measured by the incremental encoder –
match. The velocity v to minimize the error e is calculated by
t
v P e(t ) I e(t ) dt D
0
d
e(t ) .
dt
The motor moves with this velocity v = pid_v_actual until the error e(t) vanishes resp. falls below a
programmed limit – the hysteresis pid_tolerance. Primary, the PID regulator is parameterized by its
basic parameter P, I, D represented by registers pid_p, pid_i, pid_d. Setting pid_d = 0 makes a PI
regulator, additionally setting pid_i = 0 makes a P regulator. For micro controller interaction, the
parameter pid_dv_cpu is added to the pid_v_actual. The readable register pid_dv_clip holds the actual
value of clipping done by the PID controller of the TMC457.
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
11
Due to constraints of practical real word application, the integer part of the PID regulator can be clipped
to a limit named pid_iclip. Without this, the integral part of the PID regulator pid_isum increases with
each time step by pid_i*pid_e as long as the motor does not follow. The actual error can be read out
from register pid_e. The integration over time of the error e is done with a fixed clock frequency of
fPID_INTEGRAL[Hz] = fCLK[Hz] / 128. The time scaling for the deviation with respect to time of the
error is controlled by the register named pid_clk_div.
A stabilization of the target position by programmable hysteresis is integrated to avoid oscillations of
regulation when the actual position is close to the real mechanical position. The PID controller of the
TMC457 is fast – programmable up to approximate 100kHz update rate at fCLK = 16 MHz of the
TMC457 – so that it can be used during motion to stabilized the motion. The parameterization of the
TM
PID controller of the TMC457 occurs in a direct way. Due to this, it is named easyPID . Nevertheless,
the parameterization of a PID controller might need a detailed knowledge of the application and the
dynamic of the mechanics that is controlled by the PID controller. Additionally, a special control register
allows software interaction for additional feedback control algorithms that can be implemented within
the micro controller used to parameterize the TMC457.
5.5
Step Direction Output Interface
The TMC457 is equipped with step direction outputs (STEP, OUT). In Addition, it is equipped with a so
called X_STEP output. A pulse on this output represents a number of (micro) steps. It is configured by
the register named pulse_xstep_div. The TMC457 is able to generate step pulses with up to its clock
frequency fCLK[Hz]. Because a step frequency in the range of the clock frequency of the TMC457
might be too high for usual step direction drivers, an additional step output named X_STEP (extended
step) is available. The X_STEP represents a number of steps to be done at a lower frequency. The
threshold that selects between step pulses and extended step pulses is programmable. This can be
parameterized to give full steps on the XSTEP output of the TMC457.
5.6
Step Direction Input Interface for multi axis interpolation
The TMC457 is equipped with step direction inputs (STEP_IN, DIR_IN). This allows using the TMC457
with an external ramp generator. A number of TMC457 can be synchronized by interconnecting the
step direction inputs and outputs via a switch matrix. One TMC457 is used as master and its step and
direction output is fed to the other TMC457. They can be programmed to follow the master pulses
scaled by the 15 bit factor sd_scale (and sign). This way, multi-axis interpolation can be realized. The
slave motion thus always is equal or slower than the master. When programming the master axis, the
maximum allowed acceleration and velocity values of the slave axis have to be considered.
The step input is sampled once per system clock. Thus, the maximum input frequency is equal to the
half system clock frequency. Please remark, that this also limits the master velocity during interpolated
moves.
5.7
Reference Switch and Stop Switch Interface
The TMC457 is equipped with reference switch that can be programmed for automatic actions. For
details please refer to the register mapping section 6 Register Mapping, page 14 ff. The reference
switch inputs are available to store a position on a reference switch event. Additionally, these inputs
can be enabled to force a stop.
5.8
Micro Step Sequencer
The micro step sequencer can be programmed for different micro step resolutions. The sequencer
controls the mixed decay feature of TRINAMIC stepper motor drivers. Current scaling is also done
TM
under control of the sequencer. When using TMC246 or TMC249 the StallGuard threshold is under
control of the sequencer. A readable register holds the TRINAMIC stepper motor driver status bits and
diagnosis bits.
TM
5.8.1 ChopSync CHOPCLK
TM
To use the ChopSync feature together with a TRINAMIC stepper motor driver the output CHOPCLK
of the TMC457 has to be connected to the PWM oscillator input OSC of the TRINAMIC
stepper motor driver (TMC236, TMC239, TMC246, or TMC249) – without a capacitor at the OSC
input. The recommended chopper frequency fOSC for the TRINAMIC stepper motor driver is 36kHz.
The chopper frequency should not be below 25kHz and must be lower than 50kHz. The chopper
frequency is programmed via the register chop_clk_div.
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
12
Warning: A chopper clock signal with a too high frequency might damage the stepper motor driver due
to dynamic power dissipation overload.
fCLK[Hz]
16.000.000
8.000.000
fCLK[Hz]
fOSC[Hz]
36.000
25.000
36.000
25.000
fOSC[Hz]
chop_clk_div
0x1BC
(=444)
0x280
(=640)
0x0DE
(=222)
0x140
(=320)
fCLK[Hz] / fOSC[Hz]
Table 1 : PWM frequency calculation for ChopSync
5.9
TM
Type and Version Register / Version specific notes and known bugs
The type of the controller and its version can be read out from a register. For the TMC457 version 1.02
one gets 0x00457102 reading the type and version register. This allows hardware detection. Reading
the version allows handling of different version by a single software version.
Version Bug
Description and workaround
1.02
When using linear ramps, setting AMAX to a value lower than 128
results in a strange positioning behavior, when AMAX and DMAX differ.
AMAX lower limit with
linear ramps
This is due to an internal rounding which results in AMAX being used
for deceleration rather than DMAX or vice versa.
This bug will be corrected in future versions.
Workaround:
Use AMAX values above 128, when AMAX and DMAX are required to
be different. AMAX values below 128 are typically only required, when
working with low microstepping resolutions.
Alternative: Use S-shaped ramps.
-1.03
Stop switches do not
become disabled at
move in opposite
direction while actual
velocity is zero
When the motor becomes stopped by a stop switch, a movement into
the opposite direction is not possible without disabling the stop switch.
The reason is that the stop switches are active in any direction when
velocity is zero.
This bug will be corrected in future versions.
Workaround:
Disable stop switch when moving into opposite direction.
5.10 Interrupt Controller
The interrupt controller is programmable for different conditions. If an interrupt condition occurs the
open drain output nINT is pulled to low (activated) if the interrupt mask for the corresponding interrupt
condition is enabled.
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
13
5.11 Sine Wave Look-up Table (SIN-LUT) Access and Parameterization
The TMC457 is equipped with an internal RAM (8192 addresses x 12 bit data) to hold a sine wave
look-up table for micro stepping. This look-up table has to be initialized first after power up of the
TMC457. Depending on the type of motor, a dedicated sine wave table has to be written into the
internal RAM of the TMC457. For both, 8192 values of 12 bit integer have to be calculated. The sine
LUT RAM is accesses via two register addresses, one for read and one for write.
Important Hint: When reading data from RAM, the read data are valid with the next read access. So,
the read data are pipelined with a delay of one SPI datagram.
5.11.1 Calculation of the Sine Wave Look-Up-Table to drive a Piezo Motor
y(x) = 4096 + 4095 * sin(2* x/8192 – 2*/8) with x = 0, 1, 2, 3, …, 8189, 8190, 8191.
5.11.2 Calculation of the Sine Wave Look-Up-Table to drive a Stepper Motor
y(x) = abs( 4095 * sin(2* x/8192) ) with x = 0, 1, 2, 3, …, 8189, 8190, 8191.
With offset, to adjust current zero crossing, the formula becomes
y(x) = offset + abs( (4095 - offset) * sin(2* x/8192) ) with x = 0, 1, 2, 3, …, 8189, 8190, 8191.
The offset has a theoretical range of 0 to 4094. For a practical application, the offset will lie between 0
and 100. When using current scaling, the offset also becomes scaled down – this may be needed to be
taken into account!
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
14
6 Register Mapping
6.1
SPI Datagram Structure
TM
The TMC457 uses 40 Bit SPI (Serial Peripheral Interface, SPI is Trademark of Motorola) datagrams
for communication with a microcontroller. Microcontrollers which are equipped with hardware SPI are
typically able to communicate with integer multiples of 8 bit.
Each datagram sent to the TMC457 is composed of an address byte followed by four data bytes. This
allows direct 32 bit data word communication with the register set of the TMC457. Each register is
accessed via 32 data bits even if it uses less than 32 data bits.
For simplification, each register is specified by a one byte address, where the reading address is given
with the most significant bit = '0'. For a write access, the most significant bit of the address byte is '1'.
Most registers are write only registers, some can be read additionally, and there are also some read
only registers.
6.1.1 Selection of Write / Read (WRITE_notREAD)
The read and write selection is controlled by the MSB of the address byte (bit 39 of the SPI datagram).
This bit is '0' for read access and '1' for write access. So, the bit named W is a WRITE_notREAD
control bit. The active high write bit is the MSB of the address byte. So, 0x80 has to be added to the
address for a write access.
Example: For a read access to the register (x_actual) with the address 0x01, the address byte has to
be set to 0x01. For a write access to the register (x_actual) with the address 0x01, the address byte
has to be set to 0x80 + 0x01 = 0x81. For read access, the data bit might have any value ('-'). So, one
can set them to '0'.
READ x_actual
WRITE x_actual := 0x89ABCDEF;
datagram 0x01000000000;
datagram 0x8189ABCDEF;
TMC457 SPI Datagram Structure
MSB (transmited first)
40 bit
LSB (transmitted last)
39 ...
... 0
8 bit ADDRESS
32 bit DATA
39 ... 32
31 ... 0
W
RW + 7 bit
ADDRESS
8 bit DATA
8 bit DATA
8 bit DATA
39 / 38 ... 32
38...32
31 ... 24
31...28
27...24
23 ... 16
23...20
19...16
15 ... 8
15...12
11...8
8 bit DATA
7 ... 0
7...4
3...0
3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
9 8 7 6 5 4 3 2 1 0
9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
6.1.2 Data Alignment
All data are right aligned. Some registers represent unsigned (positive) values, some represent integer
values (signed) as two’s complement numbers, single bits or groups of bits are represented as single
bits respectively as integer groups.
6.2
Register Block Structure – Register Mapping
All parameterizations take place by register writes. The access to the registers is via SPI. The ramp
generator register set enfolds basic motion control parameters, a ramp generator register set, an
TM
incremental encoder register set, a PID controller register set – named easyPID , a step direction
output configuration register set, a reference switch configuration register set, a micro step sequencer
configuration register, a type & version register, an interrupt configuration register, and a sine wave
look-up table (LUT) RAM port register.
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
15
6.2.1 Nomenclature of Read / Write / Clear on Read / Clear on Write of Registers
Units are written in are given in brackets, e.g. [micro steps]. Read only registers are designated by R.
Read only registers with automatic clear (C) on read are designated by R+C. Registers that are cleared
on write are designated by W+C. Write only registers are designated by W.
6.2.2 Time Scaling by Clock Frequency
Time is scaled by the the clock frequency of the TMC457. This scales velocity, acceleration, and bow.
So, velocity is given in unit [micro steps per time] and not as [micro steps per second], acceleration is
given in unit [micro steps per time^2] and not unit [micro steps per second^2]. Formulas for the
conversion into units based on time in seconds is given in section 0, page 26.
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
16
Ramp Generator Register Set – Basic Motion Control Parameters
R/W
Addr
Bits
Register
RW
0x00
9…0
RW
R
0x01
0x02
31…0
31…0
x_actual
v_actual
W
0x03
30…0
v_max
W
0x04
31…0
v_target
W
0x05
23…0
a_max
W
0x06
23…0
d_max
W
0x07
23…0
d_stop
W
0x08
4…0
W
0x09
31…0
W
0x0A
31…0
R
0x0B
4…0
mode
bow_max
x_target
x_compare
status
R
0x0C
31…0
a_actual
W
0x0D
15…0
sd_scale
0x0E
-
0X0F
23…0
W
a_max_
d_max
Description
bit 1,0: ramp_mode
00 = positioning mode
01 = reserved
10 = velocity mode
11 = hold mode
bit 2: step_dir_enable
bit 4: shaft
bit 8: PID_on
bit 9: PID_base v_actual
Range [Unit]
default =
%0000000010
Actual position
Actual velocity
Maximum velocity for positioning mode
± [µsteps]
± [µsteps / t]
0 to $7FFF0000
for any a_max
[µsteps / t]
± $7FFF0000 for
any a_max
[µsteps / t]
0 to $FFFFFD
[µsteps / t^2]
0 to $FFFFFD
[µsteps / t^2]
Target velocity
The sign determines the direction in velocity
mode and hold mode.
Acceleration, unsigned fixed point 16.8
representation
Deceleration parameter, unsigned
Fixed point 16.8 representation
The effective deceleration with s-ramp
enabled is 15/16 of d_max.
Deceleration for stop event, for security
reason it is with bow = 0
S-Ramp configuration
0=linear ramp (trapezoid)
bow_index = 1, 2, 3, …, 18
bow_value = 1, 2, 4, …, 262144
Target position for automatic ramp in unit
micro steps
POSCOMP output function:
The position x_compare is compared either
with x_actual or with the encoder position
enc_x. (Selection bit: enc_clr_mode.12.)
POSCOMP becomes
0 : for x_actual ≤ x_compare
1 : for x_actual > x_compare
bit 0: target_pos_reached
bit 1: target_v_reached
bit 2: v_is_zero
bit 3: - (reserved)
bit 4: enc_warn_dist
Actual acceleration value
Important note: a_max resp. d_max can be
exceeded by up to 1/1024 of the bow_value
if 1/1024*bow_value is not an integer divider
of a_max resp. d_max
Step Direction input control:
bit 14…0: sd_scaler
bit 15: sd_scale_sign
reserved
Sets a_max and d_max to the same value
with a single write access to register
a_max_d_max
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
[µsteps / t^2]
bow_value
[µsteps / t^3]
± [µsteps]
± [µsteps]
0, …, ± a_max
resp. d_max
resp. d_stop;
[µsteps / t^2]
dir & c
(caccumulatio
n constant-1)
[µsteps / t^2]
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
17
0x00: mode - Ramp Generator Register
R/W
RW
Bit
1,0
Function
ramp_
mode
RW
2
step_dir_
enable
RW
4
shaft
RW
8
PID_on
Value
00
01
10
11
0
1
0
1
0
1
RW
9
PID_base
0
1
Description
positioning mode
reserved
velocity mode (default mode on RESET)
hold mode (sets v_actual equal to v_target)
step direction inputs are ignored
The step and direction inputs (STEP_IN, DIR_IN) become scaled
by sd_scale. In this mode, x_target becomes directly controlled
by the scaled step inputs. In order to allow the motor to directly
follow the control signals, set to positioning mode and set a high
acceleration value a_max_d_max with bow set to zero.
Normal direction of the output pulse generator
Inverts the direction of the output pulse generator
PID controller is completely off, all values are frozen. The output
pulse generator is fed by v_actual directly.
PID controller is on. This mode also allows access to the PID
error pid_e, which is required for a number of other functions.
For normal operation, also set PID_base flag to v_actual base.
The pulse generator output is controlled by the PID calculation
result only. The motor will not move, if PID result is zero.
PID output base is v_actual. The PID result is added to the
velocity output generated by the ramp generator and becomes
clipped to 2^31-1.
0x08: bow_max - Ramp Generator Register
R/W
W
Bit
4…0
Function
bow_index
Value
0
1
to
18
Description
The ramp generator uses trapezoid ramps. This corresponds to
an infinite bow value.
Bow for s-shaped ramps in logarithmic representation. A high
bow value leads to a shorter bow phase. The bow_value is
added with 1/1024 fCLK[Hz] to acceleration a_actual up to the
value set by a_max for acceleration resp. d_max for
deceleration.
bow_value = 2^(bow_index-1)
bow_index = 1, 2, 3, …, 18
bow_value = 1, 2, 4, …, 262144
Attention on bow setting:
The resulting bow_value must not exceed A_MAX or D_MAX
setting. Otherwise oscillations may result.
0x0b: status - Ramp Generator Register
R/W
R
Bit
0
1
2
3
4
Function
target_pos
_reached
Value
1
target_v_
reached
v_is_zero
enc_warn_
dist_status
1
1
1
Description
Signals that the motor has stopped at the target position
(x_actual=x_target), or at a position determined by
PositionLimit_L or PositionLimit_R.
Signals that v_actual has reached v_target, respectively v_max
during an automatic ramp.
Signals that the motor has stopped.
Unused (reserved)
Signals that the deviation between encoder position and actual
ramp position exceeds the warning threshold enc_warn_dist.
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
18
0x0D: sd_scale - Ramp Generator Register
R/W
W
Bit
14...0
Function
sd_scaler
Value
x
15
sd_scale_
sign
0
1
Description
Each step input pulse counts up resp. down x_target by
(x+1) / (2^15)
Count up when direction input is positive
Count down when direction input is positive
Encoder Register Set
R/W
Addr
Bits
W
0x10
31…0
enc_const
RW
0x11
31…0
enc_x
W
0x12
12…0
enc_mode
R+C
0x13
0
enc_status
R
0x14
31…0
enc_latch
R
0x15
31…0
x_act_latch
W
0x16
Register
19…0
enc_warn_
dist
Description
Accumulation constant,
16 bit integer part, 16 bit fractional part
enc_x accumulates
+/- enc_const / (2^16* enc_x) (binary)
or
+/- enc_const / (10^4* enc_x) (decimal)
To switch between decimal and binary
setting, see enc_mode bit 13.
Use the sign, to match rotation direction!
Range [Unit]
binary:
± [µsteps/2^16]
±(0…32767.0…
65535)
decimal:
±(0…32767.0…
9999)
default = 1.0
(=65536)
Actual encoder position
bit 0 : pol_A
bit 1 : pol_B
bit 2 : pol_N
bit 3 : ignore_AB
bit 4 : clr_cont
bit 5 : clr_once
bit 6 : pos_edge
bit 7 : neg_edge
bit 8 : clr_enc_x
bit 12 : x_comp_sel_enc
bit 13 : enc_sel_decimal
bit 0 : N_event
Encoder N event detected, status bit is
cleared on read: Read (R) + clear (C)
Encoder position enc_x latched on N event
Motor position x_actual latched on
reference switch event or virtual stop switch
event
Warning threshold for motor to encoder
deviation (x_actual - enc_x). This function
uses pid_e. An interrupt can be triggered
when the threshold is exceeded.
abs(pid_e) > enc_warn_dist
± [µsteps]
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
[µsteps]
[µsteps]
[µsteps]
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
19
0x12: enc_mode - Encoder Register
R/W
Bit
0
1
2
3
4
5
6
Function
pol_A
pol_B
pol_N
ignore_AB
clr_cont
clr_once
pos_edge
Value
x
x
x
x
1
1
1
7
neg_edge
1
8
clr_enc_x
0
1
9
10
11
12
x_comp_
sel_enc
enc_sel_
decimal
13
0
1
0
1
Description
A polarity when N is active
B polarity when N is active
defines polarity of N
Ignore A and B polarity
continuous clear while N is active (clear once per revolution)
N event enable, clear on next N event
N positive edge trigger (when N becomes active)
Disables N level control
N negative edge trigger (when N becomes inactive)
Disables N level control
Upon N event, the enc_x becomes latched to enc_latch only
Additionally clear encoder counter enc_x at N-event
- (reserved)
- (reserved)
- (reserved)
Source for POSCOMP: x_compare is compared to x_actual
x_compare is compared to enc_x
Encoder divisor binary: Counts in n/65536
Encoder divisor decimal: Counts in n/10000
Vector Control Register Set
R/W
Addr
Bits
Register
W
0x17
11…0
venc_us_
const
RW
0x18
7…0
venc_us_
pos
W
0x19
9…8,
1…0
venc_us_
sel
Description
Accumulation constant,
6 integer part, 6 bit fractional part
venc_us_const = 64*(motor full steps per
rotation) / encoder resolution
0.0: vector control off
Use the sign, to match rotation direction!
Actual
encoder
position
(use
for
initialization of function – position must
match selected microstep_adr bits)
bit 0,1 : venc_microstep_resolution
00 = 2048 microsteps
01 = 1024 microsteps
10 = 256 microsteps
11 = 64 microsteps
selects bits from microstep_adr (0x33) to
match one electrical period
bit 8, 9 : venc_phi_load_sel
00 = 90°
01 = 101,25°
10 = 112,5 °
11 = 121,75°
selects maximum motor load angle
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
Range [Unit]
± [µsteps/64]
default = 0 (off)
[256 / electrical
period]
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
20
0x19: venc_us_sel – Vector Control Register
R/W
W
Bit
1, 0
Function
venc_us_
sel
Value
00
01
10
11
9, 8
venc_phi_
load_sel
00
01
10
11
PID Register Set - easyPID
Description
2048 microsteps: microstep_adr bits 12 downto 5 are used
determine angle within one electrical period
1024 microsteps: microstep_adr bits 11 downto 4 are used
determine angle within one electrical period
256 microsteps: microstep_adr bits 9 downto 2 are used
determine angle within one electrical period
64 microsteps: microstep_adr bits 7 downto 0 are used
determine angle within one electrical period
vector encoder function load angle limit to
+/- 90°
(64/256 of an electrical period) (max. torque)
+/- 101.25°
(72/256 of an electrical period)
+/- 112,5°
(80/256 of an electrical period)
+/- 123,75°
(88/256 of an electrical period) (max. velocity)
to
to
to
to
TM
R/W
Addr
Bits
Register
W
0x20
23…0
pid_p
W
0x21
23…0
pid_i
W
0x22
23…0
pid_d
W
0x23
14…0
pid_iclip
R
W+C
0x24
31…0
pid_isum
pid_d_
clkdiv
W
0x25
7…0
W
0x26
-
W
0x27
30…0
pid_dv_clip
R
0x28
23…0
(31…
0)
pid_e
R
0x29
31…0
pid_v_actual
W
0x2A
19…0
pid_tolerance
-
Description
P parameter (unsigned)
update frequency fCLK/128;
Result: pid_e*pid_p/256
(becomes clipped to +/-2^31)
I parameter (unsigned)
Result: (pid_isum/256)*pid_i/256
(becomes clipped to +/-2^31)
D parameter (unsigned),
pid_e is sampled with a frequency of
(fCLK[Hz]/128/pid_d_clkdiv).
Result: (pid_e_last–pid_e_now) * pid_d
(The delta-error (pid_e_last–pid_e_now)
becomes clipped to +/-127)
Clipping parameter for pid_isum
Clipping of (pid_isum*2^16*pid_iclip)
PID integrator sum (signed)
Updated with fCLK[Hz]/128
Cleared to zero upon write access
Clock divider for D part calculation
D-part is calculated with a frequency of:
fCLK / (pid_d_clkdiv*128)
(Attention: pid_d_clkdiv=0 results in 256)
Clipping parameter for PID calculation
result pid_v_actual
pid_v_actual = v_actual + clip(PID_result,
pid_dv_clip)
Position deviation (for monitoring)
pid_e = enc_x – x_actual
(clipped to +/-2^23)
PID calculation result (with PID_base=0)
resp. PID_result + v_actual (PID_base=1)
(clipped to +/-2^31)
Tolerance for PID regulation
If the absolute value of the error pid_e is
below pid_tolerance after an exact hit,
then the pid_error_in becomes 0 and
pid_i_sum is set to zero, until the
tolerance zone is left again.
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
Range
(0: disable)
(0: disable)
(0: disable)
0…$7F80
±
1…255, 0
= 1…256
bits 7…0 are
always 0
(0: disable PID)
±2^23
±
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
21
Step Direction Output Configuration Register Set
R/W
Addr
Bits
Register
W
0x30
28…0
pulse_max
pulse_xstep_div
W
0x31
15…0
W
0x32
0
step_dir_mode
RW
0x33
12…0
microstep_adr
W
0x34
11…0
stdby_delay
W
0x35
7…0
pulse_length
Description
Velocity threshold for resolution
indication output HIRES_OUT
If v_actual ≥ pulse_max then output
HIRES = 1
The driver stage can do extended
steps based on XSTEP_OUT
Pulse divisor for XSTEP_OUT output
control
One XSTEP_OUT pulse is generated
after each pulse_xstep_div steps
0: disable STEP_OUT delay
1: enable STEP_OUT delay after a
change of the direction (DIR_OUT)
(It is recommended to disable the
delay, unless a step / direction drive is
used)
Actual micro step position within lookup table
Stand-by delay, time is given in 1/fCLK /
2^16
Pulse length in clock periods for
STEP_OUT and XSTEP_OUT outputs
(DIR_OUT remains stable during
STEP_OUT
active,
XSTEP_OUT
occurs 2 clock periods later)
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
Range
bits 20…0 are
always 0
1…65535
default=16
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
22
Reference Switch Configuration Register Set
R/W
Addr
Bits
Register
RW
0x40
13…0
switch_mode
R,
R+C
0x41
6…0
switch_status
W
0x42
31…0
pos_limit_L
W
0x43
31…0
pos_limit_R
Description
bit 0: stop_L
bit 1: stop_R
bit 2: pol_stop_L
bit 3: pol_stop_R
bit 4: swap_LR
bit 5: soft_stop
bit 6: en_lim_L
bit 7: en_lim_R
bit 8: latch_L_act
bit 9: latch_L_inact
bit 10: latch_R_act
bit 11: latch_R_inact
bit 12: en_latch_enc
bit 13: SG_stop
bit 0 : status_stop_L
bit 1 : status_stop_R
bit 2 : status_latch_L
bit 3: status_latch_R
bit 4: event_stop_L
bit 5: event_stop_R
bit 6: event_stop_SG
Software controlled stop position,
programmable virtual stop switch
If enabled, the motor will automatically
slow down and come to a stop at the
pos_limit rather than crossing it.
Software controlled stop position,
programmable virtual stop switch
If enabled, the motor will automatically
slow down and come to a stop at the
pos_limit rather than crossing it.
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
Range
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
23
0x40: switch_mode – Reference Switch Configuration Register
R/W
R/W
Bit
0
1
2
Function
stop_L
stop_R
pol_stop_L
3
pol_stop_R
4
swap_LR
Value
1
1
0
1
0
1
0
1
5
soft_stop
0
1
6
7
8
en_lim_L
en_lim_R
latch_L_act
1
1
1
9
latch_L_inact
1
10
latch_R_act
1
11
latch_R_inact
1
12
en_latch_enc
0
1
13
stop_SG
1
Description
Enable stop switch left
Enable stop switch right
Left stop switch is positive active (STOP_L=1 stops motor)
Left stop switch is negative active (STOP_L=0 stops motor)
Right stop switch is positive active (STOP_R=1 stops motor)
Right stop switch is negative active (STOP_R=0 stops motor)
STOP_L stops motor when driving in negative direction,
STOP_R stops motor when driving in positive direction
Stop inputs are swapped:
STOP_R stops motor when driving in negative direction,
STOP_L stops motor when driving in positive direction
The motor velocity is switched to 0 when hitting a stop switch
(hard stop).
SoftStop enable:
The motor is slowed down to 0 using a linear ramp using
acceleration d_stop when hitting a stop switch.
Position limit L pos_limit_L enable (virtual stop switch)
Position limit R pos_limit_R enable (virtual stop switch)
Latch ramp position to x_act_latch on stop switch left going
active.
Latch ramp position to x_act_latch on stop switch left going
inactive.
Latch ramp position to x_act_latch on stop switch right going
active.
Latch ramp position to x_act_latch on stop switch right going
inactive.
Encoder position is not latched upon stop switch event.
Also latch encoder position together with ramp position to
enc_latch.
Stop motor on StallGuard event signaled by TMC246 / TMC249
0x41: switch_status – Reference Switch Configuration Register
R/W
R
R+C
R
R+C
Bit
0
1
2
Function
status_stop_L
status_stop_R
status_latch_L
Value
1
1
1
3
status_latch_R
1
4
5
6
event_stop_L
event_stop_R
event_stop_
SG
1
1
1
Description
Stop switch left status (1=active)
Stop switch right status (1=active)
Latch left ready (corresponding to switch_mode latch_L_act or
latch_L_inact) (Flag is cleared upon reading)
Latch right ready (corresponding to switch_mode latch_R_act or
latch_R_inact) (Flag is cleared upon reading)
Signals an active stop left condition due to stop switch
Signals an active stop right condition due to stop switch
Signals an active StallGuard stop event
(Flag is cleared upon reading)
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
24
Sequencer Configuration Register
R/W
RW
W
Addr
0x50
0x51
0x52
0x53
Bits
0x54
8…0
0x55
W
R
R
0x56
dacscale_icntl
2…0
stallguard_thrs
stallguard_
value
2…0
0x58
W
seq_mode
23…0
2…0
0x57
Register
- (reserved)
- (reserved)
- (reserved)
- (reserved)
driver_status
- (reserved)
chop_clk_div
0x59
11…0
Description
bit 3…0: microstep table length
Controls the number of microsteps per
electrical period. For a stepper motor,
the resulting microstep rate is ¼ of the
table length.
Values:
0: 8192 entries (Default),
1: 4096 entries, …
10: 8 entries,
11: 4 entries (full stepping)
bit 8: sequencer stop
bit 0..4: current_op
bit 7: mixdecay_op
bit 8..12: current_sb
bit 15: mixdecay_sb
StallGuard threshold
actual StallGuard value reported by
TMC249
Driver status read back information:
bit 0 : tmcdrv_error (OT, UV, OCHS,
OCB, OCA. i.e. all driver shutdown
conditions)
bit 1 : tmcdrv_otpw (over temperature
pre-warning)
bit 2 : tmcdrv_stall (StallGuard)
chopper clock frequency register
(for safety reasons a value below 96 can
not be set)
Range
default=%
00000000
00000000
10010000
0…7
0…7
96…818
default = 640
0x55: dacscale_icntl – Sequencer Configuration Register
R/W
W
Bit
4…0
7
12…8
15
Function
current_op
mixdecay_op
current_sb
mixdecay_sb
Value
0…16
1
0…16
1
Description
Motor current scale during operation (Default=16)
Allows a current scaling by scaling the sine table entries
before sending to the DACs or to the SPI stepper drivers.
This function is available only for stepper motors.
16 = 100%
15...1 = 15 / 16 ... 1 / 16
0 = DAC disable / stepper driver disable
Mixed Decay Enable Operation (Default = 1)
Enables the TMC23X / TMC24X mixed decay feature during
motor operation.
Standby current scale (Default=0)
The motor is switched to the standby current after a delay
time controller by stdby_delay.
Same values as for current_op.
Mixed Decay Enable Standby (Default=0)
Enables the TMC23X / TMC24X mixed decay feature during
motor stand still.
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
25
Type & Version Register
R/W
R
Addr
0x60
Bits
23…0
Register
version
Description
TMC457 v. 1.00 0x457100
Range
Description
bit 0: int_target
bit 1: int_deviation
bit 2: int_N
bit 3: int_stop
bit 4: int_drvstatus
bit 5: int_ref_L
bit 6: int_ref_R
bit 7: int_x_comp
Same assignments as int_mask register. An
active interrupt bit reads out as '1'. Writing a 1
to an active bit resets the interrupt flag. The
interrupt output becomes active (low) as soon
as at least one bit is set.
Range
Interrupt Configuration Register
R/W
Addr
Bits
Register
W
0x61
7…0
int_mask
R
W+C
0x62
7…0
int_flag
0x61: int_mask – Interrupt Configuration Register
R/W
W
Bit
0
Function
int_target
Value
1
1
int_deviation
1
2
int_N
1
3
int_stop
1
4
int_drvstatus
1
5
int_ref_L
1
6
int_ref_R
1
7
int_x_comp
1
Description
Target position reached interrupt:
If set, an interrupt is issued when the motor comes to a standstill
at x_target
Encoder position mismatch interrupt:
If set, an interrupt is issued, when pid_e exceeds the tolerance
value pid_tolerance.
Encoder N event interrupt :
If set, an interrupt is issued upon an encoder N event, as defined
by enc_clr_mode.
Stop condition interrupt:
If set, an interrupt is issued upon a motor stop condition, as
defined by switch_mode.
Driver status interrupt:
If set, an interrupt is issued upon a driver error detected in the
driver_status bits.
Reference switch left interrupt:
If set, an interrupt becomes issued upon activation of the left
reference switch.
Reference switch right interrupt:
If set, an interrupt is issued upon activation of the right reference
switch.
POSCOMP (x_compare) change interrupt:
If set, an interrupt is issued, when the polarity of the POSCOMP
output changes.
Attention: For a move right, this is when x_actual (resp. enc_x)
becomes larger than x_compare, i.e. reaches x_compare+1. For
a move left, it is upon position match!
Attention: Modifying the compare position also will trigger the
interrupt flag and will toggle the output, when the comparison
result differs.
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
26
Sine Wave Look-Up Table (LUT) Port Register
R/W
Addr
Bits
Register
R
0x7F
31…16
15…0
RAM
READ (data D of last A)
W
0xFF
31…16
15…0
RAM
WRITE
6.2.3
Description
Range
xxxAAAAAAAAAAAAA
xxxxDDDDDDDDDDDD
(data of this address come
on next read)
xxxAAAAAAAAAAAAA
xxxxDDDDDDDDDDDD
Real World Units vs. Units of the TMC457
The units of a TMC457 register content are written as register[457].
Parameter vs. Units
Parameter / Symbol
fCLK[Hz]
s
US
FS
velocity v[Hz]
acceleration a[Hz/s]
micro step resolution USR
(used U instead of µ for
micro)
Unit
[Hz]
[s]
microstep
fullstep
microsteps / s
microsteps / s^2
v[FS] @ USR
US/s
a[FS/^2] @ USR
US/s^2
ramp_steps[457] = rs
[457]
counts
calculation / description / comment
clock frequency of the TMC457 in [Hz]
second
v[Hz] = v[457] * ( 2 * fCLK[Hz] / 2^31 )
a[Hz/s] = a[457] * fCLK[Hz]^2 / (16*256) / 2^30
micro step resolution in number of microsteps
(i.e. the number of microsteps between two
fullsteps)
v[FS/s] = v[US/2] / USR
USR microstep resolution
a[FS/s^2] = a[US/s] / USR
rs = 2 * (v[457])^2 / (a[457]) / 2^18
micro steps during linear acceleration ramp
(if v_max is really reached during acceleration)
Copyright © 2008-2013 TRINAMIC Motion Control GmbH & Co. KG
TMC457 DATASHEET (V. 1.20 / 2013-July-11)
27
7 Examples
Following, some examples are given how to program the TMC457 to do a desired task. The examples
are given as sequences of SPI datagram as 40 bit hexadecimal number with an additional comment.
$89 12 34 56 78
// set x_target := $12 34 56 78
So, for this example the datagram is $89 12 34 56 78. That datagram sets the register x_target to the
hexadecimal value $12345678.
7.1
How to Get a Motor Running
// initialize the sine wave look-up table once (either for stepper motor or for piezo motor).
for (x=0; x