Micro Stepping Stepper Motor
Controller / Driver with Two Wire Serial Interface
TRINAMIC® Motion Control GmbH & Co. KG
SDA
SCL
VDD
GND
TST
open
GND
HW
CPN
CPP
1
2
3
4
5
6
7
8
9
10
TRINAMIC
TMC222
20
SWI
19
VBAT
18
OA1
GND
OA2
OB1
GND
OB2
VBAT
VCP
OB2
OB2
VBAT
VBAT
VBAT
VCP
CPP
CPN
17
16
15
14
13
12
11
GND
1718192021222324
NC
GND
HW
OB1
GND
OA2
OB1
TMC 222
QFN32
Top view
open
TST
OA2
GND
GND
VDD
GND
3231302928272625
910111213141516
SCL
Sternstraße 67
D – 20357 Hamburg
GERMANY
12345678
OA1
OA1
VBAT
VBAT
VBAT
SWI
NC
SDA
P +49 - (0) 40 - 51 48 06 - 0
F +49 - (0) 40 - 51 48 06 - 60
www.trinamic.com
info@trinamic.com
1 Features
The TMC222 is a combined micro-stepping stepper motor motion controller and driver with RAM and
OTP memory. The RAM or OTP memory is used to store motor parameters and configuration
settings. The TMC222 allows up to four bit of micro stepping and a coil current of up to 800 mA. After
initialization it performs all time critical tasks autonomously based on target positions and velocity
parameters. Communications to a host takes place via a two wire serial interface. Together with an
inexpensive micro controller the TMC222 forms a complete motion control system. The main benefits
of the TMC222 are:
• Motor driver
• Controls one stepper motor with four bit micro stepping
• Programmable Coil current up to 800 mA
• Supply voltage range operating range 8V ... 29V
• Fixed frequency PWM current control with automatic selection of fast and slow decay mode
• Full step frequencies up to 1 kHz
• High temperature, open circuit, short, over-current and under-voltage diagnostics
• Motion controller
• Internal 16-bit wide position counter
• Configurable speed and acceleration settings
• Build-in ramp generator for autonomous positioning and speed control
• On-the-fly alteration of target position
• reference switch input available for read out
• Two wire serial interface
• Transfer rates up to 350 kbps
• Diagnostics and status information as well as motion parameters accessible
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.
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 form
its use.
Motor parameters, e.g. acceleration, velocity and position parameters are passed to the main control
block via the serial interface. These information are stored internally in RAM or OTP memory and are
accessible by the position controller. This block takes over all time critical tasks to drive a stepper
motor to the desired position under abiding the desired motion parameters.
The main controller gets feedback from the stepper motor driver block and is able to arrange internal
actions in case of possible problems. Diagnostics information about problems and errors are
transferred to the serial interface block.
2.3 Stepper Motor Driver
Two H-bridges are employed to drive both windings of a bipolar stepper motor. The internal
transistors can reach an output current of up to 800 mA. The PWM principle is used to force the given
current through the coils. The regulation loop performs a comparison between the sensed output
current and the internal reference. The PWM signals to drive the power transistors are derived from
the output of the current comparator.
2.4 Two Wire Serial Interface
Communication between a host and the TMC222 takes places via the two wire bi-directional serial
interface. Motion instructions and diagnostics information are provided to or from the Main Control
block. It is possible to connect up to 32 devices on the same bus. Slave addresses are programmable
via OTP memory or an external pin.
TST 5 12 test pin (to be tied to ground in normal operation)
open 6 13 must be left open
HW 8 15 hard-wired serial interface address bit input
CPN 9 17 negative connection of external charge pump capacitor
CPP 10 18 positive connection of external charge pump capacitor
VCP 11 19 connection of external charge pump filter capacitor
VBAT 12, 19 3-5,20-22 battery voltage supply
OB2 13 23,24 negative end of phase B coil
OB1 15 27,28 positive end of phase B coil
OA2 16 29,30 negative end of phase A coil
OA1 18 1,2 positive end of phase A coil
SWI 20 6 reference switch input
NC 7,16 internally not connected (shields when connected to ground)
The TMC222 supports up to 16 micro steps per full step, which leads to smooth and low torque ripple
motion of the stepping motor. Four stepping modes (micro step resolutions) are selectable by the user
(see also Table 11):
• Half step Mode
• 1/4 Micro stepping
• 1/8 Micro stepping
• 1/16 Micro stepping
5.1.2 Velocity Ramp
A common velocity ramp where a motor drives to a desired position is shown in the figure below. The
motion consists of a acceleration phase, a phase of constant speed and a final deceleration phase.
Both the acceleration and the deceleration are symmetrical. The acceleration factor can be chosen
from a table with 16 entries. (Table 5: Acc Parameter on page 11). A typical motion begins with a start
velocity Vmin. During acceleration phase the velocity is increased until Vmax is reached. After
acceleration phase the motion is continued with velocity Vmax until the velocity has to be decreased
in order to stop at the desired target position. Both velocity parameters Vmin and Vmax are
programmable, whereas Vmin is a programmable ratio of Vmax. (See Table 3: Vmax Parameter on
page 10 and Table 4: Vmin on page 11). The user has to take into account that Vmin is not allowed
to change while a motion is ongoing. Vmax is only allowed to change under special circumstances.
(See 5.1.4 Vmax Parameter on page 10).
The peak current value to be fed to each coil of the stepper-motor is selectable from a table with 16
possible values. It has to be distinguished between the run current Irun and the hold current Ihold.
Irun is fed through the stepper motor coils while a motion is performed, whereas Ihold is the current to
hold the stepper motor before or after a motion. More details about Irun and Ihold can be found in
5.3.1. and 5.3.2.
Velocity resp. acceleration parameters are accessable via the serial interface. These parameters are
written via the SetMotorParam command (see 6.8.9) and read via the GetFullStatus1 command (see
The following figures show some examples of typical motions under different conditions:
Velocity V
V
max
V
min
X
start
X
target_1
X
target_2
time
Figure 2: Motion with change of target position
Velocity V
V
max
V
min
X
start
X
target_1
X
target_2
time
Figure 3: Motion with change of target position while in deceleration phase
Velocity V
V
max
V
min
X
start
X
target
time
Figure 4: Short Motion Vmax is not reached
Velocity V
V
max
V
min
X
start
X
target_1
X
target_2
time
Figure 5: Linear Zero crossing (change of target position in opposite direction)
The motor crosses zero velocity with a linear shape. The velocity can be smaller than the
programmed Vmin value during zero crossing. Linear zero crossing provides very low torque ripple to
the stepper motor during crossing.
Under special circumstances it is possible to change the Vmax parameters while a motion is ongoing.
All 16 entries for the Vmax parameter are divided into four groups A, B, C and D. When changing
Vmax during a motion take care that the new Vmax value is within the same group. Background: The
TMC222 uses an internal pre-divider for positioning calculations. Within one group the pre-divider is
equal. When changing Vmax between different groups during a motion, correct positioning is not
ensured anymore.
The minimum velocity parameter is a programmable ratio between 1/32 and 15/32 of Vmax. It is also
possible to set Vmin to the same velocity as Vmax by setting Vmin index to zero. The table below
shows the possible rounded values of Vmin given within unit [FS/s].
Table 4: Vmin values [FS/s] for all Vmin index – Vmax index combinations
5.1.6 Acceleration Parameter
The acceleration parameter can be chosen from a wide range of available values as described in the
table below. Please note that the acceleration parameter is not to change while a motion is ongoing.
The amount of equivalent full steps during acceleration phase can be computed by the next equation:
Nstep
2
V
?
?
V
2
minmax
?
5.1.7 Position Ranges
Position information is coded by using two’s complement format. Depending on the stepping mode
(See 5.1.1) the position ranges are as listed in the following table:
Stepping Mode Position Range Full range excursion
Half-stepping -4096…+4095
(-212…+212-1)
1/4 micro-stepping -8192…+8191
(-213…+213-1)
1/8 micro-stepping -16384…+16383
(-214…+214-1)
1/16 micro-stepping -32768…+32767
(-215…+215-1)
8192 half-steps
213
16384 micro-steps
214
32768 micro-steps
215
65536 micro-steps
216
Table 6: Position Ranges
Target positions can be programmed via serial interface by using the SetPosition command (see
6.8.11). The actual motor position can be read by the GetFullStatus2 command (see 6.8.2).
5.1.8 Secure Position
The GotoSecurePosition command drives the motor to a pre-programmed secure position (see 6.8.4).
The secure position is programmable by the user. Secure position is coded with 11 bits, therefore the
resolution is lower than for normal positioning commands, as shown in the following table.
Pin SWI (see Figure 1, on page 7) will attempt to source and sink current in/from the external switch
pin. This is to check whether the external switch is open or closed, resp. if the pin is connected to
ground or Vbat. The status of the switch can be read by using the GetFullStatus1 command. As long
as the switch is open, the <ESW> flag is set to zero.
The ESW flag just represents the status of the input switch. The SWI input is intended as a physical
interface for a mechanical switch that requires a cleaning current for proper operation. The SWI input
detects if the switch is open or connected either to ground or to Vbat. The SWI input is not a digital
logic level input. The status of the switch does not automatically perform actions as latching of the
actual position. Those actions have to be realized by the application software.
A stepper motor does not provide information about the actual position of the motor. Therefore it is
recommended to perform a reference drive after power-up or if a motor shutdown happened in case
of a problem. The RunInit command initiates the reference search. The RunInit command consists of
a Vmin and Vmax parameter and also position information about the end of first and second motion
(6.8.8 RunInit).
A reference drive consists of two motions (Figure 6: RunInit): The first motion is to drive the motor
into a stall position or a reference switch. The first motion is performed under compliance of the
selected Vmax and Vmin parameter and the acceleration parameter specified in the RAM. The
second motion has got a rectangular shape, without a acceleration phase and is to drive the motor out
of the stall position or slowly towards the stall position again to compensate for the bouncing of the
faster first motion to stop as close to the stall position as possible. The maximum velocity of the
second motion equals to Vmin. The positions of Pos1 and Pos2 can be chosen freely (Pos1 > Pos2 or
Pos1 < Pos2). After the second motion the actual position register is set to zero. Finally, the secure
position will be traveled to if it is enabled (different from the most negative decimal value of –1024).
Once the RunInit command is started it can not be interrupted by any other command except a
condition occurs which leads to a motor shutdown (See 5.1.10 Motor Shutdown Management ) or a
HardStop command is received. Furthermore the master has to ensure that the target position of the
first motion is not equal to the actual position of the stepper motor and that the target positions of the
first and the second motion are not equal. This is very important otherwise the circuit goes into a
deadlock state. Once the circuit finds itself in a deadlock state only a HardStop command followed by
a GetFullStatus1 command will cause the circuit to leave the deadlock state.