background image

TMCM-142 TMCL

TM

 Firmware Manual (V1.06 / 2014-JUN-24) 

80 

 

 
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG 

 

Number  Axis parameter 

Description 

14 

Switch mode 

Bit 2: left stop switch polarity 
Bit 3: right stop switch polarity 
Bit  4:  swap  left  and  right  stop 
switch 
Bit 5: enable soft stop 
Bit  8:  latch  position  on  left  stop 
switch going active 
Bit  9:  latch  position  on  left  stop 
switch going inactive 
Bit  10:  latch  position  on  right  stop 
switch going active 
Bit  11:  latch  position  on  right  stop 
switch going inactive 
Bit  12:  latch  encoder  position  on 
stop switch event 

15 

Stop deceleration 

Deceleration  when  touching  a  stop 
switch. 

16 

Max. acceleration 

Acceleration 

17 

Max. deceleration 

Deceleration 

18 

Bow 

trapezoidal ramps, 
corresponds to an infinite 
bow value 

1…18  S-shaped ramps in 

logarithmic 
representation. 

bow_value = 2^(

bow_index-1)

 

bow_index

 = 1, 2, 3… 18 

  

bow_value = 1, 2, 4… 262144 

The resulting bow_value 
must not exceed A_MAX or 
D_MAX setting. Otherwise 
oscillations may result. 

 

19 

Shaft 

Reverses  the  motor  direction  when 
set to 1. 

20 

Standby delay 

Time  after  the  motor  has  stopped 
until  the  current  is  changed  to 
standby  current  (in  units  of 
4.069ms). 

21 

Mixed decay run 

0: no mixed decay when running 
1: use mixed decay when running 

22 

Mixed decay standby 

0: no mixed decay when standing 
1: use mixed decay when standing 

23 

Chopper clock divider 

Chopper clock frequency divider. Do 
not change!  
Chopper clock = 16MHz/value 
Default = 444 

Summary of Contents for TMCL TMCM-142

Page 1: ...TMCM 142 TMCLTM Firmware Manual Version 1 06 2014 JUN 24 Trinamic Motion Control GmbH Co KG Waterloohain 5 D 22769 Hamburg Germany http www trinamic com...

Page 2: ...figuring the ASCII interface 22 6 7 Commands 24 6 7 1 ROR rotate right 24 6 7 2 ROL rotate left 25 6 7 3 MST motor stop 26 6 7 4 MVP move to position 27 6 7 5 SAP set axis parameter 29 6 7 6 GAP get a...

Page 3: ...tion reached event 89 6 7 34 BIN return to binary mode 90 6 7 35 TMCL Control Functions 91 7 Axis parameters 93 7 1 Real world units vs units of the TMC457 98 8 Global parameters 99 8 1 Bank 0 99 8 2...

Page 4: ...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...

Page 5: ...ility with encoder feedback and PID position regulator Electrical data Supply voltage 18V 78 5V DC Motor current up to 7A peak 5A RMS programmable Supported motors Two phase bipolar motors with 1A to...

Page 6: ...TMCM 142 IF Single axis stepper motor controller driver 5A RMS 75V with encoder feedback and the standard adapter interface board TMCM IF 76x70x33 Related motors QSH 5718 57mm NEMA23 1 8 step angle 5...

Page 7: ...ut the whole lifetime the firmware can be updated by the user New versions can be downloaded free of charge from the TRINAMIC website http www trinamic com The firmware shipped with this module is rel...

Page 8: ...face add on board Interface RS232 RS485 USB or CAN suitable to your TMCM 142 IF with cables Nominal supply voltage 24V DC 18 78 5V DC for your module A stepper motor which fit to your module for examp...

Page 9: ...SB Connector 1 Terminal1 USB Connector 3 Connector 2 Connector 4 D SUB Connector 1 Adapter Side View Figure 5 1 Connectors of the TMCM 142 and the TMCM IF 2 Connect the motor and the power supply Conn...

