TRINAMIC TMC5031

POWER DRIVER FOR STEPPER MOTORS
INTEGRATED CIRCUITS
TMC5031 DATASHEET
Dual, cost-effective controller and driver for up to two 2-phase bipolar stepper motors.
Integrated motion controller with SPI interface.
APPLICATIONS
CCTV, Security
Antenna Positioning
Heliostat Controller
Battery powered applications
Office Automation
ATM, Cash recycler, POS
Lab Automation
Liquid Handling
Medical
Printer and Scanner
Pumps and Valves
FEATURES
AND
DESCRIPTION
BENEFITS
2-phase stepper motors
Drive Capability up to 2 x 1.1A coil current
Motion Controller with sixPoint™ ramp
Voltage Range 4.75… 16V DC
SPI Interface
2x Ref.-Switch input per axis
Highest Resolution 256 microsteps per full step
Full Protection & Diagnostics
stallGuard2™ high precision sensorless motor load detection
coolStep™ load dependent current control for energy savings up
to 75%
spreadCycle™ high-precision chopper for best current sine wave
form and zero crossing with additional chopSync2™
Compact Size 7x7mm QFN48 package
BLOCK DIAGRAM
The TMC5031 is a low cost motion controller
and driver IC for up to two stepper motors.
It combines two flexible ramp motion
controllers with energy efficient stepper
motor drivers. The drivers support two-phase
stepper motors and offer an industry-leading
feature
set,
including
high-resolution
microstepping, sensorless mechanical load
measurement, load-adaptive power optimization, and low-resonance chopper operation.
All features are controlled by a standard
SPI™ interface. Integrated protection and
diagnostic features support robust and
reliable operation. High integration, high
energy efficiency and small form factor
enable miniaturized designs with low
external component count for cost-effective
and highly competitive solutions.
2x Ref. Switches
TMC5031
Power
Supply
Charge
Pump
MOTION CONTROLLER
with Linear 6 Point
RAMP Generator
Programmable
256 µStep
Sequencer
Motor 1
DRIVER 1
Protection
& Diagnostics
SPI
Protection
& Diagnostics
MOTION CONTROLLER
with Linear 6 Point
RAMP Generator
Programmable
256 µStep
Sequencer
stallGuard2
2x Ref. Switches
TRINAMIC Motion Control GmbH & Co. KG
Hamburg, Germany
Motor 2
DRIVER 2
coolStep
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
2
APPLICATION EXAMPLES: HIGH FLEXIBILITY – MULTIPURPOSE USE
The TMC5031 scores with power density, complete motion controlling features and integrated power
stages. It offers a versatility that covers a wide spectrum of applications from battery systems up to
embedded applications with 1.1A current per motor. The small form factor keeps costs down and allows for
miniaturized layouts. Extensive support at the chip, board, and software levels enables rapid design cycles
and fast time-to-market with competitive products. High energy efficiency and reliability from TRINAMIC’s
coolStep technology deliver cost savings in related systems such as power supplies and cooling.
MINIATURIZED DESIGN
FOR UP TO TWO
STEPPER MOTORS
Ref.
Switches
High-Level
Interface
CPU
SPI
M
TMC5031
Two
reference
switch
inputs can be used for
each motor. A single CPU
controls
the
whole
system, which is highly
economical and space
saving.
Ref.
Switches
High-Level
Interface
CPU
SPI
M
TMC5031
M
Ref.
Switches
ORDER CODES
Order code
TMC5031-LA
www.trinamic.com
Description
Dual stallGuard2™ and coolStep™ controller/driver, QFN48
Size
7 x 7 mm2
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
3
TABLE OF CONTENTS
1
PRINCIPLES OF OPERATION
1.1
1.2
1.3
1.4
1.5
1.6
1.7
2
KEY CONCEPTS
4
SPI CONTROL INTERFACE
5
SOFTWARE
5
MOVING AND CONTROLLING THE MOTOR
5
PRECISION DRIVER WITH PROGRAMMABLE
MICROSTEPPING WAVE
5
STALLGUARD2 – MECHANICAL LOAD SENSING 5
COOLSTEP – LOAD ADAPTIVE CURRENT CONTROL 6
PIN ASSIGNMENTS
2.1
2.2
3
PACKAGE OUTLINE
SIGNAL DESCRIPTIONS
SAMPLE CIRCUITS
3.1
3.2
3.3
3.4
4
STANDARD APPLICATION CIRCUIT
5 V ONLY SUPPLY
EXTERNAL VCC SUPPLY
OPTIMIZING ANALOG PRECISION
SPI INTERFACE
4.1
4.2
4.3
5
SPI DATAGRAM STRUCTURE
SPI SIGNALS
TIMING
REGISTER MAPPING
5.1
5.2
5.3
6
6.1
7
GENERAL CONFIGURATION REGISTERS
RAMP GENERATOR REGISTERS
MOTOR DRIVER REGISTERS
7.3
7.4
8
8.1
8.2
8.3
9
7
7
10
10
12
13
13
14
14
15
16
STALLGUARD2 LOAD MEASUREMENT
10.1
10.2
10.3
10.4
11
11.1
11.2
11.3
12
SPREADCYCLE
2-PHASE MOTOR CHOPPER
34
CLASSIC 2-PHASE MOTOR CONSTANT OFF TIME
CHOPPER
36
RANDOM OFF TIME
37
CHOPSYNC2 FOR QUIET MOTORS
38
DRIVER DIAGNOSTIC FLAGS
39
TEMPERATURE MEASUREMENT
SHORT TO GND PROTECTION
OPEN LOAD DIAGNOSTICS
39
39
39
USER BENEFITS
MICROSTEP TABLE
CLOCK OSCILLATOR AND CLOCK INPUT
13.1
CONSIDERATIONS ON THE FREQUENCY
42
43
44
45
46
46
46
47
47
47
49
50
50
50
52
52
14
ABSOLUTE MAXIMUM RATINGS
53
15
ELECTRICAL CHARACTERISTICS
53
15.3
32
USER BENEFITS
SETTING UP FOR COOLSTEP
TUNING COOLSTEP
SINE-WAVE LOOK-UP TABLE
12.1
12.2
13
TUNING THE STALLGUARD2 THRESHOLD SGT
STALLGUARD2 MEASUREMENT FREQUENCY AND
FILTERING
DETECTING A MOTOR STALL
LIMITS OF STALLGUARD2 OPERATION
COOLSTEP OPERATION
18
19
24
31
www.trinamic.com
10
VELOCITY THRESHOLDS
REFERENCE SWITCHES
15.1
15.2
SENSE RESISTORS
REAL WORLD UNIT CONVERSION
RAMP GENERATOR FUNCTIONALITY
9.3
9.4
17
30
RAMP GENERATOR
9.1
9.2
7
CURRENT SETTING
CHOPPER OPERATION
7.1
7.2
4
16
LAYOUT CONSIDERATIONS
16.1
16.2
16.3
16.4
17
EXPOSED DIE PAD
WIRING GND
SUPPLY FILTERING
LAYOUT EXAMPLE
PACKAGE MECHANICAL DATA
17.1
17.2
18
OPERATIONAL RANGE
DC CHARACTERISTICS AND TIMING
CHARACTERISTICS
THERMAL CHARACTERISTICS
DIMENSIONAL DRAWINGS
PACKAGE CODES
GETTING STARTED
18.1
INITIALIZATION EXAMPLES
53
54
56
57
57
57
57
58
59
59
59
60
60
19
DISCLAIMER
61
20
ESD SENSITIVE DEVICE
61
40
21
TABLE OF FIGURES
62
40
40
22
REVISION HISTORY
63
23
REFERENCES
63
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
4
1 Principles of Operation
REFL1
REFR1
ref. / stop switches motor 1
+VM
F
tor
p mo
e
t
S
l
coo river
d
F
reference switch
processing
VCP
CPI
100n
charge pump
CPO
VSA
5VOUT
100n
5V Voltage
regulator
VCC
4.7µ
programmable
sine table
4*256 entry
Step &
Direction pulse
generation
2x linear 6 point
RAMP generator
22n
100n
DRV_ENN
TMC5031
Dual stepper motor
driver / controller
x
Half Bridge 1
Half Bridge 1
O1A1
O1A2
S
N
chopper
O1B1
Half Bridge 2
Half Bridge 2
trol
n co n
Motio
Stepper
#1
+VM
VS
2 phase
stepper
motor
O1B2
BR1A / B
coolStep™
RSENSE
RSENSE
GNDP
stallGuard2™
CSN
SCK
SDI
SDO
SPI™
Control register
set
interrupt out
opt. ext. clock
12-16MHz
+VIO
3.3V or 5V
I/O voltage
PP
2 x current
comparator
temperature
measurement
2 x DAC
RSENSE=0R25 allows for
maximum coil current
SPI interface
f ace
Inter
INT & position
pulse output
CLK oscillator/
selector
Stepper driver
Protection
& diagnostics
2 x current
comparator
ol
contr
n
GNDP
RSENSE
BR2A / B
2x linear 6 point
RAMP generator
Half Bridge 2
Half Bridge 2
Step &
Direction pulse
generation
programmable
sine table
4*256 entry
chopper
O2A2
Half Bridge 1
Half Bridge 1
S
N
O2A1
VS
F = 60ns spike filter
100n
+VM
2 phase
stepper
motor
Stepper
#2
DRV_ENN
GND
GNDA
REFR2
DIE PAD
F
REFL2
TST_MODE
F
O2B2
O2B1
x
otor
ep m
t
S
l
o
co
r
drive
reference switch
processing
100n
RSENSE
coolStep™
CLK_IN
VCC_IO
2 x DAC
stallGuard2™
Motio
INT
SINGLEDRV
ref. / stop switches motor 2
opt. driver enable
Figure 1.1 Basic application and block diagram
The TMC5031 motion controller and driver chip is an intelligent power component interfacing between
the CPU and up to two stepper motors. The TMC5031 offers a number of unique enhancements which
are enabled by the system-on-chip integration of driver and controller. The sixPoint ramp generator of
the TMC5031 uses coolStep and stallGuard2 automatically to optimize every motor movement:
TRINAMICs special features contribute toward lower system cost, greater precision, greater energy
efficiency, smoother motion, and cooler operation in stepper motor applications. The clear concept
and the comprehensive solution save design-in time.
1.1 Key Concepts
The TMC5031 implements several advanced features which are exclusive to TRINAMIC products. These
features contribute toward greater precision, greater energy efficiency, higher reliability, smoother
motion, and cooler operation in many stepper motor applications.
stallGuard2™
High-precision load measurement using the back EMF on the motor coils.
coolStep™
Load-adaptive current control which reduces energy consumption by as much as
75%.
spreadCycle™
High-precision chopper algorithm available as an alternative to the traditional
constant off-time algorithm.
In addition to these performance enhancements, TRINAMIC motor drivers also offer safeguards to
detect and protect against shorted outputs, output open-circuit, overtemperature, and undervoltage
conditions for enhancing safety and recovery from equipment malfunctions.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
5
1.2 SPI Control Interface
The SPI interface is a bit-serial interface synchronous to a bus clock. For every bit sent from the bus
master to the bus slave, another bit is sent simultaneously from the slave to the master.
Communication between an SPI master and the TMC5031 slave always consists of sending one 40-bit
command word and receiving one 40-bit status word.
The SPI command rate typically is a few commands per complete motor motion.
1.3 Software
From a software point of view the TMC5031 is a peripheral with a number of control and status
registers. Most of them can either be written only or read only, some of the registers allow both read
and write access. In case read-modify-write access is desired for a write only register, a shadow
register can be realized in master software.
1.4 Moving and Controlling the Motor
1.4.1 Integrated Motion Controller
The integrated 32 bit motion controller automatically drives the motors to target positions, or
accelerates to target velocities. All motion parameters can be changed on the fly with the motion
controller recalculating immediately. A minimum set of configuration data consists of acceleration and
deceleration values and the maximum motion velocity. A start and stop velocity is supported as well
as a second acceleration and deceleration setting. It supports immediate reaction to mechanical
reference switches and to the sensorless stall detection stallGuard2.
Benefits are:
Flexible ramp programming
Efficient use of motor torque for acceleration and deceleration allows higher machine throughput
Immediate reaction to stop and stall conditions
1.5 Precision Driver with Programmable Microstepping Wave
Current into the motor coils is controlled using a cycle-by-cycle chopper mode. Two chopper modes
are available: a traditional constant off-time mode and the new spreadCycle mode. Constant off-time
mode provides higher torque at the highest velocity, while spreadCycle mode offers smoother
operation and greater power efficiency over a wide range of speed and load. The spreadCycle chopper
scheme automatically integrates a fast decay cycle and guarantees smooth zero crossing performance.
Programmable microstep shapes allow optimizing the motor performance.
Benefits are:
- Significantly improved microstepping with low cost motors
- Motor runs smooth and quiet
- Reduced mechanical resonances yields improved torque
1.6 stallGuard2 – Mechanical Load Sensing
stallGuard2 provides an accurate measurement of the load on the motor. It can be used for stall
detection as well as other uses at loads below those which stall the motor, such as coolStep loadadaptive current reduction. This gives more information on the drive allowing functions like
sensorless homing and diagnostics of the drive mechanics.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
6
1.7 coolStep – Load Adaptive Current Control
coolStep drives the motor at the optimum current. It uses the stallGuard2 load measurement
information to adjust the motor current to the minimum amount required in the actual load situation.
This saves energy and keeps the components cool, making the drive an efficient and precise solution.
Energy efficiency
Motor generates less heat
Less or no cooling
Use of smaller motor
-
power consumption decreased up to 75%.
improved mechanical precision.
improved reliability and lower cost infrastructure.
less torque reserve required, lower cost motor.
Figure 1.2 shows the efficiency gain of a 42mm stepper motor when using coolStep compared to
standard operation with 50% of torque reserve. coolStep is enabled above 60RPM in the example.
0,9
Efficiency with coolStep
0,8
Efficiency with 50% torque reserve
0,7
0,6
0,5
Efficiency
0,4
0,3
0,2
0,1
0
0
50
100
150
200
250
300
350
Velocity [RPM]
Figure 1.2 Energy efficiency with coolStep (example)
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
7
2 Pin Assignments
O1B1
BR1B
O1B2
-
VCP
41
40
39
38
37
VS
44
GNDP
O1A2
45
VS
BR1A
46
42
O1A1
47
43
TST_MODE
48
2.1 Package Outline
INT
1
36
CPI
PP
2
35
CSN
3
34
CPO
GND
SCK
4
33
VCC
SDI
5
32
5VOUT
31
GNDA
30
VSA
TMC 5031-LA
QFN48 7mm x 7mm
0.5 pitch
21
22
23
24
O2B2
-
GND
REFR2
20
REFL2
25
O2B1
BR2B
26
12
19
11
VS
CLK
GND
18
REFR1
GNDP
27
17
10
VS
REFL1
GND
16
GND
O2A2
DRV_ENN
28
15
29
9
BR2A
8
13
SDO
14
7
-
6
O2A1
GND
VCC_IO
Figure 2.1 TMC5031 pin assignments.
2.2 Signal Descriptions
Pin
GND
VCC_IO
Number Type
6, 9, 10,
GND
12, 24, 34
7
VSA
30
GNDA
5VOUT
31
32
VCC
33
www.trinamic.com
GND
Function
Digital ground pin for IO pins and digital circuitry.
3.3V or 5V I/O supply voltage pin for all digital inputs and
outputs. May be supplied from 5VOUT pin in stand-alone
operation, where no I/O voltage supply is available.
Analog high voltage supply for linear regulator and internal
references – typically supplied with driver supply voltage. Provide
100nF blocking capacitor to GND. Avoid excessive voltage ripple.
Analog GND
Output of internal 5 V linear regulator, supply voltage for internal
analog circuitry and reference for coil current regulators. An
external capacitor to GNDA close to the pin is required. 4.7 µF
ceramic are recommended to keep ripple below a few mV,
especially when used to supply VCC. Optional RC filtering can be
used to decouple VCC ripple from this pin (3.3 Ω recommended).
Digital core power supply. Normally supplied by 5VOUT pin. In
case, a different 5 V supply is used, or RC-filtering is applied,
provide a 470 nF or larger blocking capacitor to GND.
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
Pin
DIE_PAD
Number
-
Type
GND
Function
The exposed die attach pad is the thermal cooling pad for the IC
and shall be soldered to a ground pad, and be directly electrically
tied together with all GND pins. Use a large number of thermally
conducting vias to a PCB ground plane for best thermal and
electrical performance. The ground plane also acts as a heat
spreader to reduce thermal junction to ambient resistance.
Table 2.1 Low voltage digital and analog power supply pins
Pin
CPO
Number
35
Type
O(VCC)
CPI
36
I(VCP)
VCP
37
Function
Charge pump driver output. Outputs 5V (GND to VCC) square wave
with 1/16 of internal oscillator frequency.
Charge pump capacitor input: Provide external 22 nF / 50 V capacitor
to CPO.
Output of charge pump. Provide external 100 nF capacitor to VS.
Table 2.2 Charge pump pins
Pin
INT
PP
CSN
SCK
SDI
SDO
CLK
Number
1
2
3
4
5
8
11
Type
O (Z)
O (Z)
I
I
I
O (Z)
I
REFR2
REFL2
REFR1
REFL1
DRV_ENN
25
26
27
28
29
I
I
I
I
I
TST_MODE
48
I
-
13, 23, 38 N.C.
Function
Tristate interrupt output based on ramp generator flags 4, 5, 6 & 7.
Tristate position compare output for motor 1 (poscmp_enable=1).
Chip select input of SPI interface
Serial clock input of SPI interface
Data input of SPI interface
Tristate data output of SPI interface (enabled with CSN=0)
Clock input for all internal operations. Tie low to use internal
oscillator. A high signal disables the internal oscillator until power
down.
Right reference switch input for motor 2
Left reference switch input for motor 2
Right reference switch input for motor 1
Left reference switch input for motor 1
Enable (not) input for drivers (tie to GND). Switches off all motor
outputs (set high for disable).
Test mode input. Puts IC into test mode. Tie to GND for normal
operation.
Unused pins – no internal electrical connection. Leave open or tie to
GND for compatibility with future devices.
Table 2.3 Digital I/O pins (all related to VCC_IO supply)
www.trinamic.com
8
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
Pin
O2A1
BR2A
Number
14
15
Type
O (VS)
O2A2
VS
16
17, 19
O (VS)
GNDP
O2B1
BR2B
18
20
21
GND
O (VS)
O2B2
O1B2
BR1B
22
39
40
O (VS)
O (VS)
O1B1
VS
41
42, 44
O (VS)
GNDP
O1A2
BR1A
43
45
46
GND
O (VS)
O1A1
47
O (VS)
Table 2.4 Power driver pins
www.trinamic.com
Function
Motor 2 A1 output (stepper motor coil A)
Motor 2 bridge A negative power supply and current sense input.
Provide external sense resistor to GND.
Motor 2 A2 output (stepper motor coil A)
Driver 2 positive power supply. Connect to VS and provide sufficient
filtering capacity for chopper current ripple.
Power GND for driver 2. Connect to GND.
Motor 2 B1 output (stepper motor coil B)
Motor 2 bridge B negative power supply and current sense input.
Provide external sense resistor to GND.
Motor 2 B2 output (stepper motor coil B)
Motor 1 B2 output (stepper motor coil B)
Motor 1 bridge B negative power supply and current sense input.
Provide external sense resistor to GND.
Motor 1 B1 output (stepper motor coil B)
Driver 1 positive power supply. Connect to VS and provide sufficient
filtering capacity for chopper current ripple.
Power GND for driver 1. Connect to GND.
Motor 1 A2 output (stepper motor coil A)
Motor 1 bridge A negative power supply and current sense input.
Provide external sense resistor to GND.
Motor 1 A1 output (stepper motor coil A)
9
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
10
3 Sample Circuits
The sample circuits show the connection of the external components in different operation and
supply modes. The standard application circuit uses a minimum set of additional components in order
to operate the motor. The connection of the bus interface and further digital signals is left out for
clarity.
REFR1
CPO
CPI
22n
REFL1
3.1 Standard Application Circuit
+VM
+VM
VS
5VOUT
100n
100n
O1A1
Full Bridge A
5V Voltage
regulator
O1A2
4.7µ
Controller 1
Driver 1
Full Bridge B
N
stepper
motor #1
N
stepper
motor #2
O1B2
BR1A
BR1B
TMC5031
SPI interface
S
O1B1
VCC
CSN
SCK
SDI
SDO
100µF
RS1A
VSA
reference switch
processing
RS1B
charge pump
DRV_ENN
VCP
100n
VS
+VM
100n
O2A1
Full Bridge A
O2A2
PP
Controller 2
Driver 2
O2B1
INT & position
pulse output
Full Bridge B
O2B2
CLK_IN
5V
VCC_IO
BR2B
GNDP
GND
GNDA
DIE PAD
DRV_ENN
REFR2
REFL2
100n
TST_MODE
3.3V
TS3480
CX33*)
BR2A
reference switch
processing
RS2A
INT
RS2B
optional
external
clock
12-16MHz
S
*) For a reliable start-up it is essential that VCC_IO comes up to a minimum of 1.5V before the TMC5031 leaves the reset condition. Therefore,
TRINAMIC recommends using a fast-start-up voltage regulator (e.g. TS3480CX33) in a 3.3V environment.
Figure 3.1 Standard application circuit
In order to minimize linear voltage regulator power dissipation of the internal 5V voltage regulator in
an application where VM is high, a different (lower) supply voltage can be used for VSA, if available.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
11
3.1.1 VCC_IO Requirements
For a reliable start-up it is essential that VCC_IO comes up to a minimum of 1.5V before the TMC5031
leaves the reset condition. The reset condition ends earliest 50µs after the time when VSA exceeds its
undervoltage threshold of typically 4.2V, or when 5VOUT exceeds its undervoltage threshold of
typically 3.5V, whichever comes last.
THERE ARE THREE WAYS TO COME UP TO VCC_IO REQUIREMENTS
-
5VOUT can be used directly to supply VCC_IO. In this case there are no further requirements.
-
An external low drop regulator can be used in a 3.3V environment as shown in Figure 3.1.
Note, that most voltage regulators are not suitable for this application because they show a
delayed boot up. The following external regulators are proved by TRINAMIC:
This regulator can be used within the full supply voltage range when tied
to the motor supply voltage.
This regulator can be used to supply VCC_IO from 5VOUT, or from a supply
voltage of up to 15V.
TS3480CX33
LD1117-3.3
VCC_IO can be supplied externally as shown in Figure 3.2 . In this case it is mandatory to
connect the Schottky diode to the logic supply of the external circuitry. Please note, that the
2K resistor is not to be used with 5V I/O voltage.
CPI
22n
CPO
-
+VM
VCP
charge pump
100n
VSA
5VOUT
100n
4.7µ
5V Voltage
regulator
2R2
VCC
+VCC_IO
1K
VCC_IO
MSS1P3
2K
22n
470n
3.3V, only
Figure 3.2 External supply of VCC_IO (showing optional filtering for VCC)
Refer to application note no. 028 Supply Voltage Considerations: VCC_IO in TMC50xx Designs
(www.trinamic.com). Here you will find complete information about connecting VCC_IO.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
12
REFR1
REFL1
CPI
22n
CPO
3.2 5 V Only Supply
+5V
VS
+5V
VSA
5VOUT
100n
O1A1
Full Bridge A
5V Voltage
regulator
4.7µ
O1A2
Controller 1
Driver 1
Full Bridge B
N
stepper
motor #1
N
stepper
motor #2
O1B2
470n
BR1A
BR1B
TMC5031
SPI interface
S
O1B1
VCC
CSN
SCK
SDI
SDO
100µF
VS
RS1A
100n
reference switch
processing
RS1B
charge pump
DRV_ENN
VCP
+5V
100n
O2A1
Full Bridge A
O2A2
PP
Controller 2
Driver 2
O2B1
INT & position
pulse output
Full Bridge B
O2B2
CLK_IN
BR2A
reference switch
processing
VCC_IO
BR2B
RS2A
VCC_IO
5V
INT
RS2B
Optional
external
clock
12-16MHz
S
100n
GNDP
GND
GNDA
DIE PAD
DRV_ENN
REFR2
REFL2
TST_MODE
VCC_IO 3.3V
see standard
application schematic
Figure 3.3 5V only operation
While the standard application circuit is limited to roughly 5.5 V lower supply voltage, a 5 V only
application lets the IC run from a normal 5 V +/-10% supply. In this application, linear regulator drop
must be minimized. Therefore, the major 5 V load is removed by supplying VCC directly from the
external supply.
In order to keep supply ripple away from the analog voltage reference, 5VOUT should have an own
filtering capacity and the 5VOUT pin does not become bridged to the 5V supply.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
13
3.3 External VCC Supply
Supplying VCC from an external supply is advised, when cooling of the chip is critical, e.g. at high
environment temperatures in combination with high supply voltages (16 V), as the linear regulator is a
major source of on-chip power dissipation. It must be made sure that the external VCC supply comes
up before or synchronously with the 5VOUT supply, because otherwise the power-up reset event may
be missed by the TMC5031. A diode from 5VOUT to VCC ensures this, in case the external voltage
regulator is not a low drop type linear regulator. In order to prevent overload of the internal 5V
regulator when using this diode, an additional series resistor has been added to VSA.
CPI
22n
CPO
An alternative for reduced power dissipation is using a lower supply voltage for VSA, e.g. 6V to 12V.
If power dissipation is critical, but no external supply is available, the clock frequency can be reduced
as a first step by supplying external 12 MHz clock.
The diode is mandatory to satisfy power-up
conditions!
+VM
VCP
charge pump
100n
220R
VSA
5V Voltage
regulator
5VOUT
+5V
100n
4.7µ
VCC
LL4148
470n
Figure 3.4 Using an external 5V supply to reduce linear regulator power dissipation
3.4 Optimizing Analog Precision
CPI
22n
CPO
The 5VOUT pin is used as an analog reference for operation of the TMC5031. Performance will degrade
when there is voltage ripple on this pin. Most of the high frequency ripple in a TMC5031 design
results from the operation of the internal digital logic. The digital logic switches with each edge of
the clock signal. Further, ripple results from operation of the charge pump, which operates with
roughly 1 MHz and draws current from the VCC pin. In order to keep this ripple as low as possible, an
additional filtering capacitor can be put directly next to the VCC pin with vias to the GND plane giving
a short connection to the digital GND pins (pin 6 and pin 34). Analog performance is best, when this
ripple is kept away from the analog supply pin 5VOUT, using an additional series resistor of 2.2 Ω to
3.3 Ω. The voltage drop on this resistor will be roughly 100 mV (IVCC * R).
+VM
VCP
charge pump
100n
VSA
5VOUT
100n
5V Voltage
regulator
GNDA
4.7µ
2R2
VCC
470n
Figure 3.5 Adding an RC-Filter on VCC for reduced ripple
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
14
4 SPI Interface
4.1 SPI Datagram Structure
The TMC5031 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 using integer multiples of 8 bit. The NCS line of the TMC5031 must be
handled in a way, that it stays active (low) for the complete duration of the datagram transmission.
Each datagram sent to the TMC5031 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 TMC5031. 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:
- For a read access the most significant bit of the address byte is 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.
TMC5031 SPI DATAGRAM STRUCTURE
MSB (transmitted first)
40 bit
39 ...
 8 bit address
 8 bit SPI status
