Datasheet
TMC5062 DATASHEET (Rev. 1.11 / 2017-MAY-16) 80
www.trinamic.com
17 Getting Started
Please refer to the TMC5062 evaluation board to allow a quick start with the device, and in order to
allow interactive tuning of the device setup in your application. Chapter 16 will guide you through the
process of correctly setting up all registers.
17.1 Initialization Examples
Initialization SPI datagram example sequence to enable and initialize driver 1 and ramp generator 1
to move the motor in velocity mode and read access the position register:
SPI send: 0x8000000008; // GCONF=8: Enable PP and INT outputs
SPI send: 0xEC000100C5; // CHOPCONF: TOFF=5, HSTRT=4, HEND=1, TBL=2, CHM=0 (spreadCycle)
SPI send: 0xB000011F05; // IHOLD_IRUN: IHOLD=5, IRUN=31 (max. current), IHOLDDELAY=1
SPI send: 0xA600001388; // AMAX=5000
SPI send: 0xA700004E20; // VMAX=20000
SPI send: 0xA000000001; // 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
Initialization SPI datagram example sequence to enable and initialize the motion controller and then
move one rotation (51200 microsteps) using the ramp generator.
SPI send: 0xA4000003E8; // A1 = 1 000 First acceleration
SPI send: 0xA50000C350; // V1 = 50 000 Acceleration threshold velocity V1
SPI send: 0xA6000001F4; // AMAX = 500 Acceleration above V1
SPI send: 0xA7000304D0; // VMAX = 200 000
SPI send: 0xA8000002BC; // DMAX = 700 Deceleration above V1
SPI send: 0xAA00000578; // D1 = 1400 Deceleration below V1
SPI send: 0xAB0000000A; // VSTOP = 10 Stop velocity (Near to zero)
SPI send: 0xA000000000; // RAMPMODE = 0 (Target position move)
// Ready to move!
SPI send: 0xADFFFF3800; // XTARGET = -51200 (Move one rotation left (200*256 microsteps))
For UART based operation it is important to make sure that the CRC byte is correct. The following
example shows initialization for a TMC5062. It programs driver 1 and ramp generator 1 to move the
motor in velocity mode and read accesses the position and actual velocity registers:
UART write: 0x05 0xEC 0x00 0x71 0x03 0x06 0x45; // TOFF=6, HEND=6, SYNC=7, HSTR=0,
// TBL=2, MRES=0, CHM=0
UART write: 0x05 0xB0 0x00 0x01 0x14 0x05 0x47; // IHOLD=5, IRUN=20, IHOLDDELAY=1
UART write: 0x05 0xA6 0x00 0x00 0x13 0x88 0xA4; // AMAX=5000
UART write: 0x05 0xA7 0x00 0x00 0x4E 0x20 0x95; // VMAX=20000
UART write: 0x05 0xA0 0x00 0x00 0x00 0x01 0xB3; // RAMPMODE=1 (positive velocity)
// Now motor 1 should start rotating
UART write: 0x05 0x21 0x8D; // Query XACTUAL
UART read 7 bytes;
UART write: 0x05 0x22 0xC3; // Query VACTUAL
UART read 7 bytes;
Hint
Tune the configuration parameters for your motor and application for optimum performance.