Page 10: ...the pinning of other interfaces Connect the USB interface Choose the USB port of the TMCM IF and connect the interface with a USB cable Accordingly adjust the DIP switches ON ON ON Switch 101 Switch...

Page 11: ...tal user controlled input 7 Optically isolated active low needs power supply on pin 15 12 ENC_A Differential encoder Channel A input optional 13 IN2_A D Analog user controlled input 2 No internal resi...

Page 12: ...ON The LED for power should glow now This indicates that the on board 5V supply is available If this does not occur switch power OFF and check your connections as well as the power supply 6 Start the...

Page 13: ...he program to the TMCM 142 module via the icon Download 9 Press icon Run The desired program will be executed 10 Click Stop button to stop the program A simple example for using TMCL and TMCL IDE ROL...

Page 14: ...If the module is not detected please check all points above cables interface power supply COM port baud rate 3 Issue a command by choosing instruction type if necessary motor and value and click Exec...

Page 15: ...control commands but also commands to control the program structure like conditional jumps compare and calculating Every command has a binary representation and a mnemonic The binary format is used t...

Page 16: ...hecksum byte Command array 0 8 of byte Set the Command array to the desired command Calculate the Checksum Checksum Command 0 for i 1 to 7 do Checksum Checksum Command i Command 8 Checksum Now send th...

Page 17: ...can load them down into the EEPROM and then it will run on the module The TMCL IDE contains an editor and a TMCLTM assembler where the commands can be entered using their mnemonic format They will be...

Page 18: ...l parameter GGP 10 Get global parameter STGP 11 Store global parameter into EEPROM RSGP 12 Restore global parameter from EEPROM 6 4 3 I O port commands These commands control the external I O ports an...

Page 19: ...parameter ACO 39 Copy accu to coordinate For calculating purposes there is an accumulator or accu or A register and an X register When executed in a TMCLTM program in stand alone mode all TMCLTM comma...

Page 20: ...mber value Set global parameter module specific settings e g communication settings or TMCL user variables GGP 10 parameter bank number Get global parameter read out module specific settings e g commu...

Page 21: ...tarting address of the application 133 quit download mode target command execution is resumed don t care don t care don t care 134 read TMCL memory the specified program memory location is read don t...

Page 22: ...module sends back a reply in ASCII format This reply consists of the address character of the host host address that can be set in the module the address character of the module the status code as a d...

Page 23: ...ess the backspace key in a terminal program When bit 4 is set and bit 5 is clear the characters that are entered are not echoed back immediately but the entire line will be echoed back after the CR ch...

Page 24: ...d the TMC239 power driver This makes possible choosing a velocity between 0 and 2147483647 When axis parameter 255 unit conversion mode is set to 1 the speed must be given as microsteps per second In...

Page 25: ...between 0 and 2147483647 When axis parameter 255 unit conversion mode is set to 1 the speed must be given as microsteps per second In this case the range for the speed is 0 31999999 microsteps second...

Page 26: ...nction The axis parameter target velocity is set to zero Related commands ROL ROR SAP GAP Mnemonic MST 0 Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 3 don t care 0 don t care motor number...

Page 27: ...tioned limits too Moving the motor to a previously stored coordinate refer to SCO for details Internal function A new position value is transferred to the axis parameter 2 target position Related comm...

Page 28: ...inate 8 Mnemonic MVP COORD 0 8 Binary Byte Index 0 1 2 3 4 5 6 7 8 Function Target address Instruction Number Type Motor Bank Operand Byte3 Operand Byte2 Operand Byte1 Operand Byte0 Checksum Value hex...

Page 29: ...E 100 OK don t care Axis parameters which can be used for SAP Please note that for the binary representation parameter number has to be filled with the number and the value has to be filled with a val...

Page 30: ...acceleration Acceleration 1 16777215 steps t2 17 Max deceleration Deceleration 1 16777215 steps t2 18 Bow 0 trapezoidal ramps corresponds to an infinite bow value 1 18 S shaped ramps in logarithmic r...