... 0
  32 bit data
39 ... 32
 to TMC5031:
RW + 7 bit address
 from TMC5031:
8 bit SPI status
W
39 / 38 ... 32
38...32
LSB (transmitted last)
31 ... 0
8 bit data
8 bit data
31 ... 24
31...28
27...24
23 ... 16
23...20
19...16
8 bit data
8 bit data
15 ... 8
15...12
7 ... 0
11...8
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
4.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. The SPI interface always delivers data back to the master,
independent of the W bit. The data transferred back is the data read from the address which was
transmitted with the previous datagram, if the previous access was a read access. If the previous
access was a write access, then the data read back mirrors the previously received write data. So, the
difference between a read and a write access is that the read access does not transfer data to the
addressed register but it transfers the address only and its 32 data bits are dummies, and, further the
following read or write access delivers back the data read from the address transmitted in the
preceding read cycle.
A read access request datagram uses dummy write data. Read data is transferred back to the master
with the subsequent read or write access. Hence, reading multiple registers can be done in a
pipelined fashion.
Whenever data is read from or written to the TMC5031, the MSBs delivered back contain the SPI
status, SPI_STATUS, a number of eight selected status bits.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
15
Example:
For a read access to the register (X_ACTUAL) with the address 0x21, the address byte has to
be set to 0x21 in the access preceding the read access. For a write access to the register
(V_ACTUAL), the address byte has to be set to 0x80 + 0x22 = 0xA2. For read access, the data
bit might have any value (-). So, one can set them to 0.
action
read X_ACTUAL
read X_ACTUAL
write V_ACTUAL:= 0x00ABCDEF
write V_ACTUAL:= 0x00123456
data sent to TMC5031
 0x2100000000
 0x2100000000
 0xA200ABCDEF
 0xA200123456
data received from TMC5031
 0xSS & unused data
 0xSS & X_ACTUAL
 0xSS & X_ACTUAL
 0xSS00ABCDEF
