Advertisement

TMC428 – Application Note – TMC428 Getting Started – Including StallGuard
(v. 2.00 / April 14, 2008)
TMC428 – Application Note
TMC428 Getting Started – Including StallGuard

1. Introduction

The TMC428 datasheet gives a detailed description of all its registers and its functionality. In addition
to the TMC428 datasheet, this application note describes the basic steps how to initialize the TMC428
and how to run a motor. It gives two practical examples written in C language – 'tmc428demo' and
'Sample428_236'. The complete sources are available as archives named 'tmc428demo.zip' and
'sample428_236.zip' for download from www.trinamic.com. The C examples can be used as a
base for own applications. The code and information is provided "as is" without warranty of any kind,
either expressed or implied.
The TMC428 datasheet is recommended as a base for this application note. The sample C code
included within 'tmc428demo.zip' is a win32 console application that communicates with a
TMC428 evaluation board via RS232. TMC428 evaluation boards are offered by TRINAMIC
distributors. The compact example 'Sample428_236.zip' is intended to outline how to realize an
application for running on a stand-alone micro controller. Routines for communication with the TMC428
TM
via SPI
are specific for each type of micro controller and have to be added.
This application note has been updated concerning the use of datagram_low_word and
datagram_high_word that build the interface registers to read out diagnosis and status information
from the stepper motor driver chain. This mechanism is also need to read the StallGuard information –
names load indicator bits - from TRINAMIC stepper motor drivers TMC246 and TMC249. In addition,
the implementation of StallGuard profilers is described as now implemented as exemplary C code
within the 'tmc428demo.zip'
In contrast to low level C programming, TRINAMIC credit card size modules come with TMCL
(TRINAMIC Motion control Language) together with an IDE (Integrated Development Environment
running under Windows). TMCL allows rapid prototyping and building user applications without the
need of low level C programming. Please refer to the TMCL user manual resp. the user manuals of the
different modules for details.
SPI is Trademark of Motorola, Inc.
StallGuard and TMCL are trademarks of TRINAMIC Motion Control GmbH & Co. KG
Windows is a registered trademark of Microsoft Corporation
Copyright © 2005-2008 TRINAMIC Motion Control GmbH & Co. KG
TM
TM
®
TRINAMIC
Motion Control GmbH & Co. KG
1
Sternstraße 67
D – 20357 Hamburg
GERMANY
www.trinamic.com
TM

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the TMC428 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Trinamic TMC428

  • Page 1: Introduction

    1. Introduction The TMC428 datasheet gives a detailed description of all its registers and its functionality. In addition to the TMC428 datasheet, this application note describes the basic steps how to initialize the TMC428 and how to run a motor. It gives two practical examples written in C language – 'tmc428demo' and 'Sample428_236'.
  • Page 2: Table Of Contents

    TMC428 – Application Note – TMC428 Getting Started – Including StallGuard (v. 2.00 / April 14, 2008) Table of Contents Introduction ............................1 Initialization of the TMC428 ......................3 TMC428 Configuration RAM ..................... 3 Stepper Motor Global Parameter Register (JDX=%1111) ............5 Parameterizing Individual Stepper Motors ................
  • Page 3: Initialization Of The Tmc428

    (POR). Almost any register of the TMC428 is set to zero by the POR. The RAM of the TMC428 is not initialized by the power on reset, and so the RAM has a more or less random content after power on.
  • Page 4: Figure 1 : Spi Chain Outline – Serial Transmitted Control Bits Vs. Parallel Control Signals

    In some cases, the fast decay control has to be changed. Please take into account that a write access to a RAM always overwrites a pair of TMC428 RAM values. A read access to the RAM always reads out a pair of values. Combining RAM read and RAM write allows the modification of a single value.
  • Page 5: Stepper Motor Global Parameter Register (Jdx=%1111)

    (DAC_AB, FD_AB, PH_AB) and the polarities of SPI control signals (SCK_S, nSCS_S) , and the number (LSMD) of stepper motor drivers within the chain. Please refer to the TMC428 data sheet concerning functionalities of the flags. Figure 2 outlines an SPI datagram 0x7E010F02 to initialize the stepper motor global parameter register with LSMD=2 for 3 stepper motor drivers.
  • Page 6: Parameterizing Individual Stepper Motors

    The full step frequency can be calculated based on the formula R [Hz] = R[Hz] / 2^usrs given within the TMC428 data sheet. With this, the micro step frequency is R[Hz] = R [Hz] * 2^usrs. The quotient of logarithms comes from the relation log (x) = log(x) / log(2) to calculate the logarithm to the basis of two which is the number of bits need to represent x.
  • Page 7: Figure 3 : Ref_Conf & Ramp_Mode Setting For Stepper Motor # 0 (Smda = %00)

    Choosing Step Velocities v_min and v_max and the Step Acceleration a_max The v_min parameter should be set to 1 (please refer the TMC428 data sheet for details). The v_max parameter determines the maximum velocity and has to be set depending on the application. Once set, the a_max parameter can be left untouched for many applications.
  • Page 8: Set The Reference Switch Configuration And The Ramp Mode

    For automatic current scaling, it is necessary to switch on the continuous_update, to force the TMC428 to send the current scaling datagram, even if all motors are at rest. That does not cause the TMC428 to sent datagrams to the stepper motor driver chain.
  • Page 9: Communication Outline Of Tmc428Demo And Sample428_236

    For an embedded application running stand alone on a µC, the user just has to write an SPI routine for the µC used for communication between µC an TMC428. For the code example Sample428_236, the SPI routine spi428_uc() for communication with the TMC428 is named Send428(). This has to be completed for a given type of micro controller.
  • Page 10: Reading Driver Chain Status Bits With Tmc428

    – and the datagram high word and datagram low word both use this single status bit named CDGW. The CDGR status bit is part of each SPI datagram sent from TMC428 to µC. To get the driver chain status bits, the following actions have to be done: 1.
  • Page 11: How To Get The Driver Chain Status Information - Code Example

    TMC428 – Application Note – TMC428 Getting Started – Including StallGuard (v. 2.00 / April 14, 2008) 3.1 How to Get the Driver Chain Status Information – Code Example The following C code example (part of tmc428demo.zip) outlines how to get the raw status bits from a...
  • Page 12: How To Get The Status Bits Of Tmc246 / Tmc249 - Code Example

    // 1st, determine the number of TMC246 resp. TMC249 stepper motor drivers tmc428_get_lsmd( &lsmd ); switch (((char)lsmd)) case 3 : ; // TMC428 interprets LSMD=3 as LSMD = 2 // NO "break;" case 2 : *sm0_status = 0x0fff & ( datagram_high_word >> 0 ); // motor #1 *sm1_status = 0x0fff &...
  • Page 13: Stallguard Profiler

    TMC428 – Application Note – TMC428 Getting Started – Including StallGuard (v. 2.00 / April 14, 2008) 4. StallGuard Profiler StallGuard is primarily intended for noiseless reference search with a mechanical reference position. How well StallGuard works primarily depends on three constrains from the stepper motor and its application: efficiency of a stepper motor in terms of mechanical power vs.
  • Page 14: Stallguard Profiler - Source Code Example

    TMC428 – Application Note – TMC428 Getting Started – Including StallGuard (v. 2.00 / April 14, 2008) 4.2 StallGuard Profiler – Source Code Example A source code example of a StallGuard profiler (routine tmc428_stallguard_profiler(…)) is are part of the tmc428demo.zip (pls. refer „tmc428_misc.c). This StallGuard Profiler performs both, StallGuard profiling for continuous motion (VELOCITY_MODE) and StallGuard profiling for motion within limited range of motion.
  • Page 15: Stallguard - General Constrains

    TMC428 – Application Note – TMC428 Getting Started – Including StallGuard (v. 2.00 / April 14, 2008) best velocity ranges for proper operation Figure 8 : Outline of a typical StallGuard Profile 4.5 StallGuard – General Constrains Velocity Ranges for Proper Operation of StallGuard For StallGuard, on should run the stepper motor within the velocity ranges that are best for proper operation of StallGuard.
  • Page 16: How To Compare Different Motors Concerning Stallguard Qualification

    TMC428 – Application Note – TMC428 Getting Started – Including StallGuard (v. 2.00 / April 14, 2008) 4.6 How to Compare Different Motors Concerning StallGuard Qualification One could directly compare stepper motors concerning the qualification for StallGuard based on the efficiency.
  • Page 17: Overview Of 'Tmc428Demo

    (v. 2.00 / April 14, 2008) 5. Overview of 'tmc428demo' These routines all together build a simple example application to control the TMC428. One can directly run it together with an TMC428 evaluation kit. Evaluation kits are available via TRINAMIC distributors.
  • Page 18: Literature & Links

    2.00 April 14 , 2008 (LL) section added, how to read out the status bits from a TRINAMIC driver chain via datagram_low_word and datagram_high_word, as need to process StallGuard load indicator bits from TMC246 / TMC249; section added, how to process the StallGuard status bits –...
  • Page 19 TMC428 – Application Note – TMC428 Getting Started – Including StallGuard (v. 2.00 / April 14, 2008) © 2005-2008 TRINAMIC Motion Control GmbH & Co. KG Information given in this application note is believed to be accurate and reliable. However no responsibility is...

Table of Contents