Page 31: ...nts A too low offset leads to the motor turning too slow during zero transition a too high offset leads to a larger step This parameter can be optimized for the motor type It mainly depends on motor i...

Page 32: ...n null channel is active Bit 4 continuous clear while null channel is active Bit 5 clear once at next null channel event Bit 6 null channel is positive edge triggered Bit 7 null channel is negative ed...

Page 33: ...Reference switch speed Specifies the speed for the exact reference switch calibration 0 2147483647 212 Maximum encoder deviation When the actual position param 1 and the encoder position param 41 dif...

Page 34: ...n t care motor number is always O as only one motor is involved Reply in direct mode STATUS VALUE 100 OK don t care Axis parameters which can be used for GAP Please note that for the binary representa...

Page 35: ...ht stop switch polarity Bit 4 swap left and right stop switch Bit 5 enable soft stop Bit 8 latch position on left stop switch going active Bit 9 latch position on left stop switch going inactive Bit 1...

Page 36: ...cro steps 8 8 micro steps 9 4 micro steps 10 2 micro steps 11 1 full step 0 11 28 PID tolerance Tolerance for PID regulation If the absolute value of the error pid_e is below pid_tolerance after an ex...

Page 37: ...lkdiv 128 attention pid_d_clkdiv 0 results in 256 0 255 37 PID dv clipping Clipping parameter for PID calculation result pid_v_actual pid_v_actual v_actual clip PID_result pid_dv_clip 0 2147483647 ste...

Page 38: ...leared after reading 0 1 45 Encoder latch Encoder position latched on N channel event steps 46 Position latch Motor position latched on stop switch event 47 Encoder warn distance Maximum deviation bet...

Page 39: ...the speed for the exact reference switch calibration 0 2147483647 196 End switch distance Provides the distance between the two end switches after executing a reference search in mode 2 or 3 0 214748...

Page 40: ...N 24 40 Copyright 2009 TRINAMIC Motion Control GmbH Co KG Function Host address Target address Status Instruction Operand Byte3 Operand Byte2 Operand Byte1 Operand Byte0 Checksum Value hex 02 01 64 06...

Page 41: ...irect mode STATUS VALUE 100 OK don t care Parameter ranges Parameter number Motor number Value s chapter 7 0 s chapter 7 Axis parameters which can be used for STAP Please note that for the binary repr...

Page 42: ...a stop switch 16 Max acceleration Acceleration 17 Max deceleration Deceleration 18 Bow 0 trapezoidal ramps corresponds to an infinite bow value 1 18 S shaped ramps in logarithmic representation bow_va...

Page 43: ...ossing of the coil currents A too low offset leads to the motor turning too slow during zero transition a too high offset leads to a larger step This parameter can be optimized for the motor type It m...

Page 44: ...active Bit 5 clear once at next null channel event Bit 6 null channel is positive edge triggered Bit 7 null channel is negative edge triggered Bit 8 clear encoder position on null event otherwise it i...

Page 45: ...ion 212 Maximum encoder deviation When the actual position param 1 and the encoder position param 41 differ more than the value set here the motor will be stopped Setting this parameter to 0 disables...

Page 46: ...ucture in direct mode STATUS VALUE 100 OK don t care Axis parameters which can be used for RSAP Please note that for the binary representation parameter number has to be filled with the number and the...

Page 47: ...a stop switch 16 Max acceleration Acceleration 17 Max deceleration Deceleration 18 Bow 0 trapezoidal ramps corresponds to an infinite bow value 1 18 S shaped ramps in logarithmic representation bow_va...

Page 48: ...ossing of the coil currents A too low offset leads to the motor turning too slow during zero transition a too high offset leads to a larger step This parameter can be optimized for the motor type It m...

Page 49: ...active Bit 5 clear once at next null channel event Bit 6 null channel is positive edge triggered Bit 7 null channel is negative edge triggered Bit 8 clear encoder position on null event otherwise it i...