*)S: is a placeholder for the status bits SPI_STATUS
4.1.2 SPI Status Bits Transferred with Each Datagram Read Back
SPI_STATUS – status flags transmitted with each SPI access in bits 39 to 32
Bit
7
6
5
4
3
2
1
0
Name
Comment
status_stop_l(2)
status_stop_l(1)
velocity_reached(2)
velocity_reached(1)
driver_error(2)
driver_error(1)
reset_flag
reserved (0)
RAMP_STATUS2[0] – 1: Signals motor 2 stop left switch status
RAMP_STATUS1[0] – 1: Signals motor 1 stop left switch status
RAMP_STATUS2[8] – 1: Signals motor 2 has reached its target velocity
RAMP_STATUS1[8] – 1: Signals motor 1 has reached its target velocity
GSTAT[2] – 1: Signals driver 2 driver error (clear by reading GSTAT)
GSTAT[1] – 1: Signals driver 1 driver error (clear by reading GSTAT)
GSTAT[0] – 1: Signals, that a reset has occurred (clear by reading GSTAT)
4.1.3 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.
4.2 SPI Signals
The SPI bus on the TMC5031 has four signals:
- SCK – bus clock input
- SDI – serial data input
- SDO – serial data output
- CSN – chip select input (active low)
The slave is enabled for an SPI transaction by a low on the chip select input CSN. Bit transfer is
synchronous to the bus clock SCK, with the slave latching the data from SDI on the rising edge of SCK
and driving data to SDO following the falling edge. The most significant bit is sent first. A minimum
of 40 SCK clock cycles is required for a bus transaction with the TMC5031.
If more than 40 clocks are driven, the additional bits shifted into SDI are shifted out on SDO after a
40-clock delay through an internal shift register. This can be used for daisy chaining multiple chips.
CSN must be low during the whole bus transaction. When CSN goes high, the contents of the internal
shift register are latched into the internal control register and recognized as a command from the
master to the slave. If more than 40 bits are sent, only the last 40 bits received before the rising edge
of CSN are recognized as the command.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
16
4.3 Timing
The SPI interface is synchronized to the internal system clock, which limits the SPI bus clock SCK to
half of the system clock frequency. If the system clock is based on the on-chip oscillator, an additional
10% safety margin must be used to ensure reliable data transmission. All SPI inputs as well as the
ENN input are internally filtered to avoid triggering on pulses shorter than 20ns. Figure 4.1 shows the
timing parameters of an SPI bus transaction, and the table below specifies their values.
CSN
tCC
tCL
tCH
tCH
tCC
SCK
tDU
SDI
bit39
tDH
bit38
bit0
tDO
SDO
tZC
bit39
bit38
bit0
Figure 4.1 SPI timing
SPI interface timing
Parameter
SCK valid before or after change
of CSN
AC-Characteristics
clock period: tCLK
Symbol
tCC
fSCK
fSCK
assumes
synchronous CLK
tCSH
SCK low time
tCL
SCK high time
tCH
www.trinamic.com
Min
Typ
Max
10
*) Min time is for
synchronous CLK
with SCK high one
tCH before CSN high
only
*) Min time is for
synchronous CLK
only
*) Min time is for
synchronous CLK
only
assumes minimum
OSC frequency
CSN high time
SCK frequency using internal
clock
SCK frequency using external
16MHz clock
SDI setup time before rising
edge of SCK
SDI hold time after rising edge
of SCK
Data out valid time after falling
SCK clock edge
SDI, SCK and CSN filter delay
time
Conditions
Unit
ns
tCLK*)
>2tCLK+10
ns
tCLK*)
>tCLK+10
ns
tCLK*)
>tCLK+10
ns
4
MHz
8
MHz
tDU
10
ns
tDH
10
ns
tDO
no capacitive load
on SDO
tFILT
rising and falling
edge
12
20
tFILT+5
ns
30
ns
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
17
5 Register Mapping
This chapter gives an overview of the complete register set. Some of the registers bundling a number
of single bits are detailed in extra tables. The functional practical application of the settings is
detailed in dedicated chapters.
Note
- All registers become reset to 0 upon power up, unless otherwise noted.
- Add 0x80 to the address Addr for write accesses!
NOTATION OF HEXADECIMAL AND BINARY NUMBERS
0x
%
precedes a hexadecimal number, e.g. 0x04
precedes a multi-bit binary number, e.g. %100
NOTATION OF R/W FIELD
R
W
R/W
R+C
Read only
Write only
Read- and writable register
Clear upon read
OVERVIEW REGISTER MAPPING
REGISTER
DESCRIPTION
General Configuration Registers
These registers contain
global configuration,
global status flags,
slave address configuration.
This register set offers registers for
choosing a ramp mode,
choosing velocities,
homing,
acceleration and deceleration, and
target positioning.
This register set offers registers for
driver current control,
setting thresholds for coolStep operation,
setting thresholds for different chopper modes,
and
a reference switch and stallGuard2 event
configuration register and (with separate table)
a ramp and reference switch status register (with
separate table).
This register set offers registers for
setting / reading out microstep table and
counter (see separate table, too),
chopper and driver configuration (see separate
tables for different motor types, too),
coolStep and stallGuard2 configuration (see
separate table, too), and
reading out stallGuard2 values and driver error
flags (see separate table, too).
Ramp Generator Motion Control Register Set
Ramp Generator Driver Feature Control Register Set
Motor Driver Register Set
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
18
5.1 General Configuration Registers
GENERAL CONFIGURATION REGISTERS (0X00…0X1F)
R/W
Addr
n
Register
Description / bit names
Bit
GCONF – Global configuration flags
0..2 Reserved, set to 0
3 poscmp_enable
0:
Outputs INT and PP are tristated.
1:
Position compare pulse (PP) and interrupt output
(INT) are available
4..6
7
RW
0x00
11
GCONF
8
9
10
Bit
0
1
R+C
0x01
4
GSTAT
2
3
Bit
3..0
W
0x03
4
TEST_SEL
R
0x04
8
+
8
INPUT
W
0x05
32
X_COMPARE
Attention: Not for user, set to 0 for normal operation!
shaft1
1:
Inverse motor 1 direction
shaft2
1:
Inverse motor 2 direction
lock_gconf
1:
GCONF is locked against further write access.
GSTAT – Global status flags
reset
1:
Indicates that the IC has been reset since the last
read access to GSTAT.
drv_err1
1:
Indicates, that driver 1 has been shut down due
to an error since the last read access.
drv_err2
1:
Indicates, that driver 2 has been shut down due
to an error since the last read access.
uv_cp
1:
Indicates an undervoltage on the charge pump.
The driver is disabled in this case.
SLAVECONF
TEST_SEL:
selects the function of REFR2 in test mode:
0…4: T120, DAC1, VDDH1, DAC2, VDDH2
Attention: Not for user, set to 0 for normal operation!
Bit
INPUT
0..6 Unused, ignore these bits
7 Reads the state of the DRV_ENN pin
31.. VERSION: 0x01=first version of the IC
24
Position comparison register for motor 1 position strobe.
Activate poscmp_enable to get position pulse on output PP.
XACTUAL = X_COMPARE:
-
www.trinamic.com
Attention – do not leave the ouputs floating in tristate
condition, provide an external pull-up or set this bit 1.
Reserved, set to 0
test_mode
0:
Normal operation
1:
Enable analog test output on pin REFR2
TEST_SEL selects the function of REFR2:
0…4: T120, DAC1, VDDH1, DAC2, VDDH2
Output PP becomes high. It returns to a low state, if
the positions mismatch.
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
19
5.2 Ramp Generator Registers
Addresses Addr are specified for motor 1 (upper value) and motor 2 (second address).
5.2.1 Ramp Generator Motion Control Register Set
RAMP GENERATOR MOTION CONTROL REGISTER SET (MOTOR 1: 0X20…0X2D, MOTOR 2: 0X40…0X4D)
R/W
Addr
n
Register
RW
0x20
0x40
2
RAMPMODE
RW
0x21
0x41
32
XACTUAL
R
0x22
0x42
24
VACTUAL
W
0x23
0x43
18
VSTART
W
0x24
0x44
16
A1
W
0x25
0x45
20
V1
W
W
W
W
W
0x26
0x46
16
0x27
0x47
23
0x28
0x48
16
0x2A
0x4A
0x2B
0x4B
Description / bit names
RAMPMODE:
0:
Positioning mode (using all A, D and V
parameters)
1:
Velocity mode to positive VMAX (using
AMAX acceleration)
2:
Velocity mode to negative VMAX (using
AMAX acceleration)
3:
Hold mode (velocity remains unchanged,
unless stop event occurs)
Actual motor position (signed)
Hint: This value normally should only be
modified, when homing the drive. In
positioning mode, modifying the register
content will start a motion.
Actual motor velocity from ramp generator
(signed)
Motor start velocity (unsigned)
0: Disables A1 and D1 phase, use AMAX, VMAX
only
Second acceleration between V1 and VMAX
(unsigned)
0…(2^16)-1
[µsteps / ta²]
This is the acceleration and deceleration value
for velocity mode.
Second acceleration phase target velocity
VMAX > V1, VMAX > VSTART (unsigned)
0…(2^23)-512
[µsteps / t]
AMAX
VMAX
DMAX
This is the target velocity in velocity mode. It
can be changed any time during a motion.
Deceleration between VMAX and V1 (unsigned)
between
V1
and
VSTOP
0…(2^16)-1
[µsteps / ta²]
1…(2^16)-1
[µsteps / ta²]
D1
VSTOP
Attention: Set VSTOP ≥ VSTART!
Attention: Do not set 0 in positioning mode!
www.trinamic.com
+-(2^23)-1
[µsteps / t]
0…(2^18)-1
[µsteps / t]
0…(2^16)-1
[µsteps / ta²]
0…(2^20)-1
[µsteps / t]
Attention: Do not set 0 in positioning mode,
even if V1=0!
Motor stop velocity (unsigned)
18
-2^31…
+(2^31)-1
Set VSTOP ≥ VSTART!
First acceleration between VSTART and V1
(unsigned)
First acceleration / deceleration phase target
velocity (unsigned)
Deceleration
(unsigned)
16
Range [Unit]
0…3
1…(2^18)-1
[µsteps / t]
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
20
RAMP GENERATOR MOTION CONTROL REGISTER SET (MOTOR 1: 0X20…0X2D, MOTOR 2: 0X40…0X4D)
R/W
Addr
n
Register
W
0x2C
0x4C
16
TZEROWAIT
Description / bit names
Waiting time after ramping down to zero
velocity before next movement or direction
inversion can start and before motor power
down starts. Time range is about 0 to 2
seconds.
This setting avoids excess acceleration e.g.
from VSTOP to -VSTART.
Target position for ramp mode (signed). Write
a new target position to this register in order
to activate the ramp generator positioning in
RAMPMODE=0.
Initialize
all
velocity,
acceleration and deceleration parameters
before.
RW
0x2D
0x4D
32
XTARGET
Hint: The position is allowed to wrap around,
thus, XTARGET value optionally can be treated
as an unsigned number.
Hint: The maximum possible displacement is
+/-((2^31)-1).
Hint: When increasing V1, D1 or DMAX during
a motion, rewrite XTARGET afterwards in order
to trigger a second acceleration phase, if
desired.
www.trinamic.com
Range [Unit]
0…(2^16)-1 *
512 tCLK
-2^31…
+(2^31)-1
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
21
5.2.2 Ramp Generator Driver Feature Control Register Set
RAMP GENERATOR DRIVER FEATURE CONTROL REGISTER SET (MOTOR 1: 0X30…0X36, MOTOR 2: 0X50…0X56)
R/W
W
Addr
n
0x30
0x50
5
+
5
+
4
Register
IHOLD_IRUN
Description / bit names
Bit
IHOLD_IRUN – Driver current control
4..0 IHOLD
Standstill current (0=1/32…31=32/32)
12..8 IRUN
Motor run current (0=1/32…31=32/32)
19..16
Hint: Choose sense resistors in a way, that normal
IRUN is 16 to 31 for best microstep performance.
IHOLDDELAY
Controls the number of clock cycles for motor
power down after a motion as soon as
T_ZEROWAIT has expired. The smooth transition
avoids a motor jerk upon power down.
0:
1..15:
W
0x31
0x51
instant power down
Delay per current reduction step in multiple
of 2^18 clocks
This is the lower threshold velocity for switching on smart
energy coolStep. (unsigned)
Set this parameter to disable coolStep at low speeds, where it
cannot work reliably.
23
VCOOLTHRS
VHIGH ≥ |VACT| ≥ VCOOLTHRS:
- coolStep is enabled, if configured
(Only bits 22..8 are used for value and for comparison)
This velocity setting allows velocity dependent switching into
a different chopper mode and fullstepping to maximize torque.
(unsigned)
W
RW
R+C
R
0x32
0x52
0x34
0x54
0x35
0x55
0x36
0x56
23
11
14
32
VHIGH
SW_MODE
RAMP_STAT
XLATCH
|VACT| ≥ VHIGH:
- coolStep
is
disabled
(motor runs with normal current scale)
- If vhighchm is set, the chopper switches to chm=1
with TFD=0 (constant off time with slow decay, only).
- chopSync2 is switched off (SYNC=0)
- If vhighfs is set, the motor operates in fullstep mode.
(Only bits 22..8 are used for value and for comparison)
Switch mode configuration
See separate table!
Ramp status and switch event status
See separate table!
Ramp generator latch position, latches XACTUAL upon a
programmable switch event (see SW_MODE).
time reference t for velocities: t = 2^24 / fCLK
time reference ta² for accelerations: ta² = 2^41 / (fCLK)²
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
22
6.2.2.1 SW_MODE – Reference Switch and stallGuard2 Event Configuration
Register
0X34, 0X54: SW_MODE – REFERENCE SWITCH AND STALLGUARD2 EVENT CONFIGURATION REGISTER
Bit
11
Name
en_softstop
Comment
0: Hard stop
1: Soft stop
The soft stop mode always uses the deceleration ramp settings DMAX, V1,
D1, VSTOP and TZEROWAIT for stopping the motor. A stop occurs when
the velocity sign matches the reference switch position (REFL for negative
velocities, REFR for positive velocities) and the respective switch stop
function is enabled.
A hard stop also uses TZEROWAIT before the motor becomes released.
10
sg_stop
9
8
latch_r_inactive
7
latch_r_active
6
latch_l_inactive
5
latch_l_active
Attention: Do not use soft stop in combination with stallGuard2.
1: Enable stop by stallGuard2. Disable to release motor after stop event.
Attention: Do not enable during motor spin-up, wait until the motor
velocity exceeds a certain value, where stallGuard2 delivers a stable result.
Reserved, set to 0
1: Activates latching of the position to XLATCH upon an inactive going
edge on the right reference switch input REFR. The active level is defined
by pol_stop_r.
1: Activates latching of the position to XLATCH upon an active going edge
on the right reference switch input REFR.
Hint: Activate latch_r_active to detect any spurious stop event by reading
status_latch_r.
1: Activates latching of the position to XLATCH upon an inactive going
edge on the left reference switch input REFL. The active level is defined
by pol_stop_l.
1: Activates latching of the position to XLATCH upon an active going edge
on the left reference switch input REFL.
4
3
swap_lr
pol_stop_r
2
pol_stop_l
1
stop_r_enable
Hint: Activate latch_l_active to detect any spurious stop event by reading
status_latch_l.
1: Swap the left and the right reference switch input
Sets the active polarity of the right reference switch input
(0=low active, 1=high active)
Sets the active polarity of the left reference switch input
(0=low active, 1=high active)
1: Enables automatic motor stop during active right reference switch input
0
stop_l_enable
Hint: The motor restarts in case the stop switch becomes released.
1: Enables automatic motor stop during active left reference switch input
Hint: The motor restarts in case the stop switch becomes released.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
23
6.2.2.2 RAMP_STAT – Ramp and Reference Switch Status Register
0X35, 0X55: RAMP_STAT – RAMP AND REFERENCE SWITCH STATUS REGISTER
R/W
R
Bit
13
Name
status_sg
R+C
12
second_move
R
11
R
R
10
9
R
8
R+C
7
t_zerowait_
active
vzero
position_
reached
velocity_
reached
event_pos_
reached
R+C
6
event_stop_
sg
R
5
event_stop_r
4
event_stop_l
3
status_latch_r
2
status_latch_l
1
0
status_stop_r
status_stop_l
R+C
R
www.trinamic.com
Comment
1: Signals an active stallGuard2 input from the coolStep driver, if
enabled.
Hint: When polling this flag, stall events may be missed – activate
sg_stop to be sure not to miss the stall event.
1: Signals that the automatic ramp requires moving back in the
opposite direction, e.g. due to on-the-fly parameter change
(Flag is cleared upon reading)
1: Signals, that T_ZEROWAIT is active after a motor stop. During this
time, the motor is in standstill.
1: Signals, that the actual velocity is 0.
1: Signals, that the target position is reached.
This flag becomes set while X_ACTUAL and X_TARGET match.
1: Signals, that the target velocity is reached.
This flag becomes set while V_ACTUAL and VMAX match.
1: Signals, that the target position has been reached (pos_reached
becoming active).
(Flag and interrupt condition are cleared upon reading)
This bit is ORed to the interrupt output signal.
1: Signals an active StallGuard2 stop event.
(Flag and interrupt condition are cleared upon reading)
This bit is ORed to the interrupt output signal.
1: Signals an active stop right condition due to stop switch.
The stop condition and the interrupt condition can be removed by
setting RAMP_MODE to hold mode or by commanding a move to the
opposite direction. In soft_stop mode, the condition will remain
active until the motor has stopped motion into the direction of the
stop switch. Disabling the stop switch or the stop function also
clears the flag, but the motor will continue motion.
This bit is ORed to the interrupt output signal.
1: Signals an active stop left condition due to stop switch.
The stop condition and the interrupt condition can be removed by
setting RAMP_MODE to hold mode or by commanding a move to the
opposite direction. In soft_stop mode, the condition will remain
active until the motor has stopped motion into the direction of the
stop switch. Disabling the stop switch or the stop function also
clears the flag, but the motor will continue motion.
This bit is ORed to the interrupt output signal.
1: Latch right ready
(enable position latching using SWITCH_MODE settings
latch_r_active or latch_r_inactive)
(Flag is cleared upon reading)
1: Latch left ready
(enable position latching using SWITCH_MODE settings
latch_l_active or latch_l_inactive)
(Flag is cleared upon reading)
Reference switch right status (1=active)
Reference switch left status (1=active)
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
24
5.3 Motor Driver Registers
MOTOR DRIVER REGISTER SET (MOTOR 1: 0X60…0X6F, MOTOR 2: 0X70…0X7F)
R/W
Addr
n
W
0x60
0x70
32
W
W
W
0x61
…
0x67
0x71
…
0x77
0x68
0x78
0x69
0x79
7
x
32
32
8
+
8
Register
MSLUT1[0]
MSLUT2[0]
microstep
table entries
0…31
MSLUT1[1...7]
MSLUT2[1...7]
microstep
table entries
32…255
MSLUTSEL1
MSLUTSEL2
MSLUTSTART
Description / bit names
Each bit gives the difference between
microstep x and x+1 when combined with
the corresponding MSLUTSEL W bits:
0: W= %00: -1
%01: +0
%10: +1
%11: +2
1: W= %00: +0
%01: +1
%10: +2
%11: +3
This is the differential coding for the first
quarter of a wave. Start values for CUR_A and
CUR_B are stored for MSCNT position 0 in
START_SIN and START_SIN90_120.
ofs31, ofs30, …, ofs01, ofs00
…
ofs255, ofs254, …, ofs225, ofs224
This register defines four segments within
each quarter MSLUT wave. Four 2 bit entries
determine the meaning of a 0 and a 1 bit in
the corresponding segment of MSLUT.
See separate table!
bit 7… 0:
START_SIN
bit 23… 16: START_SIN90_120
START_SIN gives the absolute current at
microstep table entry 0.
START_SIN90_120 gives the absolute current
for microstep table entry at positions 256.
Start values are transferred to the microstep
registers CUR_A and CUR_B, whenever the
reference position MSCNT=0 is passed.
R
0x6A
0x7A
10
MSCNT
R
0x6B
0x7B
9
+
9
MSCURACT
RW
0x6C
0x7C
32
CHOPCONF
W
0x6D
0x7D
25
COOLCONF
www.trinamic.com
Microstep counter. Indicates actual position
in the microstep table for CUR_A. CUR_B uses
an offset of 256.
Hint: Move to a position where MSCNT is
zero before re-initializing MSLUTSTART or
MSLUT and MSLUTSEL.
bit 8… 0:
CUR_A (signed):
Actual microstep current for
motor phase A as read from
MSLUT (not scaled by current)
bit 24… 16: CUR_B (signed):
Actual microstep current for
motor phase B as read from
MSLUT (not scaled by current)
chopper and driver configuration
See separate table!
coolStep smart current control register
and stallGuard2 configuration
See separate table!
Range [Unit]
32x 0 or 1
reset default=
sine wave
table
7x
32x 0 or 1
reset default=
sine wave
table
0<X1<X2<X3
reset default=
sine wave
table
START_SIN
reset default
=0
START_SIN90_1
20
reset default
=247
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
25
MOTOR DRIVER REGISTER SET (MOTOR 1: 0X60…0X6F, MOTOR 2: 0X70…0X7F)
R/W
Addr
0x6F
0x7F
R
n
32
Register
DRV_
STATUS
Description / bit names
stallGuard2 value and driver error flags
See separate table!
Range [Unit]
MIRCOSTEP TABLE CALCULATION FOR A SINE WAVE EQUIVALENT TO THE POWER ON DEFAULT:
i:[0… 255] is the table index
The amplitude of the wave is 248. The resulting maximum positive value is 247 and the
maximum negative value is -248.
The round function rounds values from 0.5 to 1.4999 to 1
-
5.3.1 MSLUTSEL – Look up Table Segmentation Definition
0X68, 0X78: MSLUTSEL – LOOK UP TABLE SEGMENTATION DEFINITION
Bit
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Name
X3
X2
Function
LUT segment 3 start
LUT segment 2 start
Comment
The sine wave look up table can be divided into up to
four segments using an individual step width control
entry Wx. The segment borders are selected by X1, X2
and X3.
Segment
Segment
Segment
Segment
0
1
2
3
goes
goes
goes
goes
from
from
from
from
0 to X1-1.
X1 to X2-1.
X2 to X3-1.
X3 to 255.
For defined response the values shall satisfy:
0<X1<X2<X3
X1
LUT segment 1 start
W3
LUT width select from
ofs(X3) to ofs255
LUT width select from
ofs(X2) to ofs(X3-1)
LUT width select from
ofs(X1) to ofs(X2-1)
LUT width select from
ofs00 to ofs(X1-1)
W2
W1
W0
www.trinamic.com
Width control bit coding W0…W3:
%00:
MSLUT entry 0, 1 select: -1, +0
%01:
MSLUT entry 0, 1 select: +0, +1
%10:
MSLUT entry 0, 1 select: +1, +2
%11:
MSLUT entry 0, 1 select: +2, +3
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
26
5.3.2 CHOPCONF – Chopper Configuration
0X6C, 0X7C: CHOPCONF – CHOPPER CONFIGURATION
Bit
31
Name
-
Function
reserved
Comment
set to 0
30
diss2g
29
-
short
to
GND
protection disable
reserved
0: Short to GND protection is on
1: Short to GND protection is disabled
set to 0
28
-
reserved
set to 0
27
-
reserved
set to 0
26
-
reserved
set to 0
25
-
reserved
set to 0
24
-
reserved
set to 0
23
sync3
22
sync2
21
sync1
SYNC
PWM
clock
20
sync0
19
vhighchm
high velocity chopper
mode
18
vhighfs
high velocity fullstep
selection
17
vsense
16
tbl1
15
tbl0
sense resistor voltage
based current scaling
TBL
blank time select
14
chm
chopper mode
13
rndtf
random TOFF time
12
disfdcc
fast decay mode
11
fd3
TFD [3]
This register allows synchronization of the chopper for
both phases of a two phase motor in order to avoid the
occurrence of a beat, especially at low motor velocities.
It is automatically switched off above VHIGH.
%0000: Chopper sync function chopSync off
%0001 … %1111:
Synchronization with fSYNC = fCLK/(sync*64)
Hint: Set TOFF to a low value, so that the chopper cycle
is ended, before the next sync clock pulse occurs. Set for
the double desired chopper frequency for chm=0, for the
desired base chopper frequency for chm=1.
This bit enables switching to chm=1 and fd=0, when
VHIGH is exceeded. This way, a higher velocity can be
achieved. Can be combined with vhighfs=1. If set, the
TOFF setting automatically becomes doubled during
high velocity operation in order to avoid doubling of
the chopper frequency.
This bit enables switching to fullstep, when VHIGH is
exceeded. Switching takes place only at 45° position.
The fullstep target current uses the current value from
the microstep table at the 45° position.
0: Low sensitivity, high sense resistor voltage
1: High sensitivity, low sense resistor voltage
%00 … %11:
Set comparator blank time to 16, 24, 36 or 54 clocks
Hint: %10 is recommended for most applications
0
Standard mode (spreadCycle)
1
Constant off time with fast decay time.
Fast decay time is also terminated when the
negative nominal current is reached. Fast decay is
after on time.
0
Chopper off time is fixed as set by TOFF
1
Random mode, TOFF is random modulated by
dNCLK= -12 … +3 clocks.
chm=1:
disfdcc=1 disables current comparator usage for termination of the fast decay cycle
chm=1:
MSB of fast decay time setting TFD
www.trinamic.com
synchronization
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
27
0X6C, 0X7C: CHOPCONF – CHOPPER CONFIGURATION
Bit
10
Name
hend3
9
hend2
8
hend1
7
hend0
Function
HEND
hysteresis low value
OFFSET
sine wave offset
Comment
chm=0
%0000 … %1111:
Hysteresis is -3, -2, -1, 0, 1, …, 12
(1/512 of this setting adds to current setting)
This is the hysteresis value which becomes
used for the hysteresis chopper.
chm=1
6
hstrt2
5
hstrt1
4
hstrt0
HSTRT
hysteresis start value
added to HEND
TFD [2..0]
fast decay time setting
3
toff3
2
toff2
1
toff1
0
toff0
www.trinamic.com
TOFF off time
and driver enable
%0000 … %1111:
Offset is -3, -2, -1, 0, 1, …, 12
This is the sine wave offset and 1/512 of the
value becomes added to the absolute value
of each sine wave entry.
chm=0
%000 … %111:
Add 1, 2, …, 8 to hysteresis low value HEND
(1/512 of this setting adds to current setting)
Attention: Effective HEND+HSTRT ≤ 16.
Hint: Hysteresis decrement is done each 16
clocks
chm=1
Fast decay time setting (MSB: fd3):
%0000 … %1111:
Fast decay time setting TFD with
NCLK= 32*HSTRT (%0000: slow decay only)
Off time setting controls duration of slow decay phase
NCLK= 12 + 32*TOFF
%0000: Driver disable, all bridges off
%0001: 1 – use only with TBL ≥ 2
%0010 … %1111: 2 … 15
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
28
5.3.3 COOLCONF – Smart Energy Control coolStep and stallGuard2
0X6D, 0X7D: COOLCONF – SMART ENERGY CONTROL COOLSTEP AND STALLGUARD2
Bit
…
24
Name
sfilt
Function
reserved
stallGuard2 filter
enable
23
22
21
20
19
18
17
16
15
sgt6
sgt5
sgt4
sgt3
sgt2
sgt1
sgt0
seimin
reserved
stallGuard2 threshold
value
14
13
sedn1
sedn0
12
11
10
9
8
7
6
5
4
3
2
1
0
semax3
semax2
semax1
semax0
seup1
seup0
semin3
semin2
semin1
semin0
www.trinamic.com
minimum current for
smart current control
current down step
speed
reserved
stallGuard2 hysteresis
value for smart current
control
reserved
current up step width
reserved
minimum stallGuard2
value for smart current
control and
smart current enable
Comment
set to 0
0
Standard mode, high time resolution for
stallGuard2
1
Filtered mode, stallGuard2 signal updated for each
four fullsteps only to compensate for motor pole
tolerances
set to 0
This signed value controls stallGuard2 level for stall
output and sets the optimum measurement range for
readout. A lower value gives a higher sensitivity. Zero is
the starting value working with most motors.
-64 to +63: A higher value makes stallGuard2 less
sensitive and requires more torque to
indicate a stall.
0: 1/2 of current setting (IRUN)
1: 1/4 of current setting (IRUN)
%00: For each 32 stallGuard2 values decrease by one
%01: For each 8 stallGuard2 values decrease by one
%10: For each 2 stallGuard2 values decrease by one
%11: For each stallGuard2 value decrease by one
set to 0
If the stallGuard2 result is equal to or above
(SEMIN+SEMAX+1)*32, the motor current becomes
decreased to save energy.
%0000 … %1111: 0 … 15
set to 0
Current increment steps per measured stallGuard2 value
%00 … %11: 1, 2, 4, 8
set to 0
If the stallGuard2 result falls below SEMIN*32, the motor
current becomes increased to reduce motor load angle.
%0000: smart current control coolStep off
%0001 … %1111: 1 … 15
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
29
5.3.4 DRV_STATUS – stallGuard2 Value and Driver Error Flags
0X6F, 0X7F: DRV_STATUS – STALLGUARD2 VALUE AND DRIVER ERROR FLAGS
Bit
31
30
Name
stst
olb
29
ola
28
s2gb
27
s2ga
26
otpw
25
ot
overtemperature flag
24
23
22
21
20
19
18
17
16
15
stallGuard
-
stallGuard2 status
reserved
1: Overtemperature pre-warning threshold is exceeded.
The overtemperature pre-warning flag is common for both
drivers.
1: Overtemperature limit has been reached. Drivers become
disabled until otpw is also cleared due to cooling down of the
IC.
The overtemperature flag is common for both drivers.
1: Motor stall detected (SG_RESULT=0)
Ignore these bits
CS
ACTUAL
actual motor current /
smart energy current
Actual current control scaling, for monitoring smart energy
current scaling controlled via settings in register COOLCONF.
fsactive
1: Indicates that the driver has switched to fullstep as defined
by chopper mode settings and velocity thresholds.
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
-
full step active
indicator
reserved
stallGuard2 result
respectively PWM on
time for coil A in stand
still for motor
temperature detection
Mechanical load measurement:
The stallGuard2 result gives a means to measure mechanical
motor load. A higher value means lower mechanical load. A
value of 0 signals highest load. With optimum SGT setting,
this is an indicator for a motor stall. The stall detection
compares SG_RESULT to 0 in order to detect a stall. SG_RESULT
is used as a base for coolStep operation, by comparing it to a
programmable upper and a lower limit.
SG_
RESULT
www.trinamic.com
Function
standstill indicator
open load indicator
phase B
open load indicator
phase A
short to ground
indicator phase B
short to ground
indicator phase A
overtemperature prewarning flag
Comment
This flag indicates motor stand still in each operation mode.
1: Open load detected on phase A or B.
Hint: This is just an informative flag. The driver takes no action
upon it. False detection may occur in fast motion and
standstill. Check during slow motion, only.
1: Short to GND detected on phase A or B.
The driver becomes disabled. The flags stay active, until the
driver is disabled by software or by the ENN input.
Ignore these bits
Temperature measurement:
In standstill, no stallGuard2 result can be obtained. SG_RESULT
shows the chopper on-time for motor coil A instead. If the
motor is moved to a determined microstep position at a
certain current setting, a comparison of the chopper on-time
can help to get a rough estimation of motor temperature. As
the motor heats up, its coil resistance rises and the chopper
on-time increases.
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
30
6 Current Setting
The internal 5 V supply voltage available at the pin 5VOUT is used as a reference for the coil current
regulation based on the sense resistor voltage measurement. The desired maximum motor current is
set by selecting an appropriate value for the sense resistor. The sense resistor voltage range can be
selected by the vsense bit in CHOPCONF. The low sensitivity setting (high sense resistor voltage,
vsense=0) brings best and most robust current regulation, while high sensitivity (low sense resistor
voltage, vsense=1) reduces power dissipation in the sense resistor. The high sensitivity setting reduces
the power dissipation in the sense resistor by nearly half.
After choosing the vsense setting and selecting the sense resistor, the currents to both coils are
scaled by the 5-bit current scale parameters (IHOLD, IRUN). The sense resistor value is chosen so that
the maximum desired current (or slightly more) flows at the maximum current setting (IRUN =
%11111).
Using the internal sine wave table, which has the amplitude of 248, the RMS motor current can be
calculated by:
The momentary motor current is calculated by:
CS is the current scale setting as set by the IHOLD and IRUN and coolStep.
VFS is the full scale voltage as determined by vsense control bit (please refer to electrical
characteristics, VSRTL and VSRTH).
CURA/B is the actual value from the internal sine wave table.
Parameter
IRUN
IHOLD
IHOLD
DELAY
vsense
Description
Current scale when motor is running. Scales coil
current values as taken from the internal sine
wave table. For high precision motor operation,
work with a current scaling factor in the range 16
to 31, because scaling down the current values
reduces the effective microstep resolution by
making microsteps coarser. This setting also
controls the maximum current value set by
coolStep.
Identical to IRUN, but for motor in stand still.
Allows smooth current reduction from run current
to hold current. IHOLDDELAY controls the number
of clock cycles for motor power down after
T_ZEROWAIT in increments of 2^18 clocks:
0=instant power down, 1..15: Current reduction
delay per current step in multiple of 2^18 clocks.
Setting
0 … 31
Comment
scaling factor
1/32, 2/32, … 32/32
0
1 …15
instant IHOLD
1*218 … 15*218
clocks per current
decrement
Example: When using IRUN=31 and IHOLD=16, 15
current steps are required for hold current
reduction. A IHOLDDELAY setting of 4 thus results
in a power down time of 4*15*2^18 clock cycles,
i.e. roughly one second at 16MHz.
Allows control of the sense resistor voltage range 0
for full scale current.
1
www.trinamic.com
0.32 V
0.18 V
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
31
6.1 Sense Resistors
Sense resistors should be carefully selected. The full motor current flows through the sense resistors.
They also see the switching spikes from the MOSFET bridges. A low-inductance type such as film or
composition resistors is required to prevent spikes causing ringing on the sense voltage inputs
leading to unstable measurement results. A low-inductance, low-resistance PCB layout is essential.
Any common GND path for the two sense resistors must be avoided, because this would lead to
coupling between the two current sense signals. A massive ground plane is best. Please also refer to
layout considerations in chapter 15.3.
The sense resistor needs to be able to conduct the peak motor coil current in motor standstill
conditions, unless standby power is reduced. Under normal conditions, the sense resistor sees a bit
less than the coil RMS current, because no current flows through the sense resistor during the slow
decay phases.
The peak sense resistor power dissipation is:
For high current applications, power dissipation is halved by using the low vsense setting and using
an adapted resistance value. Please be aware, that in this case any voltage drop in PCB traces has a
larger influence on the result. A compact layout with massive ground plane is best to avoid parasitic
resistance effects.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
32
7 Chopper Operation
The currents through both motor coils are controlled using choppers. The choppers work
independently of each other. In Figure 7.1 the different chopper phases are shown.
+VM
+VM
+VM
ICOIL
ICOIL
ICOIL
RSENSE
On Phase:
current flows in
direction of target
current
RSENSE
Fast Decay Phase:
current flows in
opposite direction
of target current
RSENSE
Slow Decay Phase:
current re-circulation
Figure 7.1 Chopper phases
Although the current could be regulated using only on phases and fast decay phases, insertion of the
slow decay phase is important to reduce electrical losses and current ripple in the motor. The
duration of the slow decay phase is specified in a control parameter and sets an upper limit on the
chopper frequency. The current comparator can measure coil current during phases when the current
flows through the sense resistor, but not during the slow decay phase, so the slow decay phase is
terminated by a timer. The on phase is terminated by the comparator when the current through the
coil reaches the target current. The fast decay phase may be terminated by either the comparator or
another timer.
When the coil current is switched, spikes at the sense resistors occur due to charging and discharging
parasitic capacitances. During this time, typically one or two microseconds, the current cannot be
measured. Blanking is the time when the input to the comparator is masked to block these spikes.
There are two chopper modes available: a new high-performance chopper algorithm called
spreadCycle and a proven constant off-time chopper mode. The constant off-time mode cycles through
three phases: on, fast decay, and slow decay. The spreadCycle mode cycles through four phases: on,
slow decay, fast decay, and a second slow decay.
The chopper frequency is an important parameter for a chopped motor driver. A too low frequency
might generate audible noise. A higher frequency reduces current ripple in the motor, but with a too
high frequency magnetic losses may rise. Also power dissipation in the driver rises with increasing
frequency due to the increased influence of switching slopes causing dynamic dissipation. Therefore, a
compromise needs to be found. Most motors are optimally working in a frequency range of 20 kHz to
40 kHz. The chopper frequency is influenced by a number of parameter settings as well as by the
motor inductivity and supply voltage.
A chopper frequency in the range of 20 kHz to 40 kHz gives a good result for most motors. A higher
frequency leads to increased switching losses. It is advised to check the resulting frequency and to
work below 50 kHz.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
33
Three parameters are used for controlling both chopper modes:
Parameter
TOFF
Description
Setting
Sets the slow decay time (off time). This setting also 0
limits the maximum chopper frequency.
1…15
0
Comment
chopper off
off time setting NCLK= 12 +
32*TOFF
(1 will work with minimum
blank time of 24 clocks)
16 tCLK
1
24 tCLK
2
36 tCLK
3
54 tCLK
0
1
spreadCycle
classic const. off time
Setting this parameter to zero completely disables all
driver transistors and the motor can free-wheel.
TBL
chm
Selects the comparator blank time. This time needs to
safely cover the switching event and the duration of the
ringing on the sense resistor. For most applications, a
setting of 1 or 2 is good. For highly capacitive loads,
e.g. when filter networks are used, a setting of 2 or 3
will be required.
Selection of the chopper mode
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
34
7.1 spreadCycle 2-Phase Motor Chopper
The spreadCycle (pat. fil.) chopper algorithm is a precise and simple to use chopper mode which
automatically determines the optimum length for the fast-decay phase. Several parameters are
available to optimize the chopper to the application.
Each chopper cycle is comprised of an on phase, a slow decay phase, a fast decay phase and a
second slow decay phase (see Figure 7.2). The slow decay phases limit the maximum chopper
frequency and are important for low motor and driver power dissipation. The hysteresis start setting
limits the chopper frequency by forcing the driver to introduce a minimum amount of current ripple
into the motor coils. The motor inductance limits the ability of the chopper to follow a changing
motor current. The duration of the on phase and the fast decay phase must be longer than the
blanking time, because the current comparator is disabled during blanking. This requirement is
satisfied by choosing a positive value for the hysteresis as can be estimated by the following
calculation:
Where:
dICOILBLANK is the coil current change during the blanking time
dICOILSD is the coil current change during the slow decay time
tSD is the slow decay time
tBLANK is the blank time (as set by TBL),
VM is the motor supply voltage,
ICOIL is the peak motor coil current at the maximum motor current setting CS,
RCOIL and LCOIL are motor coil inductivity and motor coil resistance.
With this, a lower limit for the start hysteresis setting can be determined:
Example:
For a 42mm stepper motor with 7.5 mH, 4.5 Ω phase and 1 A RMS current at IRUN=31, i.e. 1.41 A
peak current, at 24 V with a blank time of 1.5 µs:
With this, the minimum hysteresis start setting is 5.2. A value in the range 6 to 10 can be
used.
An Excel calculation spreadsheet is provided for the ease of use.
As experiments show, the setting is quite independent of the motor, because higher current motors
typically also have a lower coil resistance. Choosing a medium default value for the hysteresis (for
example, effective HSTART+HEND=10) normally fits most applications. The setting can be optimized by
experimenting with the motor: A too low setting will result in reduced microstep accuracy, while a
too high setting will lead to more chopper noise and motor power dissipation. When measuring the
sense resistor voltage in motor standstill at a medium coil current with an oscilloscope, a too low
setting shows a fast decay phase not longer than the blanking time. When the fast decay time
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
35
becomes slightly longer than the blanking time, the setting is optimum. You can reduce the off-time
setting, if this is hard to reach.
The hysteresis principle could in some cases lead to the chopper frequency becoming too low, e.g.
when the coil resistance is high when compared to the supply voltage. This is avoided by splitting
the hysteresis setting into a start setting (HSTRT+HEND) and an end setting (HEND). An automatic
hysteresis decrementer (HDEC) interpolates between both settings, by decrementing the hysteresis
value stepwise each 16 system clocks. At the beginning of each chopper cycle, the hysteresis begins
with a value which is the sum of the start and the end values (HSTRT+HEND), and decrements during
the cycle, until either the chopper cycle ends or the hysteresis end value (HEND) is reached. This way,
the chopper frequency is stabilized at high amplitudes and low supply voltage situations, if the
frequency gets too low. This avoids the frequency reaching the audible range.
I
target current + hysteresis start
HDEC
target current + hysteresis end
target current
target current - hysteresis end
target current - hysteresis start
on
sd
fd
sd
t
Figure 7.2 spreadCycle chopper scheme showing coil current during a chopper cycle
Two parameters control spreadCycle mode:
Parameter
HSTRT
HEND
Description
Setting
Hysteresis start setting. This value is an offset 0…7
from the hysteresis end value HEND.
Comment
HSTRT=1…8
Hysteresis end setting. Sets the hysteresis end 0…2
value after a number of decrements. The sum
HSTRT+HEND must be ≤16. At a current setting of 3
max. 30 (amplitude reduced to 240), the sum is 4…15
not limited.
-3…-1: negative HEND
This value adds to HEND.
0: zero HEND
1…12: positive HEND
Example:
In the example above a hysteresis start of 7 has been chosen. You might decide to not use
hysteresis decrement. In this case set:
HEND=10
HSTRT=0
(sets an effective end value of 7)
(sets minimum hysteresis)
In order to take advantage of the variable hysteresis, we can set hysteresis end to about half of
the start value, e.g. 4. The resulting configuration register values are as follows:
HEND=7
HSTRT=2
www.trinamic.com
(sets an effective end value of 4)
(sets an effective start value of hysteresis end +3)
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
36
7.2 Classic 2-Phase Motor Constant Off Time Chopper
The classic constant off-time chopper uses a fixed-time fast decay following each on phase. While the
duration of the on phase is determined by the chopper comparator, the fast decay time needs to be
long enough for the driver to follow the falling slope of the sine wave, but it should not be so long
that it causes excess motor current ripple and power dissipation. This can be tuned using an
oscilloscope or evaluating motor smoothness at different velocities. A good starting value is a fast
decay time setting similar to the slow decay time setting.
I
target current + offset
mean value = target current
on
fd
on
sd
fd
sd
t
Figure 7.3 Classic const. off time chopper with offset showing coil current
After tuning the fast decay time, the offset should be tuned for a smooth zero crossing. This is
necessary because the fast decay phase makes the absolute value of the motor current lower than the
target current (see Figure 7.4). If the zero offset is too low, the motor stands still for a short moment
during current zero crossing. If it is set too high, it makes a larger microstep. Typically, a positive
offset setting is required for smoothest operation.
Target current
I
Target current
I
Coil current
Coil current
t
Coil current does not have optimum shape
t
Target current corrected for optimum shape of coil current
Figure 7.4 Zero crossing with classic chopper and correction using sine wave offset
Three parameters control constant off-time mode:
Parameter
TFD
(fd3
&
HSTRT)
Description
Setting
Fast decay time setting. With CHM=1, these bits 0
control the portion of fast decay for each chopper 1…15
cycle.
Comment
slow decay only
duration of fast decay
phase
OFFSET
(HEND)
Sine wave offset. With CHM=1, these bits control 0…2
the sine wave offset. A positive offset corrects for 3
zero crossing error.
4…15
negative offset: -3…-1
Selects usage of the current comparator for 0
termination of the fast decay cycle. If current
comparator is enabled, it terminates the fast decay
cycle in case the current reaches a higher negative 1
value than the actual positive value.
enable comparator
termination of fast decay
cycle
disfdcc
www.trinamic.com
no offset: 0
positive offset 1…12
end by time only
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
37
7.3 Random Off Time
In the constant off-time chopper mode, both coil choppers run freely without synchronization. The
frequency of each chopper mainly depends on the coil current and the motor coil inductance. The
inductance varies with the microstep position. With some motors, a slightly audible beat can occur
between the chopper frequencies when they are close together. This typically occurs at a few
microstep positions within each quarter wave. This effect is usually not audible when compared to
mechanical noise generated by ball bearings, etc. Another factor which can cause a similar effect is a
poor layout of the sense resistor GND connections.
A common factor, which can cause motor noise, is a bad PCB layout causing coupling of both sense
resistor voltages (please refer layouts hint in chapter 15.3).
To minimize the effect of a beat between both chopper frequencies, an internal random generator is
provided. It modulates the slow decay time setting when switched on by the rndtf bit. The rndtf
feature further spreads the chopper spectrum, reducing electromagnetic emission on single
frequencies.
Parameter
rndtf
Description
Setting
This bit switches on a random off time generator, 0
which slightly modulates the off time TOFF using
1
a random polynomial.
www.trinamic.com
Comment
disable
random modulation
enable
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
38
7.4 chopSync2 for Quiet Motors
While a frequency adaptive chopper like spreadCycle provides excellent high velocity operation, in
some applications, a constant frequency chopper is preferred rather than a frequency adaptive
chopper. This may be due to chopper noise in motor standstill, or due to electro-magnetic emission.
chopSync provides a means to synchronize the choppers for both coils with a common clock, by
extending the off time of the coils. It integrates with both chopper principles. However, a careful set
up of the chopper is necessary, because chopSync2 can just increment the off times, but not reduce
the duration of the chopper cycles themselves. Therefore, it is necessary to test successful operation
best with an oscilloscope. Set up the chopper as detailed above, but take care to have chopper
frequency higher than the chopSync2 frequency. As high motor velocities take advantage of the
normal, adaptive chopper style, chopSync2 becomes automatically switched off using the VHIGH
velocity limit programmed within the motion controller.
A suitable chopSync2 SYNC value can be calculated as follows:
Example:
The motor is operated in spreadCycle mode (chm=0). The minimum chopper frequency for
standstill and slow motion (up to VHIGH) has been determined to be 25 kHz under worst case
operation conditions (hot motor, low supply voltage). The standstill noise needs to be
minimized by using chopSync. The IC uses an external 16 MHz clock.
Considering the chopper mode 0, SYNC has to be set for the closest value resulting in or
below the double frequency, e.g. 50 kHz. Using above formula, a value of 5 results exactly and
can be used. Trying a value of 6, a frequency of 41.7 kHz results, which still gives an effective
chopper frequency of slightly above 20 kHz, and thus would also be a valid solution. A value
of 7 might still be good, but could already give high frequency noise.
In chopper mode 1, SYNC could be set to any value between 10 and 13 to be within the
chopper frequency range of 19.8 kHz to 25 kHz.
Parameter
SYNC
Description
Setting
This register allows synchronization of the 0
chopper for both phases of a two phase motor in
order to avoid the occurrence of a beat, especially 1…15
at low motor velocities. It is automatically
switched off above VHIGH.
Hint: Set TOFF to a low value, so that the chopper
cycle is ended, before the next sync clock pulse
occurs. Set SYNC for the double desired chopper
frequency for chm=0, for the desired base chopper
frequency for chm=1.
www.trinamic.com
Comment
chopSync off
fCLK/64
…
fCLK/(15*64)
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
39
8 Driver Diagnostic Flags
The TMC5031 drivers supply a complete set of diagnostic and protection capabilities, like short to GND
protection and undervoltage detection. A detection of an open load condition allows testing if a
motor coil connection is interrupted. See the DRV_STATUS table for details.
8.1 Temperature Measurement
The TMC5031 integrates a two level temperature sensor (120°C prewarning and 150°C thermal
shutdown) for diagnostics and for protection of the IC against excess heat. The heat is mainly
generated by the voltage regulator and the motor driver stages. The central temperature detector can
detect heat accumulation on the chip, i.e. due to missing convection cooling or rising environment
temperature. It cannot detect overheating of the power transistors in all cases, e.g. with bad PCB
layout, because heat transfer between power transistors and temperature sensor depends on the PCB
layout and environmental conditions. Most critical situations, where the driver MOSFETs could be
overheated, are avoided when enabling the short to GND protection. For many applications, the
overtemperature prewarning will indicate an abnormal operation situation and can be used to initiate
user warning or power reduction measures like motor current reduction. If continuous operation in
hot environments is necessary, a more precise processor based temperature measurement should be
used to realize application specific overtemperature detection. The thermal shutdown is just an
emergency measure and temperature rising to the shutdown level should be prevented by design.
After triggering the overtemperature sensor (ot flag), the driver remains switched off until the system
temperature falls below the prewarning level (otpw) to avoid continuous heating to the shut down
level.
8.2 Short to GND Protection
The TMC5031 power stages are protected against a short circuit condition by an additional measurement of the current flowing through the highside MOSFETs. This is important, as most short circuit
conditions result from a motor cable insulation defect, e.g. when touching the conducting parts
connected to the system ground. The short detection is protected against spurious triggering, e.g. by
ESD discharges, by retrying three times before switching off the motor.
Once a short condition is safely detected, the corresponding driver bridge becomes switched off, and
the s2ga or s2gb flag becomes set. In order to restart the motor, the user must intervene by disabling
and re-enabling the driver. It should be noted, that the short to GND protection cannot protect the
system and the power stages for all possible short events, as a short event is rather undefined and a
complex network of external components may be involved. Therefore, short circuits should basically
be avoided.
8.3 Open Load Diagnostics
Interrupted cables are a common cause for systems failing, e.g. when connectors are not firmly
plugged. The TMC5031 detects open load conditions by checking, if it can reach the desired motor coil
current. This way, also undervoltage conditions, high motor velocity settings or short and
overtemperature conditions may cause triggering of the open load flag, and inform the user, that
motor torque may suffer. In motor stand still, open load cannot be measured, as the coils might
eventually have zero current.
In order to safely detect an interrupted coil connection, read out the open load flags at low or
nominal motor velocity operation, only. However, the ola and olb flags have just informative
character and do not cause any action of the driver.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
40
9 Ramp Generator
The TMC5031 integrates a new type of ramp generator, which offers faster machine operation
compared to the classical linear acceleration ramps. The sixPoint ramp generator allows adapting the
acceleration ramps to the torque curves of a stepper motor and uses two different acceleration
settings each for the acceleration phase and for the deceleration phase. See Figure 9.2.
9.1 Real World Unit Conversion
The TMC5031 uses its internal or external clock signal as a time reference for all internal operations.
Thus, all time, velocity and acceleration settings are referenced to fCLK. For best stability and
reproducibility, it is recommended to use an external quartz oscillator as a time base, or to provide a
clock signal from a microcontroller.
The units of a TMC5031 register content are written as register[5031].
PARAMETER VS. UNITS
Parameter / Symbol
fCLK[Hz]
s
US
FS
µstep velocity v[Hz]
µstep acceleration a[Hz/s]
Unit
[Hz]
[s]
µstep
fullstep
µsteps / s
µsteps / s^2
USC microstep count
counts
rotations per second v[rps]
rotations / s
rps acceleration a[rps/s^2]
rotations / s^2
ramp steps[µsteps] = rs
µsteps
calculation / description / comment
clock frequency of the TMC5031 in [Hz]
second
v[Hz] = v[5031] * ( fCLK[Hz]/2 / 2^23 )
a[Hz/s] = a[5031] * fCLK[Hz]^2 / (512*256) / 2^24
microstep resolution in number of microsteps
(i.e. the number of microsteps between two
fullsteps – normally 256)
v[rps] = v[µsteps/s] / USC / FSC
FSC: motor fullsteps per rotation, e.g. 200
a[rps/s^2] = a[µsteps/s^2] / USC / FSC
rs = (v[5031])^2 / a[5031] / 2^8
microsteps during linear acceleration ramp
(assuming acceleration from 0 to v)
9.2 Ramp Generator Functionality
For the ramp generator register set, please refer to the chapter 5.2.
9.2.1 Ramp Mode
The ramp generator delivers two phase acceleration and two phase deceleration ramps with
additional programmable start and stop velocities (see Figure 9.1).
Note!
The start velocity can be set to zero, if not used.
The stop velocity can be set to one, if not used.
Take care to always set VSTOP identical to or above VSTART. This ensures that even a short
motion can be terminated successfully at the target position.
The two different sets of acceleration and deceleration can be combined freely. A common transition
speed V1 allows for velocity dependent switching between both acceleration and deceleration
settings. A typical use case will use lower acceleration and deceleration values at higher velocities, as
the motors torque declines at higher velocity. When considering friction in the system, it becomes
clear, that typically deceleration of the system is quicker than acceleration. Thus, deceleration values
can be higher in many applications. This way, operation speed of the motor in time critical
applications can be maximized.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
41
As target positions and ramp parameters may be changed any time during the motion, the motion
controller will always use the optimum (fastest) way to reach the target, while sticking to the
constraints set by the user. This way it might happen, that the motion becomes automatically
stopped, crosses zero and drives back again. This case is flagged by the special flag second_move.
9.2.2 Start and Stop Velocity
When using increased levels of start- and stop velocity, it becomes clear, that a subsequent move into
the opposite direction would provide a jerk identical to VSTART+VSTOP, rather than only VSTART. As
the motor probably is not able to follow this, you can set a time delay for a subsequent move by
setting TZEROWAIT. An active delay time is flagged by the flag t_zerowait_active. Once the target
position is reached, the flag pos_reached becomes active.
motor
stop
v
acceleration phase
acceleration
phase
deceleration phase
VMAX
DM
AX
AX
AM
V1
A1
D1
VSTOP
VSTART
0
VACTUAL
1
-A
TZEROWAIT
t
Figure 9.1 Ramp generator velocity trace showing consequent move in negative direction
torque
high deceleration
2xMFRICT
MNOM2
Torque for VSTART
MNOM1
high acceleration
Torque available for acceleration A1
VMAX
Torque required
for static loads
V1
0
reduced accel.
Torque available for
AMAX
VSTART
MFRICT
reduced decel.
motor
torque
MMAX
velocity [RPM]
MFRICT
Portion of torque required for friction and static load within the system
MMAX
Motor pull-out torque at v=0
MNOM1/2 Torque available at V1 resp. VMAX
Motor torque used in acceleration phase
Overall torque usable for deceleration
Figure 9.2 Illustration of optimized motor torque usage with TMC5031 ramp generator
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
42
9.2.3 Velocity Mode
For the ease of use, velocity mode movements do not use the different acceleration and deceleration
settings. You need to set VMAX and AMAX only for velocity mode. The ramp generator always uses
AMAX to accelerate or decelerate to VMAX in this mode.
In order to decelerate the motor to stand still, it is sufficient to set VMAX to zero. The flag vzero
signals standstill of the motor. The flag velocity_reached always signals, that the target velocity has
been reached.
9.3 Velocity Thresholds
The ramp generator provides a number of velocity thresholds coupled to the actual velocity VACTUAL.
The different ranges allow programming the motor to the optimum step mode, coil current and
acceleration settings.
motor going to standby
motor in standby
motor stand still
microstepping
coolStep
+
DM
AX
microstep
coolStep
+
A1
microstep
VSTOP
VSTART
0
AX
AM
D1
VCOOLTHRS
microstepping
V1
motor in standby
VMAX
VHIGH
high velocity fullstep
v
t
RMS current
coolStep current reduction
dI * IHOLDDELAY
VACTUAL
TZEROWAIT
current
I_RUN
I_HOLD
Figure 9.3 Ramp generator velocity dependent motor control
Since it is not necessary to differentiate the velocity to the last detail, the velocity thresholds use a
reduced number of bits for comparison and the lower eight bits of the compare values become
ignored.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
43
9.4 Reference Switches
Prior to normal operation of the drive an absolute reference position must be set. The reference
position can be found using a mechanical stop which can be detected by stall detection, or by a
reference switch.
In case of a linear drive, the mechanical motion range must not be left. This can be ensured by
enabling the stop switch functions for the left and the right reference switch. Therefore, the ramp
generator responds to a number of stop events as configured in the SW_MODE register. There are two
ways to stop the motor:
- it can be stopped abruptly, when a switch is hit. This is useful in an emergency case.
- Or the motor can be softly decelerated to zero using deceleration settings.
Note:
Latching of the ramp position XACTUAL to the holding register XLATCH upon a switch event gives a
precise snapshot of the position of the reference switch.
REF_L
+VCC_IO
+VCC_IO
10k
10k
22k
REF_R
Motor
1nF
Negative
direction
Optional RC filter
(example)
Positive
direction
Traveler
Figure 9.4 Using reference switches (example)
Normally open or normally closed switches can be used by programming the switch polarity or
selecting the pull-up or pull-down resistor configuration. A normally closed switch is failsafe with
respect to an interrupt of the switch connection. Switches which can be used are:
- mechanical switches,
- photo interrupters, or
- hall sensors.
Be careful to select resistors matching your switch requirements!
In case of long cables additional RC filtering might be required near the TMC5031 reference inputs.
Adding an RC filter will also reduce the danger of destroying the logic level inputs by wiring faults,
but it will add a certain delay which should be considered with respect to the application.
IMPLEMENTING A HOMING PROCEDURE
-
-
Make sure, that the switch is not pressed.
Activate position latching upon the desired switch event and activate motor (soft) stop upon
active switch.
Start a motion ramp into the direction of the switch. (Move to a more negative position for a
left switch, to a more positive position for a right switch). You may timeout this motion by
using a position ramping command.
As soon as the switch is hit, the position becomes latched and the motor is stopped. Wait
until the motor is in standstill again.
Switch the ramp generator to hold mode and calculate the difference between the latched
position and the actual position.
Write the calculated difference into the actual position register. Now, the homing is finished.
A move to position 0 will bring back the motor exactly to the switching point.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
44
10 stallGuard2 Load Measurement
stallGuard2 provides an accurate measurement of the load on the motor. It can be used for stall
detection as well as other uses at loads below those which stall the motor, such as coolStep loadadaptive current reduction. The stallGuard2 measurement value changes linearly over a wide range of
load, velocity, and current settings, as shown in Figure 10.1. At maximum motor load, the value goes
to zero or near to zero. This corresponds to a load angle of 90° between the magnetic field of the
coils and magnets in the rotor. This also is the most energy-efficient point of operation for the motor.
1000
stallGuard2
reading
900
Start value depends
on motor and
operating conditions
800
700
600
stallGuard value reaches zero
and indicates danger of stall.
This point is set by stallGuard
threshold value SGT.
500
400
Motor stalls above this point.
Load angle exceeds 90° and
available torque sinks.
300
200
100
0
10
20
30
40
50
60
70
80
90
100
motor load
(% max. torque)
Figure 10.1 Function principle of stallGuard2
Parameter
SGT
sfilt
Status
word
SG
Description
This signed value controls the stallGuard2
threshold level for stall detection and sets the
optimum measurement range for readout. A lower
value gives a higher sensitivity. Zero is the
starting value working with most motors. A higher
value makes stallGuard2 less sensitive and
requires more torque to indicate a stall.
Enables the stallGuard2 filter for more precision of
the measurement. If set, reduces the measurement
frequency to one measurement per electrical
period of the motor (4 fullsteps).
Description
Setting
0
Comment
indifferent value
+1… +63
-1… -64
less sensitivity
higher sensitivity
0
1
standard mode
filtered mode
Range
Comment
This is the stallGuard2 result. A higher reading
indicates less mechanical load. A lower reading
indicates a higher load and thus a higher load
angle. Tune the SGT setting to show a SG reading
of roughly 0 to 100 at maximum load before
motor stall.
0… 1023 0: highest load
low value: high load
high value: less load
In order to use stallGuard2 and coolStep, the stallGuard2 sensitivity should first be tuned using the
SGT setting!
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
45
10.1 Tuning the stallGuard2 Threshold SGT
The stallGuard2 value SG is affected by motor-specific characteristics and application-specific demands
on load and velocity. Therefore the easiest way to tune the stallGuard2 threshold SGT for a specific
motor type and operating conditions is interactive tuning in the actual application.
The procedure is:
1. Operate the motor at the normal operation velocity for your application and monitor SG.
2. Apply slowly increasing mechanical load to the motor. If the motor stalls before SG reaches zero,
decrease SGT. If SG reaches zero before the motor stalls, increase SGT. A good SGT starting value
is zero. SGT is signed, so it can have negative or positive values.
3. Now enable sg_stop and make sure, that the motor is safely stopped whenever it is stalled.
Increase SGT if the motor becomes stopped before a stall occurs.
4. The optimum setting is reached when SG is between 0 and roughly 100 at increasing load shortly
before the motor stalls, and SG increases by 100 or more without load. SGT in most cases can be
tuned for a certain motion velocity or a velocity range. Make sure, that the setting works reliable
in a certain range (e.g. 80% to 120% of desired velocity) and also under extreme motor conditions
(lowest and highest applicable temperature).
SG goes to zero when the motor stalls and the ramp generator can be programmed to stop the
motor upon a stall event by enabling sg_stop in SW_MODE.
The system clock frequency affects SG. An external crystal-stabilized clock should be used for
applications that demand the highest performance. The power supply voltage also affects SG, so
tighter regulation results in more accurate values. SG measurement has a high resolution, and there
are a few ways to enhance its accuracy, as described in the following sections.
Note!
Application Note 002 Parameterization of stallGuard2 & coolStep is available on www.trinamic.com.
10.1.1 Variable Velocity Operation
The SGT setting chosen as a result of the previously described SGT tuning (chapter 0) can be used for
a certain velocity range. Outside this range, a stall may not be detected safely, and coolStep might
not give the optimum result.
stallGuard2
reading at
no load
optimum
SGT setting
1000
20
900
18
800
16
700
14
600
12
500
10
400
8
300
6
200
4
100
2
0
0
good operation
range with single
SGT setting
50
lower limit for stall
detection
100
150
200
250
300
back EMF reaches
supply voltage
350
400
450
500
550
600
Motor RPM
(200 FS motor)
Figure 10.2 Example: Optimum SGT setting and stallGuard2 reading with an example motor
In many applications, operation at or near a single operation point is used most of the time and a
single setting is sufficient. The ramp generator provides a lower and an upper velocity threshold to
match this. The stall detection should be ignored and disabled by software outside the determined
operation point, e.g. during acceleration phases preceding a sensorless homing procedure.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
46
In some applications, a velocity dependent tuning of the SGT value can be expedient, using a small
number of support points and linear interpolation.
10.1.2 Small Motors with High Torque Ripple and Resonance
Motors with a high detent torque show an increased variation of the stallGuard2 measurement value
SG with varying motor currents, especially at low currents. For these motors, the current dependency
should be checked for best result.
10.1.3 Temperature Dependence of Motor Coil Resistance
Motors working over a wide temperature range may require temperature correction, because motor
coil resistance increases with rising temperature. This can be corrected as a linear reduction of SG at
increasing temperature, as motor efficiency is reduced.
10.1.4 Accuracy and Reproducibility of stallGuard2 Measurement
In a production environment, it may be desirable to use a fixed SGT value within an application for
one motor type. Most of the unit-to-unit variation in stallGuard2 measurements results from manufacturing tolerances in motor construction. The measurement error of stallGuard2 – provided that all
other parameters remain stable – can be as low as:
10.2 stallGuard2 Measurement Frequency and Filtering
The stallGuard2 measurement value SG is updated with each full step of the motor. This is enough to
safely detect a stall, because a stall always means the loss of four full steps. In a practical application,
especially when using coolStep, a more precise measurement might be more important than an
update for each fullstep because the mechanical load never changes instantaneously from one step to
the next. For these applications, the sfilt bit enables a filtering function over four load measurements.
The filter should always be enabled when high-precision measurement is required. It compensates for
variations in motor construction, for example due to misalignment of the phase A to phase B
magnets. The filter should only be disabled when rapid response to increasing load is required, such
as for stall detection at high velocity.
10.3 Detecting a Motor Stall
To safely detect a motor stall the stall threshold must be determined using a specific SGT setting.
Therefore, you need to determine the maximum load the motor can drive without stalling and to
monitor the SG value at this load, e.g. some value within the range 0 to 100. The stall threshold
should be a value safely within the operating limits, to allow for parameter stray. The response at an
SGT setting at or near 0 gives some idea on the quality of the signal: Check the SG value without
load and with maximum load. They should show a difference of at least 100 or a few 100, which shall
be large compared to the offset. If you set the SGT value in a way, that a reading of 0 occurs at
maximum motor load, the stall can be automatically detected by the motion controller to issue a
motor stop.
10.4 Limits of stallGuard2 Operation
stallGuard2 does not operate reliably at extreme motor velocities: Very low motor velocities (for many
motors, less than one revolution per second) generate a low back EMF and make the measurement
unstable and dependent on environment conditions (temperature, etc.). Other conditions will also lead
to extreme settings of SGT and poor response of the measurement value SG to the motor load.
Very high motor velocities, in which the full sinusoidal current is not driven into the motor coils also
leads to poor response. These velocities are typically characterized by the motor back EMF reaching
the supply voltage.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
47
11 coolStep Operation
coolStep is an automatic smart energy optimization for stepper motors based on the motor
mechanical load, making them “green”.
11.1 User Benefits
Energy efficiency
Motor generates less heat
Less cooling infrastructure
Cheaper motor
–
–
–
–
consumption decreased up to 75%
improved mechanical precision
for motor and driver
does the job!
coolStep allows substantial energy savings, especially for motors which see varying loads or operate
at a high duty cycle. Because a stepper motor application needs to work with a torque reserve of 30%
to 50%, even a constant-load application allows significant energy savings because coolStep
automatically enables torque reserve when required. Reducing power consumption keeps the system
cooler, increases motor life, and allows reducing cost in the power supply and cooling components.
Reducing motor current by half results in reducing power by a factor of four.
11.2 Setting up for coolStep
coolStep is controlled by several parameters, but two are critical for understanding how it works:
Parameter
Description
SEMIN
4-bit unsigned integer that sets a lower threshold. 0
If SG goes below this threshold, coolStep 1…15
increases the current to both coils. The 4-bit
SEMIN value is scaled by 32 to cover the lower
half of the range of the 10-bit SG value. (The
name of this parameter is derived from
smartEnergy, which is an earlier name for
coolStep.)
4-bit unsigned integer that controls an upper 0…15
threshold. If SG is sampled equal to or above this
threshold enough times, coolStep decreases the
current to both coils. The upper threshold is
(SEMIN + SEMAX + 1)*32.
SEMAX
Range
Comment
disable coolStep
threshold is SEMIN*32
threshold is
(SEMIN+SEMAX+1)*32
FIGURE 11.1 SHOWS THE OPERATING REGIONS OF COOLSTEP:
-
The black line represents the SG measurement value.
The blue line represents the mechanical load applied to the motor.
The red line represents the current into the motor coils.
When the load increases, SG falls below SEMIN, and coolStep increases the current. When the load
decreases, SG rises above (SEMIN + SEMAX + 1) * 32, and the current is reduced.
www.trinamic.com
stallGuard2
reading
mechanical load
48
motor current
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
current setting I_RUN
(upper limit)
motor current reduction area
SEMAX+SEMIN+1
SEMIN
½ or ¼ I_RUN
(lower limit)
motor current increment area
0=maximum load
load angle optimized
Zeit
slow current reduction due
to reduced motor load
load
angle
optimized
current increment due to
increased load
stall possible
load angle optimized
Figure 11.1 coolStep adapts motor current to the load
Five more parameters control coolStep and one status value is returned:
Parameter
SEUP
SEDN
SEIMIN
VCOOL
THRS
VHIGH
Status
word
CSACTUAL
Description
Range
Sets the current increment step. The current 0…3
becomes incremented for each measured
stallGuard2 value below the lower threshold.
Sets the number of stallGuard2 readings above the 0…3
upper threshold necessary for each current
decrement of the motor current.
Sets the lower motor current limit for coolStep
operation by scaling the IRUN current setting.
Lower ramp generator velocity threshold. Below
this velocity coolStep becomes disabled. Adapt to
the lower limit of the velocity range where
stallGuard2 gives a stable result.
0
1
1…
2^23
Hint: May be adapted to disable coolStep during
acceleration and deceleration phase by setting
identical to VMAX.
Upper ramp generator velocity threshold value. 1…
Above this velocity coolStep becomes disabled. 2^23
Adapt to the velocity range where stallGuard2
gives a stable result.
Description
Range
This status value provides the actual motor 0…31
current scale as controlled by coolStep. The value
goes up to the IRUN value and down to the
portion of IRUN as specified by SEIMIN.
www.trinamic.com
Comment
step width is
1, 2, 4, 8
number of stallGuard2
measurements per
decrement:
32, 8, 2, 1
0: 1/2 of IRUN
1: 1/4 of IRUN
Also controls additional
functions like switching
to fullstepping.
Comment
1/32, 2/32, … 32/32
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
49
11.3 Tuning coolStep
Before tuning coolStep, first tune the stallGuard2 threshold level SGT, which affects the range of the
load measurement value SG. coolStep uses SG to operate the motor near the optimum load angle of
+90°.
The current increment speed is specified in SEUP, and the current decrement speed is specified in
SEDN. They can be tuned separately because they are triggered by different events that may need
different responses. The encodings for these parameters allow the coil currents to be increased much
more quickly than decreased, because crossing the lower threshold is a more serious event that may
require a faster response. If the response is too slow, the motor may stall. In contrast, a slow
response to crossing the upper threshold does not risk anything more serious than missing an
opportunity to save power.
coolStep operates between limits controlled by the current scale parameter IRUN and the seimin bit.
11.3.1 Response Time
For fast response to increasing motor load, use a high current increment step SEUP. If the motor load
changes slowly, a lower current increment step can be used to avoid motor oscillations. If the filter
controlled by sfilt is enabled, the measurement rate and regulation speed are cut by a factor of four.
Hint:
The most common and most beneficial use is to adapt coolStep for operation at the typical system
target operation velocity and to set the velocity thresholds according. As acceleration and
decelerations normally shall be quick, they will require the full motor current, while they have only a
small contribution to overall power consumption due to their short duration.
11.3.2 Low Velocity and Standby Operation
Because coolStep is not able to measure the motor load in standstill and at very low RPM, a lower
velocity threshold is provided in the ramp generator. It should be set to an application specific
default value. Below this threshold the normal current setting via IRUN respectively IHOLD is valid. An
upper threshold is provided by the VHIGH setting. Both thresholds can be set as a result of the
stallGuard2 tuning process.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
50
12 Sine-Wave Look-up Table
Each of the TMC5031 drivers provides a programmable look-up table for storing the microstep current
wave. As a default, the tables are pre-programmed with a sine wave, which is a good starting point
for most stepper motors. Reprogramming the table to a motor specific wave allows drastically
improved microstepping especially with low-cost motors.
12.1 User Benefits
Microstepping
Motor
Torque
–
–
–
extremely improved with low cost motors
runs smooth and quiet
reduced mechanical resonances yields improved torque
12.2 Microstep Table
In order to minimize required memory and the amount of data to be programmed, only a quarter of
the wave becomes stored. The internal microstep table maps the microstep wave from 0° to 90°. It
becomes symmetrically extended to 360°. When reading out the table the 10-bit microstep counter
MSCNT addresses the fully extended wave table. The table is stored in an incremental fashion, using
each one bit per entry. Therefore only 256 bits (ofs00 to ofs255) are required to store the quarter
wave. These bits are mapped to eight 32 bit registers. Each ofs bit controls the addition of an
inclination Wx or Wx+1 when advancing one step in the table. When Wx is 0, a 1 bit in the table at
the actual microstep position means “add one” when advancing to the next microstep. As the wave
can have a higher inclination than 1, the base inclinations Wx can be programmed to -1, 0, 1, or 2
using up to four flexible programmable segments within the quarter wave. This way even a negative
inclination can be realized. The four inclination segments are controlled by the position registers X1
to X3. Inclination segment 0 goes from microstep position 0 to X1-1 and its base inclination is
controlled by W0, segment 1 goes from X1 to X2-1 with its base inclination controlled by W1, etc.
When modifying the wave, care must be taken to ensure a smooth and symmetrical zero transition
when the quarter wave becomes expanded to a full wave. The maximum resulting swing of the wave
should be adjusted to a range of -248 to 248, in order to give the best possible resolution while
leaving headroom for the hysteresis based chopper to add an offset.
W3: -1/+0
W2: +0/+1
W1: +1/+2
W0: +2/+3
y
256
248
START_SIN90_120
0
X1 X2 X3
LUT stores
entries 0 to 255
255 256
START_SIN
-248
Figure 12.1 LUT programming example
www.trinamic.com
512
768
0
MSCNT
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
51
When the microstep sequencer advances within the table, it calculates the actual current values for
the motor coils with each microstep and stores them to the registers CUR_A and CUR_B. However the
incremental coding requires an absolute initialization, especially when the microstep table becomes
modified. Therefore CUR_A and CUR_B become initialized whenever MSCNT passes zero.
Two registers control the starting values of the tables:
- As the starting value at zero is not necessarily 0 (it might be 1 or 2), it can be programmed
into the starting point register START_SIN.
- In the same way, the start of the second wave for the second motor coil needs to be stored
in START_SIN90_120. This register stores the resulting table entry for a phase shift of 90° for
2-phase stepper motors.
Hints:
Refer chapter 5.3 for the register set and for the default table function stored in the drivers. The
default table is a good base for realizing an own table.
The TMC5031-EVAL will come with a calculation tool for own waves.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
52
13 Clock Oscillator and Clock Input
The clock is the timing reference for all functions: the chopper, the velocity, the acceleration control,
etc. Many parameters are scaled with the clock frequency, thus a precise reference allows a more
deterministic result. The on-chip clock oscillator provides timing in case no external clock is easily
available.
USING THE INTERNAL CLOCK
Directly tie the CLK input to GND near to the TMC5031 if the internal clock oscillator is to be used. The
internal clock can be calibrated by driving the ramp generator at a certain velocity setting. Reading
out position values via the interface and comparing the resulting velocity to the remote masters’ clock
gives a time reference. This allows scaling acceleration and velocity settings as a result. The
temperature dependency and ageing of the internal clock is comparatively low.
In case well defined velocity settings and precise motor chopper operation are desired, it is supposed
to work with an external clock source.
USING AN EXTERNAL CLOCK
When an external clock is available, a frequency of 12 MHz to 16 MHz is recommended for optimum
performance. The duty cycle of the clock signal is uncritical, as long as minimum high or low input
time for the pin is satisfied (refer to electrical characteristics). Up to 18 MHz can be used, when the
clock duty cycle is 50%. Make sure, that the clock source supplies clean CMOS output logic levels and
steep slopes when using a high clock frequency. The external clock input is enabled with the first
positive polarity seen on the CLK input.
Attention:
Switching off the external clock frequency prevents the driver from operating normally. Therefore be
careful to switch off the motor drivers before switching off the clock (e.g. using the enable input),
because otherwise the chopper would stop and the motor current level could rise uncontrolled. The
short to GND detection stays active even without clock, if enabled.
13.1 Considerations on the Frequency
A higher frequency allows faster step rates, faster SPI operation and higher chopper frequencies. On
the other hand, it may cause more electromagnetic emission of the system and causes more power
dissipation in the TMC5031 digital core and voltage regulator. Generally a frequency of 12 MHz to 16
MHz should be sufficient for most applications. For reduced requirements concerning the motor
dynamics, a clock frequency of down to 8 MHz can be considered.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
53
14 Absolute Maximum Ratings
The maximum ratings may not be exceeded under any circumstances. Operating the circuit at or near
more than one maximum rating at a time for extended periods shall be avoided by application
design.
Parameter
Supply voltage
I/O supply voltage
digital VCC supply voltage (if not supplied by internal
regulator)
Logic input voltage
Maximum current to / from digital pins
and analog low voltage I/Os
5V regulator output current (internal plus external load)
5V regulator continuous power dissipation (VVM-5V) * I5VOUT
Power bridge repetitive output current (TJ ≤ 105°C)
Power bridge repetitive output current (TJ ≤ 125°C)
Power bridge repetitive output current (TJ = 150°C)
Junction temperature
Storage temperature
ESD-Protection for interface pins (Human body model,
HBM)
ESD-Protection for handling (Human body model, HBM)
Symbol
VVS
VVIO
VVCC
Min
-0.5
-0.5
-0.5
Max
18
5.5
5.5
Unit
V
V
V
VI
IIO
-0.5
VVIO+0.5
+/-10
V
mA
50
1
2.0
1.5
0.8
150
150
4 (tbd.)
mA
W
A
A
A
°C
°C
kV
1 (tbd.)
kV
Max
125
16
5.4
5.25
5.25
Unit
°C
V
V
V
V
1.1
1.5
A
A
I5VOUT
P5VOUT
IOx
IOx
IOx
TJ
TSTG
VESDAP
-50
-55
VESD
15 Electrical Characteristics
15.1 Operational Range
Parameter
Junction temperature
Supply voltage (using internal +5V regulator)
Supply voltage (internal +5V regulator bridged: VVCC=VVSA)
I/O supply voltage
VCC voltage when using optional external source (supplies
digital logic and charge pump)
Peak output current per motor coil output (sine wave peak)
Peak output current per motor coil output (sine wave peak)
Limit TJ ≤ 105°C, e.g. with 50% duty cycle at 3s on / 3s off.
www.trinamic.com
Symbol
TJ
VVS
VVS
VVIO
VVCC
IOx
IOx
Min
-40
5.5
4.7
3.00
4.75
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
54
15.2 DC Characteristics and Timing Characteristics
DC characteristics contain the spread of values guaranteed within the specified supply voltage range
unless otherwise specified. Typical values represent the average value of all parts measured at +25°C.
Temperature variation also causes stray to some values. A device with typical values will not leave
Min/Max range within the full temperature range.
Power supply current
DC-Characteristics
VVS = 16.0V
Parameter
Supply current, driver disabled
Supply current, operating
Symbol
IVS
IVS
Static supply current
Supply current, driver disabled,
dependency on CLK frequency
Internal current consumption
from 5V supply on VCC pin
IO supply current
IVS0
IVS
Motor driver section
DC- and Timing-Characteristics
VVS = 16.0V
Parameter
RDSON lowside MOSFET
Symbol
RONL
RDSON highside MOSFET
RONH
slope, MOSFET turning on
tSLPON
slope, MOSFET turning off
tSLPOFF
Current sourcing, driver off
IOIDLE
Charge pump
DC-Characteristics
Parameter
Charge pump output voltage
Symbol
VVCP-VVS
Charge pump voltage threshold
for undervoltage detection
Charge pump frequency
VVCP-VVS
Linear regulator
DC-Characteristics
Parameter
Output voltage
IVCC
IVIO
Conditions
fCLK=16MHz
fCLK=16MHz, 40kHz
chopper
fCLK=0Hz
fCLK variable,
additional to IVS0
fCLK=16MHz, 40kHz
chopper
no load on outputs,
inputs at VIO or GND
Conditions
measure at 100mA,
25°C, static state
measure at 100mA,
25°C, static state
measured at 700mA
load current
measured at 700mA
load current
OXX pulled to GND
Conditions
operating, typical
fchop<40kHz
using internal 5V
regulator voltage
Min
V5VOUT
Max
40
7
1.6
30
Min
Unit
mA
mA
mA
mA/MHz
40
10
mA
µA
Typ
0.4
Max
0.5
Unit
Ω
0.5
0.6
Ω
120
250
ns
220
450
ns
120
180
250
µA
Min
4.0
Typ
V5VOUT 0.4
3.6
Max
V5VOUT
3.3
fCP
Symbol
Typ
30
33
Unit
V
3.8
V
1/16
fCLKOSC
Conditions
Min
Typ
Max
Unit
I5VOUT = 0mA
4.75
5.0
5.25
V
TJ = 25°C
Output resistance
R5VOUT
Static load
3
Deviation of output voltage over
the full temperature range
V5VOUT(DEV)
I5VOUT = 30mA
30
www.trinamic.com
TJ = full range