Page 50: ...ence search speed 195 Reference switch speed Specifies the speed for the exact reference switch calibration 212 Maximum encoder deviation When the actual position param 1 and the encoder position para...

Page 51: ...appropriate on board device Related commands GGP STGP RSGP AGP Mnemonic SGP parameter number bank number value Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 9 parameter number bank number...

Page 52: ...t the functionality of the SHUTDOWN pin 0 no function 1 high active 2 low active 0 2 81 TMCLTM code protection Protect a TMCLTM program against disassembling or overwriting 0 no protection 1 protectio...

Page 53: ...ications 231 231 9 general purpose variable 9 for use in TMCL applications 231 231 10 general purpose variable 10 for use in TMCL applications 231 231 11 general purpose variable 11 for use in TMCL ap...

Page 54: ...TYPE MOT BANK VALUE 10 see chapter 7 bank number see chapter 7 don t care Reply in direct mode STATUS VALUE 100 OK don t care Global parameters of bank 0 which can be used for GGP Number Global parame...

Page 55: ...after power up 0 1 80 shutdown pin functionality Select the functionality of the SHUTDOWN pin 0 no function 1 high active 2 low active 0 2 81 TMCLTM code protection Protect a TMCLTM program against d...

Page 56: ...e in TMCL applications 231 231 8 general purpose variable 8 for use in TMCL applications 231 231 9 general purpose variable 9 for use in TMCL applications 231 231 10 general purpose variable 10 for us...

Page 57: ...ustomer specific extensions of the firmware Together with user definable commands these variables form the interface between extensions of the firmware written in C and TMCLTM applications Please cont...

Page 58: ...lications 20 55 general purpose variables 20 55 for use in TMCL applications Please refer to chapter 8 for more information about bank 0 to 2 Example Store the serial address of the target device Mnem...

Page 59: ...ed for customer specific extensions of the firmware Together with user definable commands these variables form the interface between extensions of the firmware written in C and TMCLTM applications Ple...

Page 60: ...1 231 17 general purpose variable 17 for use in TMCL applications 231 231 18 general purpose variable 18 for use in TMCL applications 231 231 19 general purpose variable 19 for use in TMCL application...

Page 61: ...actual status of the reference search can be checked Internal function The reference search is implemented as a state machine so interaction is possible during execution Related commands WAIT Mnemoni...

Page 62: ...14 port number bank number value Reply structure STATUS VALUE 100 OK don t care Example Set OUT_7 to high bank 2 output 7 general purpose output Mnemonic SIO 7 2 1 Binary Byte Index 0 1 2 3 4 5 6 7 8...

Page 63: ...ue parameter must then be set to a value between 0 255 where every bit represents one output line Furthermore the value can also be set to 1 In this special case the contents of the lower 8 bits of th...

Page 64: ...s of a digital output line can also be read Internal function The specified line is read Related commands SIO WAIT Mnemonic GIO port number bank number Binary representation INSTRUCTION NO TYPE MOT BA...

Page 65: ...SIO 255 2 1 JA Loop 6 7 15 2 I O bank 1 analogue inputs The ADIN lines can be read as digital or analogue inputs at the same time The analogue values can be accessed in bank 1 6 7 15 3 I O bank 2 stat...

Page 66: ...X COMP JC AAP AGP GAP GGP GIO Mnemonic CALC op value where op is ADD SUB MUL DIV MOD AND OR XOR NOT or LOAD Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 19 0 ADD add to accu 1 SUB subtract...

Page 67: ...ding get or calculate instruction see GAP GGP GIO CALC CALCX The internal arithmetic status flags are set according to the comparison result Related commands JC jump conditional GAP GGP GIO CALC CALCX...

Page 68: ...re in the appropriate state s Related commands JA COMP WAIT CLE Mnemonic JC condition label where condition ZE NZ EQ NE GT GE LT LE ETO EAL EDV EPO Binary representation INSTRUCTION NO TYPE MOT BANK V...

Page 69: ...al function the TMCLTM program counter is set to the passed value Related commands JC WAIT CSUB Mnemonic JA Label Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 22 don t care don t care jump...

Page 70: ...ck is limited to 8 This also limits nesting of subroutine calls to 8 The command will be ignored if there is no more stack space left Related commands RSUB JA Mnemonic CSUB Label Binary representation...

Page 71: ...ry This command cannot be used in direct mode Internal function The TMCL program counter is set to the last value of the stack The command will be ignored if the stack is empty Related command CSUB Mn...

Page 72: ...ticks parameter RFS Wait until the reference search of the motor specified by the motor field has been reached An optional timeout value 0 for no timeout must be specified by the ticks parameter The t...

Page 73: ...should be placed at the end of every stand alone TMCLTM program It is not to be used in direct mode Internal function TMCLTM instruction fetching is stopped Related commands none Mnemonic STOP Binary...

Page 74: ...on The passed value is stored in the internal position array Related commands GCO CCO MVP Mnemonic SCO coordinate number 0 position Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 30 coordina...

Page 75: ...ray copied to the accumulator register and in direct mode returned in the value field of the reply Related commands SCO CCO MVP Mnemonic GCO coordinate number 0 Binary representation INSTRUCTION NO TY...

Page 76: ...o the 20 by 3 bytes wide coordinate array Related commands SCO GCO MVP Mnemonic CCO coordinate number 0 Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 32 coordinate number 0 20 0 don t care...

Page 77: ...number 0 is always stored in RAM only For Information about storing coordinates refer to the SCO command Internal function The actual value of the accumulator is stored in the internal position array...

Page 78: ...OT LOAD SWAP Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 33 0 ADD add X register to accu 1 SUB subtract X register from accu 2 MUL multiply accu by X register 3 DIV divide accu by X regis...

Page 79: ...in direct mode STATUS VALUE 100 OK don t care List of basic parameters which can be used for AAP Please note that for the binary representation parameter number has to be filled with the number and t...

Page 80: ...a stop switch 16 Max acceleration Acceleration 17 Max deceleration Deceleration 18 Bow 0 trapezoidal ramps corresponds to an infinite bow value 1 18 S shaped ramps in logarithmic representation bow_va...

Page 81: ...ossing of the coil currents A too low offset leads to the motor turning too slow during zero transition a too high offset leads to a larger step This parameter can be optimized for the motor type It m...

Page 82: ...active Bit 5 clear once at next null channel event Bit 6 null channel is positive edge triggered Bit 7 null channel is negative edge triggered Bit 8 clear encoder position on null event otherwise it i...

Page 83: ...bration 212 Maximum encoder deviation When the actual position param 1 and the encoder position param 41 differ more than the value set here the motor will be stopped Setting this parameter to 0 disab...

Page 84: ...parameters of bank 0 which can be used for AGP Number Global parameter Description Range 64 EEPROM magic Setting this parameter to a different value as E4 will cause re initialization of the axis and...

Page 85: ...active 2 low active 0 2 81 TMCLTM code protection Protect a TMCLTM program against disassembling or overwriting 0 no protection 1 protection against disassembling 2 protection against overwriting 3 pr...

Page 86: ...applications 231 231 9 general purpose variable 9 for use in TMCL applications 231 231 10 general purpose variable 10 for use in TMCL applications 231 231 11 general purpose variable 11 for use in TM...

Page 87: ...EAL clear the external alarm flag EDV clear the deviation flag EPO clear the position error flag Related commands JC Mnemonic CLE flags where flags ALL ETO EDV EPO Binary representation INSTRUCTION NO...

Page 88: ...programming of these functions Internal function Call user specific functions implemented in C by TRINAMIC Related commands none Mnemonic UF0 UF7 Binary representation INSTRUCTION NO TYPE MOT BANK VAL...

Page 89: ...n Mnemonic Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 138 don t care don t care 0 1 Motor number Reply in direct mode right after execution of this command Byte Index 0 1 2 3 4 5 6 7 8 F...