100
mV
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
55
Clock oscillator and input
Timing-Characteristics
Parameter
Clock oscillator frequency
Clock oscillator frequency
Clock oscillator frequency
External clock frequency
(operating)
External clock high / low level
time
Symbol
fCLKOSC
fCLKOSC
fCLKOSC
fCLK
Conditions
tJ=-50°C
tJ=50°C
tJ=150°C
tCLK
CLK driven to
0.1 VVIO / 0.9 VVIO
Detector levels
DC-Characteristics
Parameter
VVS undervoltage threshold for
RESET
V5VOUT undervoltage threshold for
RESET
Short to GND detector threshold
(VVSP - VOx)
Short to GND detector delay
(high side switch on to short
detected)
Overtemperature prewarning
Overtemperature shutdown
Symbol
VUV
Conditions
VVS rising
VUV
V5VOUT rising
Sense resistor voltage levels
DC-Characteristics
Parameter
Sense input peak threshold
voltage (low sensitivity)
Symbol
VSRTL
sense input peak threshold
voltage (high sensitivity)
VSRTH
VOS2G
Min
8.8
9.4
9.6
8
Parameter
Min
3.8
Unit
MHz
MHz
MHz
MHz
ns
Typ
4.2
Max
4.6
3.5
Unit
V
V
1.5
2.2
3
V
tS2G
High side output
clamped to VSP-3V
0.8
1.3
2
µs
tOTPW
tOT
Temperature rising
Temperature rising
100
135
120
150
140
170
°C
°C
Min
Typ
325
Max
Unit
mV
Conditions
vsense=0
csactual=31
sin_x=248
Hyst.=0; IBRxy=0
vsense=1
csactual=31
sin_x=248
Hyst.=0; IBRxy=0
180
mV
20
mΩ
DC-Characteristics
Symbol
Input voltage low level
Input voltage high level
Input Schmitt trigger hysteresis
VINLO
VINHI
VINHYST
Output voltage low level
Output voltage high level
Input leakage current
VOUTLO
VOUTHI
IILEAK
www.trinamic.com
Max
17.9
18.8
18.9
18
25
Internal resistance from pin BRxy RBRxy
to internal sense comparator
(additional to sense resistor)
Digital logic levels
Typ
12.4
13.2
13.4
12-16
Conditions
Min
Typ
-0.3
0.7 VVIO
Max
0.3 VVIO
VVIO+0.3
V
V
V
0.2
V
V
µA
0.12
VVIO
IOUTLO = 2mA
IOUTHI = -2mA
VVIO-0.2
-10
Unit
10
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
56
15.3 Thermal Characteristics
The following table shall give an idea on the thermal resistance of the QFN-48 package. The thermal
resistance for a four layer board will provide a good idea on a typical application. The single layer
board example is kind of a worst case condition, as the typical application will require a 4 layer
board. Actual thermal characteristics will depend on the PCB layout, PCB type and PCB size.
A thermal resistance of 23°C/W for a typical board means, that the package is capable of continuously
dissipating 4W at an ambient temperature of 25°C with the die temperature staying below 125°C.
Parameter
Symbol
Conditions
Typ
Unit
Thermal resistance junction to
ambient on a single layer board
RTJA
Single signal layer board (1s) as
defined in JEDEC EIA JESD51-3
(FR4, 76.2mm x 114.3mm, d=1.6mm)
80
K/W
Thermal resistance junction to
ambient on a multilayer board
RTMJA
Dual signal and two internal power
plane board (2s2p) as defined in
JEDEC EIA JESD51-5 and JESD51-7
(FR4, 76.2mm x 114.3mm, d=1.6mm)
23
K/W
Thermal resistance junction to
ambient on a multilayer board
with air flow
RTMJA1
Identical to RTMJA, but with air flow
1m/s
20
K/W
Thermal resistance junction to
board
RTJB
PCB temperature measured within
1mm distance to the package
10
K/W
Thermal resistance junction to
case
RTJC
Junction temperature to heat slug of
package
3
K/W
The thermal resistance in an actual layout can be tested by checking for the heat up caused by the
standby power consumption of the chip. When no motor is attached, all power seen on the power
supply is dissipated within the chip.
Note:
A spread-sheet for calculating TMC5031 power dissipation is available on www.trinamic.com.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
57
16 Layout Considerations
16.1 Exposed Die Pad
The TMC5031 uses its die attach pad to dissipate heat from the drivers and the linear regulator to the
board. For best electrical and thermal performance, use a reasonable amount of solid, thermally
conducting vias between the die attach pad and the ground plane. The printed circuit board should
have a solid ground plane spreading heat into the board and providing for a stable GND reference.
16.2 Wiring GND
All signals of the TMC5031 are referenced to their respective GND. Directly connect all GND pins under
the TMC5031 to a common ground area (GND, GNDP, GNDA and die attach pad). The GND plane right
below the die attach pad should be treated as a virtual star point. For practical reasons, this has to be
the PCB GND layer, not the PCB top layer.
Attention!
Especially, the sense resistors are susceptible to GND differences and GND ripple voltage, as the
microstep current steps make up for voltages down to 0.5 mV. No current other than the sense
resistor current should flow on their connections to GND and to the TMC5031. Optimally place them
close to the TMC5031, with one or more vias to the GND plane for each sense resistor. The two sense
resistors for one coil should not share a common ground connection trace or vias, as also PCB traces
have a certain resistance.
16.3 Supply Filtering
The 5VOUT output voltage ceramic filtering capacitor (4.7 µF recommended) should be placed as close
as possible to the 5VOUT pin, with its GND return going directly to the GNDA pin. Use as short and as
thick connections as possible. For best microstepping performance and lowest chopper noise an
additional filtering capacitor can be used for the VCC pin to GND, to avoid charge pump and digital
part ripple influencing motor current regulation. Therefore place a ceramic filtering capacitor (470nF
recommended) as close as possible (1-2mm distance) to the VCC pin with GND return going to the
ground plane. VCC can be coupled to 5VOUT using a 2.2 Ω or 3.3 Ω resistor in order to supply the
digital logic from 5VOUT while keeping ripple away from this pin.
A 100 nF filtering capacitor should be placed as close as possible to the VSA pin to ground plane. The
motor supply pins VS should be decoupled with an electrolytic capacitor (47 μF or larger is
recommended) and a ceramic capacitor, placed close to the device.
Take into account that the switching motor coil outputs have a high dV/dt. Thus capacitive stray into
high resistive signals can occur, if the motor traces are near other traces over longer distances.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
58
16.4 Layout Example
1- Top Layer (assembly side)
2- Inner Layer (GND)
3- Inner Layer (supply VS)
4- Bottom Layer
Components
Figure 16.1 Layout example
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
59
17 Package Mechanical Data
17.1 Dimensional Drawings
Attention: Drawings not to scale.
Figure 17.1 Dimensional drawings
Parameter
total thickness
stand off
mold thickness
lead frame thickness
lead width
body size X
body size Y
lead pitch
exposed die pad size X
exposed die pad size Y
lead length
package edge tolerance
mold flatness
coplanarity
lead offset
exposed pad offset
Ref
A
A1
A2
A3
b
D
E
e
J
K
L
aaa
bbb
ccc
ddd
eee
Min
0.80
0.00
0.2
5.2
5.2
0.35
Nom
0.85
0.035
0.65
0.203
0.25
7.0
7.0
0.5
5.3
5.3
0.4
Max
0.90
0.05
0.67
0.3
5.4
5.4
0.45
0.1
0.1
0.08
0.1
0.1
17.2 Package Codes
Type
TMC5031
www.trinamic.com
Package
QFN48 (RoHS)
Temperature range
-40°C ... +125°C
Code & marking
TMC5031-ES
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
60
18 Getting Started
Please refer to the TMC5031-EVAL evaluation board to allow a quick start with the device, and in order
to allow interactive tuning of the device setup in your application. It will guide you through the
process of correctly setting up all registers. The following example gives a minimum set of accesses
allowing moving a motor.
18.1 Initialization Examples
Initialization SPI datagram example sequence to enable and initialize driver 1 for operation:
SPI
SPI
SPI
SPI
SPI
SPI
send:
send:
send:
send:
send:
send:
0x8000000008;
0xEC00010445;
0xB000011F05;
0xA600001388;
0xA700004E20;
0xA000000001;
//
//
//
//
//
//
GCONF=8: Enable PP and INT outputs
CHOPCONF: TOFF=5, HSTRT=4, HEND=8, TBL=2, CHM=0 (spreadCycle)
IHOLD_IRUN: IHOLD=5, IRUN=31 (max. current), IHOLDDELAY=1
AMAX=5000
VMAX=20000
RAMPMODE=1 (positive velocity)
// Now motor 1 should start rotating
SPI send: 0x2100000000; // Query X Actual – The next read access delivers X Actual
SPI read;
// Read X Actual
The configuration parameters should be tuned to the motor and application for optimum
performance.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
61
19 Disclaimer
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.
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.
Specifications are subject to change without notice.
All trademarks used are property of their respective owners.
20 ESD Sensitive Device
The TMC5031 is an ESD sensitive CMOS device sensitive to electrostatic discharge. Take special care to
use adequate grounding of personnel and machines in manual handling. After soldering the devices
to the board, ESD requirements are more relaxed. Failure to do so can result in defect or decreased
reliability.
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
62
21 Table of Figures
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
1.1 Basic application and block diagram .......................................................................................................... 4
1.2 Energy efficiency with coolStep (example) ............................................................................................... 6
2.1 TMC5031 pin assignments. ............................................................................................................................. 7
3.1 Standard application circuit ......................................................................................................................... 10
3.2 External supply of VCC_IO ............................................................................................................................ 11
3.3 5V only operation ........................................................................................................................................... 12
3.4 Using an external 5V supply to reduce linear regulator power dissipation ................................. 13
3.5 Adding an RC-Filter on VCC for reduced ripple ..................................................................................... 13
4.1 SPI timing ......................................................................................................................................................... 16
7.1 Chopper phases .............................................................................................................................................. 32
7.2 spreadCycle chopper scheme showing coil current during a chopper cycle ............................... 35
7.3 Classic const. off time chopper with offset showing coil current................................................... 36
7.4 Zero crossing with classic chopper and correction using sine wave offset................................. 36
9.1 Ramp generator velocity trace showing consequent move in negative direction ..................... 41
9.2 Illustration of optimized motor torque usage with TMC5031 ramp generator ........................... 41
9.3 Ramp generator velocity dependent motor control ............................................................................ 42
9.4 Using reference switches (example) ......................................................................................................... 43
10.1 Function principle of stallGuard2 ............................................................................................................ 44
10.2 Example: Optimum SGT setting and stallGuard2 reading with an example motor ................. 45
11.1 coolStep adapts motor current to the load ......................................................................................... 48
12.1 LUT programming example ....................................................................................................................... 50
16.1 Layout example ............................................................................................................................................. 58
17.1 Dimensional drawings ................................................................................................................................ 59
www.trinamic.com
TMC5031 DATASHEET (Rev. 1.07 / 2013-APR-30)
63
22 Revision History
Version
Date
Author
Description
BD – Bernhard Dwersteg
SD – Sonja Dwersteg
1.04
2012_NOV-18
BD / SD
1.05
1.06
2013_FEB-22
2013-MAR-25
JP
SD
1.07
2013-APR-30
SD
First version of product TMC5031 datasheet based on TMC562
prototype datasheet V1.04
Product Image changed
- Chapter 15.3 (thermal characteristics) added.
- Chapter 10.1 (tuning the stallGuard2 threshold) updated.
- CSACTUAL in DRV_STATUS corrected (chapter 5.3.4).
- Interrupt output remark in RAMP_STAT for status_latch_l
and status_latch_r removed. Description event_stop_l and
event_stop_r updated (chapter 6.2.2.2)
- Description of the reference switch actions improved.
- SW_MODE register updated.
- Order codes updated.
- Consecutive numbering of the document corrected.
New description of VCC_IO requirements.
Table 22.1 Documentation revisions
23 References
[AN001] Trinamic Application Note 001 - Parameterization of spreadCycle™, www.trinamic.com
[AN002] Trinamic Application Note 002 - Parameterization of stallGuard2™ & coolStep™,
www.trinamic.com
www.trinamic.com