Page 90: ...rol GmbH Co KG 6 7 34 BIN return to binary mode This command can only be used in ASCII mode It quits the ASCII mode and returns to binary mode Related Commands none Mnemonic BIN Binary representation...

Page 91: ...is started or continued 0 run from current address 1 run from specified address don t care don t care starting address 130 step application only the next command of a TMCLTM application is executed do...

Page 92: ...ing the CAN bus interface just send this command in an eight byte frame instead of a seven byte frame Then eight bytes will be sent back so you will get all characters of the version string Type set t...

Page 93: ...to the same value 1 16777215 steps t2 RWE 6 Max current Current when motor is running 0 means 0 15 means 100 of the maximum possible current 0 15 RWE 7 Standby current Current when motor is standing...

Page 94: ...on 1 16777215 steps t2 RWE 18 Bow 0 trapezoidal ramps corresponds to an infinite bow value 1 18 S shaped ramps in logarithmic representation bow_value 2 bow_index 1 bow_index 1 2 3 18 bow_value 1 2 4...

Page 95: ...zero crossing of the coil currents A too low offset leads to the motor turning too slow during zero transition a too high offset leads to a larger step This parameter can be optimized for the motor t...

Page 96: ...ery pulse this constant is added to or subtracted from the encoder position register This constant is given in units of 1 65536 when bit 13 in param 43 is not set or in 1 10000 when bit 13 in param 43...

Page 97: ...e step direction output 0 255 1 16 MHz RWE 128 Ramp mode Normally set automatically by the ROL ROR MVP and MST commands 0 positioning mode 1 reserved 2 velocity mode 3 hold mode 0 3 RW 129 Status flag...

Page 98: ...file www trinamic com for getting best values 7 1 Real world units vs units of the TMC457 Parameter vs units Parameter symbol Unit Calculation description comment fCLK Hz Hz clock frequency of the TM...

Page 99: ...ters and use the appropriate functions of the TMCL IDE to do it in an interactive way Meaning of the letters in column Access R readable GGP W writeable SGP E automatically restored from EEPROM after...

Page 100: ...after power up 0 1 RWE 80 shutdown pin functionality Select the functionality of the SHUTDOWN pin 0 no function 1 high active 2 low active 0 2 RWE 81 TMCLTM code protection Protect a TMCLTM program a...

Page 101: ...Co KG 8 2 Bank 1 The global parameter bank 1 is normally not available It may be used for customer specific extensions of the firmware Together with user definable commands see section 7 3 these vari...

Page 102: ...use in TMCL applications 231 231 RWE 6 general purpose variable 6 for use in TMCL applications 231 231 RWE 7 general purpose variable 7 for use in TMCL applications 231 231 RWE 8 general purpose varia...

Page 103: ...by the PID controller of the TMC457 Due to constraints of practical real word application the integer part of the PID regulator can be clipped to a limit named pid_iclip Without this the integral par...

Page 104: ...the searching speed is identical to the maximum positioning speed axis parameter 4 unless reduced by axis parameter 194 After hitting the reference switch the motor slowly moves right until the switc...

Page 105: ...of the motor There are two ways two solve this problem 1 Using an offset on the microstep sine wave Such an offset can be set using axis parameter 29 This will put an offset on the sine wave so that z...

Page 106: ...ows 2000 Windows XP or Windows NT4 not with Windows 95 Windows 98 or Windows ME due to a bug in these operating systems Another problem is that Windows 2000 XP NT4 switches the direction back to recei...

Page 107: ...s 4 45 2014 JUN 24 OK New USB Stack 10 2Document Revision Version Date Author Description 1 00 2009 FEB 28 SD Initial version 1 01 2009 JUL 10 SD Information about easyPID added minor changes 1 02 200...

Page 108: ...yright 2009 TRINAMIC Motion Control GmbH Co KG 11 References TMCLTM TMCLTM reference and programming manual see http www trinamic com TMCM 142 IF TMCM 142 IF hardware manual see http www trinamic com...

Reviews: