background image

TMCM-1310 TMCL Firmware V1.11 Manual (Rev. 1.16 / 2014-MAR-19) 

29 

 

 
www.trinamic.com 

6.8.7

 

STAP (store axis parameter) 

An axis parameter previously set with a 

Set Axis Parameter

 command (SAP) will be stored permanent. Most 

parameters are automatically restored after power up. 
 

Internal function:

 an axis parameter value stored in SRAM will be transferred to EEPROM and loaded from 

EEPORM after next power up. 
 

Related commands:

 SAP, RSAP, GAP, AAP 

 

Mnemonic:

 STAP <parameter number>, 0

  

Binary representation: 

INSTRUCTION NO. 

TYPE 

MOT/BANK 

VALUE 

<parameter number> 

<motor> 

0* 

don’t care*

1

 

* Motor number is always O as only one motor is involved

 

*

The value operand of this function has no effect. Instead, the currently used value (e.g. selected by SAP) is saved 

 
Reply in direct mode:

 

STATUS 

VALUE 

100 – OK 

don’t care 

 
For a  table  with parameters and  values  which can be used together  with this command  please refer to 
chapter 7. 
The STAP command will not have any effect when the configuration EEPROM is locked  (refer to 11.1). In 
direct mode, the error code 5 (configuration EEPROM locked, see also section 4.2.1) will be returned in this 
case. 

 
Example:  

Store the maximum speed of motor  

Mnemonic:

 STAP 4, 0 

 

Binary:

 

Byte Index 

Function 

Target- 

address 

Instruction 

Number

 

Type 

Motor/ 

Bank 

Operand 

Byte3 

Operand 

Byte2 

Operand 

Byte1 

Operand 

Byte0 

Value (hex) 

$01 

$07 

$04 

$00 

$00 

$00 

$00 

$00 

 

 

 

Summary of Contents for TMCL

Page 1: ...ULE TRINAMIC Motion Control GmbH Co KG Hamburg Germany www trinamic com Firmware Version V1 11 TMCL FIRMWARE MANUAL TMCM 1310 1 Axis Stepper Closed Loop Controller Driver 3 A RMS 48 V ABN and SSI Encoder Input 18 GPIOs USB EtherCAT ...

Page 2: ...s 18 6 2 Parameter Commands 18 6 3 Control Commands 18 6 4 I O Port Commands 18 6 5 Calculation Commands 19 6 6 Interrupt Commands 19 6 6 1 Interrupt Types 19 6 6 2 Interrupt Processing 19 6 6 3 Interrupt Vectors 20 6 6 4 Further Configuration of Interrupts 20 6 6 5 Using Interrupts in TMCL 20 6 7 ASCII Commands 21 6 8 Commands 22 6 8 1 ROR rotate right 22 6 8 2 ROL rotate left 23 6 8 3 MST motor ...

Page 3: ...n 76 8 stallGuard2 Related Parameters 77 9 Closed Loop Operation Related Axis Parameter 78 9 1 General Closed Loop Axis Parameters 78 9 2 General Structure of the Closed Loop System 79 9 3 Setting Encoder Resolution and Motor Resolution 80 9 4 Positioning Mode 81 9 5 Position Maintenance and Standstill Mode 84 9 6 Velocity Mode 86 9 7 Torque Mode 87 9 8 Current Regulation 88 9 9 Field Weakening 92...

Page 4: ...2 feature for stall detection for open loop operation Encoder Encoder input for incremental a b n TTL open collector and differential inputs and absolute SSI encoders selectable in software Interfaces USB 2 0 full speed 12Mbit s communication interface mini USB connector EtherCAT LINK IN and LINK OUT RJ45 Dedicated STOP_L STOP_R inputs Up to 8 multi purpose inputs 24V compatible incl 2 dedicated a...

Page 5: ...d can be used in several industrial demanding applications Benefits of Stepper Drive High torque without gearing No feedback loop oscillations High precision Precise velocity control Benefits of Servo Drive Reaction to any impact No position loss Torque control TMCM 1310 Figure 1 1 TMCM 1310 characteristics in closed loop mode THE TRINAMIC CLOSED LOOP MODE OPERATION prevents the motor from stall a...

Page 6: ...with a special range of values The TRINAMIC Motion Control Language TMCL provides a set of structured motion control commands Every motion control command can be given by a host computer or can be stored in an EEPROM on the module to form programs that run standalone For this purpose there are not only motion control commands but also commands to control the program structure like conditional jump...

Page 7: ...l application to access the communication buffer at any time The consumer gets always the latest consistent buffer which was written by the producer and the producer can always update the content of the buffer The buffered mode is used for cyclic process data Data transfer between EtherCAT master PC etc und slave TMCM 1310 is done using the dual port memory of the ET1100 EtherCAT IC on the slave T...

Page 8: ...ng reading and writing This assures that all data from the producer will reach the consumer The mailbox mode uses just one buffer of the configured size At first after initialization activation the buffer mailbox MBX is writeable Once it is written completely write access is blocked and the buffer can be read out by the other side After it was completely read out it can be written again The time i...

Page 9: ...of the SyncManager channels for the process data as well as the adjustments for the Distributed Clocks Before accepting the change of state the EtherCAT slave copies actual input data into the accordant DP RAM array of the EtherCAT slave controller In the Safe Operational state mailbox and process data communication are possible but the slave holds its outputs in a safe situation and actualizes th...

Page 10: ...ation Safe Operational Mailbox communication on the application layer Process data communication but only inputs are evaluated Outputs remain in safe state Safe Operational to Operational Master sends valid outputs Master requests Operational state AL Control Status Wait for AL Status register confirmation Operational Inputs and outputs are valid Bootstrap Recommended if firmware updates are neces...

Page 11: ...r Start address 4096 length 268 byte Data input buffer Start address 4364 length 40 byte 3 4 Process Data In standard configuration for data transfer the following buffers are used slave view DATA OUTPUT BUFFER ETHERCAT MASTER SLAVE DATA TRANSFER Data output buffer Start address 4096 0x1000 length first 8 bytes Start address End address Data type Data value contents 0x1000 0x1003 UNSIGNED32 Contro...

Page 12: ...locity Command for read out GAP 2 0x108C 0x108F SIGNED32 Actual velocity Command for read out GAP 3 0x1090 0x1093 SIGNED32 Measured velocity Command for read out GAP 131 0x1094 0x1097 UNSIGNED32 Status word Command for read out GAP 18 0x1098 0x109B UNSIGNED32 Error flags Bit Description 0 Target reached 1 Velocity reached 2 Closed loop 3 3 Position mode 4 Velocity mode 5 Torque mode 6 Home switch ...

Page 13: ...e motor bank field and a four byte value field So the binary representation of a command always has seven bytes TRANSMIT AN 8 BYTE COMMAND Bytes Meaning 1 Module address 1 Command number 1 Type number 1 Motor or Bank number 4 Value MSB first Every time a command has been sent to a module the module sends a reply RECEIVE AN 8 BYTE REPLY Bytes Meaning 1 Reply address 1 Module address 1 Status e g 10...

Page 14: ...s of a one byte command field a one byte type field a one byte motor bank field and a four byte value field So the binary representation of a command always has seven bytes When a command is to be sent via USB interface it has to be enclosed by an address byte at the beginning and a checksum byte at the end In this case it consists of nine bytes THE BINARY COMMAND FORMAT FOR USB IS AS FOLLOWS Byte...

Page 15: ...ode can have one of the following values Code Meaning 100 Successfully executed no error 101 Command loaded into TMCL program EEPROM 1 Wrong checksum 2 Invalid command 3 Wrong type 4 Invalid value 5 Configuration EEPROM locked 6 Command not available 4 3 Standalone Applications The module is equipped with an EEPROM for storing TMCL applications You can use TMCL IDE for developing standalone TMCL a...

Page 16: ...ABS 1 50000 A MVP ABS 1 50000 AROL 2 500 A MST 1 ABIN These command lines would address the module with address 1 To address e g module 3 use address character C instead of A The last command line shown above will make the module return to binary mode 5 2 Format of a Reply After executing the command the module sends back a reply in ASCII format The reply consists of the address character of the h...

Page 17: ...t Bit 4 and Bit 5 determine how the characters that are entered are echoed back Normally both bits are set to zero In this case every character that is entered is echoed back when the module is addressed Character can also be erased using the backspace character press 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 im...

Page 18: ...ndalone mode 6 3 Control Commands These commands are used to control the program flow loops conditions jumps etc It does not make sense to use them in direct mode They are intended for standalone mode only Mnemonic Command number Meaning JA 22 Jump always JC 21 Jump conditional COMP 20 Compare accumulator with constant value CSUB 23 Call subroutine RSUB 24 Return from subroutine WAIT 27 Wait for a...

Page 19: ...e TMCL program running on the module 6 6 Interrupt Commands Due to some customer requests interrupt processing has been introduced in the TMCL firmware for ARM based modules Mnemonic Command number Meaning EI 25 Enable interrupt DI 26 Disable interrupt VECT 37 Set interrupt vector RETI 38 Return from interrupt 6 6 1 Interrupt Types There are many different interrupts in TMCL like timer interrupts ...

Page 20: ...t that 6 6 5 Using Interrupts in TMCL To use an interrupt the following things have to be done Define an interrupt handling routine using the VECT command If necessary configure the interrupt using an SGP type 3 value command Enable the interrupt using an EI interrupt command Globally enable interrupts using an EI 255 command An interrupt handling routine must always end with a RETI command The fo...

Page 21: ...stants for all interrupt numbers which can be used in all interrupt commands The beginning of the program above then looks like the following include Interrupts inc VECT TI_TIMER0 Timer0Irq SGP TI_TIMER0 3 1000 EI TI_TIMER0 EI TI_GLOBAL Please also take a look at the other example programs 6 7 ASCII Commands Mnemonic Command number Meaning 139 Enter ASCII mode BIN Quit ASCII mode and return to bin...

Page 22: ...n of this value into rounds per minute etc please refer to chapter 0 also The range is 327 678 000 327 679 999 Internal function first velocity mode is selected Then the velocity value is transferred to axis parameter 2 target velocity Related commands ROL MST SAP GAP Mnemonic ROR 0 velocity Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 1 don t care motor 0 velocity 327 678 000 327 679 ...

Page 23: ...o The range is 327 678 000 327 679 999 Internal function first velocity mode is selected Then the velocity value is transferred to axis parameter 2 target velocity Related commands ROR MST SAP GAP Mnemonic ROL 0 velocity Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 2 don t care motor 0 velocity 327 678 000 327 679 999 Motor number is always O as the module support just one axis Reply i...

Page 24: ...P Mnemonic MST 0 Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 3 don t care motor 0 don t care Motor number is always O as the module support just one axis Reply in direct mode STATUS VALUE 100 OK don t care Example Stop motor 0 Mnemonic MST 0 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target address Instruction Number Type Motor Bank Operand Byte3 Operand Byte2 Operand Byte1 Operand By...

Page 25: ...position in the range from 2 147 483 648 2 147 483 647 Starting a relative movement by means of an offset to the actual position In this case the new resulting position value must not exceed the above mentioned limits too Moving the motor to a previously stored coordinate refer to SCO for details Please note that the distance between the actual position and the new one should not be more than 2 14...

Page 26: ... Move motor 0 from current position 1000 steps backward move relative 1000 Mnemonic MVP REL 0 1000 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target address Instruction Number Type Motor Bank Operand Byte3 Operand Byte2 Operand Byte1 Operand Byte0 Value hex 01 04 01 00 ff ff fc 18 Example Move motor 0 to previously stored coordinate 8 Mnemonic MVP COORD 0 8 Binary Byte Index 0 1 2 3 4 5 6 7 Functi...

Page 27: ...ate device Related commands GAP STAP RSAP AAP Mnemonic SAP parameter number 0 value Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 5 parameter number motor 0 value Motor number is always O as only one motor is involved Reply in direct mode STATUS VALUE 100 OK don t care For a table with parameters and values which can be used together with this command please refer to chapter 7 Example S...

Page 28: ...s or ones for negative values Related commands SAP STAP AAP RSAP Mnemonic GAP parameter number 0 Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 6 parameter number motor 0 don t care Motor number is always O as only one motor is involved Reply in direct mode STATUS VALUE 100 OK don t care For a table with parameters and values which can be used together with this command please refer to c...

Page 29: ...er is always O as only one motor is involved 1 The value operand of this function has no effect Instead the currently used value e g selected by SAP is saved Reply in direct mode STATUS VALUE 100 OK don t care For a table with parameters and values which can be used together with this command please refer to chapter 7 The STAP command will not have any effect when the configuration EEPROM is locke...

Page 30: ...s RAM location Relate commands SAP STAP GAP and AAP Mnemonic RSAP parameter number 0 Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 8 parameter number motor 0 don t care Motor number is always O as only one motor is involved Reply structure in direct mode STATUS VALUE 100 OK don t care For a table with parameters and values which can be used together with this command please refer to cha...

Page 31: ... of the processor The TMCL user variables will not be stored in the EEPROM automatically but this can be done by using STGP commands For a table with parameters and bank numbers which can be used together with this command please refer to chapter 11 Internal function the parameter format is converted The parameter is transferred to the correct position in the appropriate on board device Related co...

Page 32: ...1 Internal function the parameter is read out of the correct position in the appropriate device The parameter format is converted Related commands SGP STGP RSGP AGP Mnemonic GGP parameter number bank number Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 10 parameter number bank number don t care Reply in direct mode STATUS VALUE 100 OK don t care Example Get the serial address of the tar...

Page 33: ...numbers which can be used together with this command please refer to chapter 11 Internal function the specified parameter is copied from its RAM location to the configuration EEPROM Related commands SGP GGP RSGP AGP Mnemonic STGP parameter number bank number Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 11 parameter number bank number don t care Reply in direct mode STATUS VALUE 100 OK ...

Page 34: ...bank numbers which can be used together with this command please refer to chapter 11 Internal function The specified parameter is copied from the configuration EEPROM memory to its RAM location Relate commands SGP STGP GGP and AGP Mnemonic RSGP parameter number bank number Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 12 parameter number bank number don t care Reply structure in direct ...

Page 35: ...checked Internal function the reference search is implemented as a state machine Interaction is possible during execution Related commands WAIT Mnemonic RFS START STOP STATUS 0 Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 13 0 START start ref search 1 STOP abort ref search 2 STATUS get status motor 0 see below Motor number is always O as only one motor is involved Reply in direct mode ...

Page 36: ...T Mnemonic SIO port number bank number value Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 14 port number bank number 2 value 0 1 Reply structure STATUS VALUE 100 OK don t care Example Set OUT_7 to high bank 2 output 7 Mnemonic SIO 7 2 1 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target address Instruction Number Type Motor Bank Operand Byte3 Operand Byte2 Operand Byte1 Operand Byte0 Va...

Page 37: ... 10 OUT3 OUT7 Output Open drain output max 1A Integrated freewheeling diode I O PORTS USED FOR SIO AND COMMAND I O Connector Pin I O port Command Range 0 7 OUT_0 SIO 0 2 n 1 0 0 8 OUT_1 SIO 1 2 n 1 0 0 9 OUT_2 SIO 2 2 n 1 0 0 10 OUT_3 SIO 3 2 n 1 0 1 7 OUT_4 SIO 4 2 n 1 0 1 8 OUT_5 SIO 5 2 n 1 0 1 9 OUT_6 SIO 6 2 n 1 0 1 10 OUT_7 SIO 7 2 n 1 0 ADDRESSING ALL OUTPUT LINES WITH ONE SIO COMMAND Set t...

Page 38: ...d of the reply without affecting the accumulator The actual status 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 BANK VALUE 15 port number bank number don t care Reply in direct mode STATUS VALUE 100 OK status of the port Example Get the analogue val...

Page 39: ...ible 7 OUT0 OUT4 Output Open drain output max 100mA Integrated freewheeling diode 8 OUT1 OUT5 Output Open drain output max 100mA Integrated freewheeling diode 9 OUT2 OUT6 Output Open drain output max 100mA Integrated freewheeling diode 10 OUT3 OUT7 Output Open drain output max 1A Integrated freewheeling diode 6 8 15 1 I O Bank 0 Digital Inputs The ADIN lines can be read as digital or analogue inpu...

Page 40: ...puts at the same time The digital states can be accessed in bank 0 FURTHER READ OUT COMMANDS I O port Command Supply voltage 1 10V GIO 8 1 Temperature C GIO 9 1 Coil current A mA GIO 10 1 Coil current B mA GIO 11 1 Input current mA GIO 12 1 6 8 15 3 I O Bank 2 States of Digital Outputs The states of the OUT lines that have been set by SIO commands can be read back using bank 2 I O Connector Pin I ...

Page 41: ...TION NO TYPE operation MOT BANK VALUE 19 0 ADD add to accu 1 SUB subtract from accu 2 MUL multiply accu by 3 DIV divide accu by 4 MOD modulo divide by 5 AND logical and accu with 6 OR logical or accu with 7 XOR logical exor accu with 8 NOT logical invert accu 9 LOAD load operand to accu don t care operand Example Multiply accu by 5000 Mnemonic CALC MUL 5000 Binary Byte Index 0 1 2 3 4 5 6 7 Functi...

Page 42: ...ording to the comparison result Related commands JC jump conditional GAP GGP GIO CALC CALCX Mnemonic COMP value Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 20 don t care don t care comparison value Example Jump to the address given by the label when the position of motor is greater than or equal to 1000 GAP 1 2 0 get axis parameter type no 1 actual position motor 0 value 0 don t care ...

Page 43: ...ic JC condition label Binary representation INSTRUCTION NO TYPE condition MOT BANK VALUE 21 0 ZE zero 1 NZ not zero 2 EQ equal 3 NE not equal 4 GT greater 5 GE greater equal 6 LT lower 7 LE lower equal 8 ETO time out error don t care jump address Example Jump to address given by the label when the position of motor is greater than or equal to 1000 GAP 1 0 0 get axis parameter type no 1 actual posi...

Page 44: ...JC WAIT CSUB Mnemonic JA Label Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 22 don t care don t care jump address Example An infinite loop in TMCL Loop MVP ABS 0 10000 WAIT POS 0 0 MVP ABS 0 0 WAIT POS 0 0 JA Loop Jump to the label Loop Binary format of JA Loop assuming that the label Loop is at address 20 Byte Index 0 1 2 3 4 5 6 7 Function Target address Instruction Number Type Motor...

Page 45: ... will be ignored if there is no more stack space left Related commands RSUB JA Mnemonic CSUB Label Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 23 don t care don t care subroutine address Example Call a subroutine Loop MVP ABS 0 10000 CSUB SubW Save program counter and jump to label SubW MVP ABS 0 0 JA Loop SubW WAIT POS 0 0 WAIT TICKS 0 50 RSUB Continue with the command following the ...

Page 46: ...ack is empty Related command CSUB Mnemonic RSUB Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 24 don t care don t care don t care Example Call a subroutine Loop MVP ABS 0 10000 CSUB SubW Save program counter and jump to label SubW MVP ABS 0 0 JA Loop SubW WAIT POS 0 0 WAIT TICKS 0 50 RSUB Continue with the command following the CSUB command Binary format of RSUB Byte Index 0 1 2 3 4 5 6...

Page 47: ...pecified by the motor field has been reached An optional timeout value 0 for no timeout must be specified by the ticks parameter The timeout flag ETO will be set after a timeout limit has been reached You can then use a JC ETO command to check for such errors or clear the error using the CLE command Internal function the TMCL program counter is held until the specified condition is met Related com...

Page 48: ... placed at the end of every standalone TMCL program The STOP command is not to be used in direct mode Internal function TMCL instruction fetching is stopped Related commands none Mnemonic STOP Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 28 don t care don t care don t care Example Mnemonic STOP Binary Byte Index 0 1 2 3 4 5 6 7 Function Target address Instruction Number Type Motor Bank...

Page 49: ...E MOT BANK VALUE 30 coordinate number 0 20 motor 0 position 2 147 483 648 2 147 483 647 Motor number is always O as only one motor is involved Reply in direct mode STATUS VALUE 100 OK don t care Example Set coordinate 1 of motor to 1000 Mnemonic SCO 1 0 1000 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target address Instruction Number Type Motor Bank Operand Byte3 Operand Byte2 Operand Byte1 Operan...

Page 50: ... representation INSTRUCTION NO TYPE MOT BANK VALUE 31 coordinate number 0 20 motor 0 don t care Motor number is always O as only one motor is involved Reply in direct mode STATUS VALUE 100 OK don t care Example Get motor value of coordinate 1 Mnemonic GCO 1 0 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target address Instruction Number Type Motor Bank Operand Byte3 Operand Byte2 Operand Byte1 Opera...

Page 51: ...inate number 0 is always stored in RAM only Internal function the selected 24 bit position values are written to the 20 by 3 bytes wide coordinate array Related commands SCO GCO MVP Mnemonic CCO coordinate number motor Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 32 coordinate number 0 20 motor 0 don t care Motor number is always O as only one motor is involved Reply in direct mode STA...

Page 52: ... about storing coordinates refer to the SCO command Internal function the actual value of the accumulator is stored in the internal position array Related commands GCO CCO MVP COORD SCO Mnemonic ACO coordinate number 0 Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 39 coordinate number 0 20 motor 0 don t care Motor number is always O as only one motor is involved Reply in direct mode STA...

Page 53: ...RUCTION NO TYPE operation 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 register 4 MOD modulo divide accu by x register 5 AND logical and accu with X register 6 OR logical or accu with X register 7 XOR logical exor accu with X register 8 NOT logical invert X register 9 LOAD load accu to X register 10 SWAP...

Page 54: ...GAP SGP GGP GIO GCO CALC CALCX Mnemonic AAP parameter number 0 Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 34 parameter number motor 0 don t care Motor number is always O as only one motor is involved Reply in direct mode STATUS VALUE 100 OK don t care Example Positioning motor by a potentiometer connected to the analogue input 0 Start GIO 0 1 get value of analogue input line 0 CALC M...

Page 55: ...ot be modified automatically by a standalone application For a table with parameters and bank numbers which can be used together with this command please refer to chapter 11 Related commands AAP SGP GGP SAP GAP GIO Mnemonic AGP parameter number bank number Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 35 parameter number bank number don t care Reply in direct mode STATUS VALUE 100 OK do...

Page 56: ...all error flags EAL clear the external alarm flag EDV clear the deviation flag Related commands JC Mnemonic CLE flags where flags ALL ETO EDV EPO Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 36 0 ALL all flags 1 ETO timeout flag 3 EDV deviation flag don t care don t care Example Reset the timeout flag Mnemonic CLE ETO Binary Byte Index 0 1 2 3 4 5 6 7 Function Target address Instructio...

Page 57: ...are label The following table shows all interrupt vectors that can be used Interrupt number Interrupt type 0 Timer 0 1 Timer 1 2 Timer 2 3 Target position reached 15 stallGuard2 21 Deviation 27 Left stop switch 28 Right stop switch 39 Input change 0 40 Input change 1 41 Input change 2 42 Input change 3 43 Input change 4 44 Input change 5 45 Input change 6 46 Input change 7 255 Global interrupts Ex...

Page 58: ...ion reached 15 stallGuard2 21 Deviation 27 Left stop switch 28 Right stop switch 39 Input change 0 40 Input change 1 41 Input change 2 42 Input change 3 43 Input change 4 44 Input change 5 45 Input change 6 46 Input change 7 255 Global interrupts Examples Enable interrupts globally EI 255 Binary format of EI Byte Index 0 1 2 3 4 5 6 7 Function Target address Instruction Number Type Motor Bank Oper...

Page 59: ...tion reached 15 stallGuard2 21 Deviation 27 Left stop switch 28 Right stop switch 39 Input change 0 40 Input change 1 41 Input change 2 42 Input change 3 43 Input change 4 44 Input change 5 45 Input change 6 46 Input change 7 255 Global interrupts Examples Disable interrupts globally DI 255 Binary format of DI Byte Index 0 1 2 3 4 5 6 7 Function Target address Instruction Number Type Motor Bank Op...

Page 60: ...saved registers A register X register flags are copied back Normal program execution continues Related commands EI DI VECT Mnemonic RETI Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 38 don t care don t care don t care Example Terminate interrupt handling and continue with normal program execution RETI Binary format of RETI Byte Index 0 1 2 3 4 5 6 7 Function Target address Instruction ...

Page 61: ...for a customer specific programming Internal function Call user specific functions implemented in C by TRINAMIC Related commands none Mnemonic UF0 UF7 parameter number Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 64 71 user defined user defined user defined Reply in direct mode Byte Index 0 1 2 3 4 5 6 7 Function Target address Target address Status Instruction Operand Byte3 Operand By...

Page 62: ...YPE MOT BANK VALUE 138 don t care don t care 0 Motor number Reply in direct mode right after execution of this command Byte Index 0 1 2 3 4 5 6 7 Function Target address Target address Status Instruction Operand Byte3 Operand Byte2 Operand Byte1 Operand Byte0 Value hex 02 01 100 138 00 00 00 Motor bit mask Additional reply in direct mode after motors have reached their target positions Byte Index ...

Page 63: ...lue are ignored 137 don t care Reset to factory defaults Reset all settings stored in the EEPROM to their factory defaults This command does not send back a reply Value must be 1234 SPECIAL REPLY FORMAT OF COMMAND 136 Type set to 0 reply as a string Byte index Contents 1 Host Address 2 9 Version string 8 characters e g 1310V102 There is no checksum in this reply format Type set to 1 version number...

Page 64: ...ic parameters should be adjusted to motor application for proper module operation Parameters for the more experienced user please do not change unless you are absolutely sure Parameters for closed loop operation Number Axis Parameter Description Range Unit Acc 0 Target position The desired position in position mode see ramp mode no 138 2 147 483 648 2 147 483 647 µsteps encoder steps RW 1 Actual p...

Page 65: ... 1 R 12 Right limit switch disable If set deactivates the stop function of the right switch 0 1 RWE 13 Left limit switch disable Deactivates the stop function of the left switch resp reference switch if set 0 1 RWE 14 CL torque mode target current Target RMS current value for torque mode Positive and negative values define rotation direction Writing a target value to this parameter automatically s...

Page 66: ...to increasing the I t exceed counter 0 4294967295 RWE 27 I t sum Actual sum of the I t monitor 0 4294967295 R 28 I t exceed counter Counts how often an I t sum was higher than the I t limit 0 4294967295 RWE 29 Clear I t exceeded flag Clear the flag that indicates that the I t sum has exceeded the I t limit ignored W 108 CL field weakening minimum velocity Minimum motor speed at which the speed dep...

Page 67: ...s RW 117 CL current scale upper error limit Position error from which on the current amplitude will be increased to its configured maximum parameter 114 This parameter must be higher than axis parameter 116 Default 255 encoder steps RW 118 CL current scale increment value Current scale increment value if the actual current scale factor is below the calculated current scale factor target value This...

Page 68: ...or Actual value of the current scale factor 0 255 1 256 R 124 CL correction velocity proportional factor Proportional factor for on line live position lag compensation in positioning mode during a ramp movement For a very quick compensation while the drive is active choose a high the maximum value 0 65535 RW 125 CL max following error Maximum allowed following error during a ramp movement before s...

Page 69: ... mode the closed loop system will be initialized Attention Wait for the closed loop init flag to be set to 1 after switching to closed loop mode see parameter 133 0 1 RW 130 Start Stop velocity Ramp generation for acceleration and deceleration begins ends with this start and stop velocity value When set to equal to the target speed no ramp is generated When set smaller than the target velocity als...

Page 70: ... In this mode the position is hold and maintained as long as the position error is within the range of the standstill error limit axis parameter 138 around the target position This parameter is a gain factor for the position error used for position maintenance in standstill mode A value of 20 typically provides good results Higher values provide higher stiffness For values greater than 25 a dampen...

Page 71: ...With closed loop the microstep resolution is always 256 0 8 RWE 141 CL torque mode start stop current Start and stop current in torque mode 0 3000 mA RW 150 Motor current Actual motor current mA R 151 Current Phase A Actual peak current Phase A mA R 152 Current Phase B Actual peak current Phase B mA R 153 Supply Voltage Actual value of supply voltage 1 10 V R 154 DC Current Actual DC current of th...

Page 72: ...or coolStep operation by scaling the CS Current Scale see axis parameter 6 value minimum motor current 0 1 2 of CS 1 1 4 of CS 0 1 RW 169 smartEnergy current down step Sets the number of stallGuard2 readings above the upper threshold necessary for each current decrement of the motor current Number of stallGuard2 measurements per decrement Scaling 0 3 32 8 2 1 0 slow decrement 3 fast decrement 0 3 ...

Page 73: ... 3 for this module or rather use the default value 0 lowest slope 3 fastest slope 0 3 RW 176 Slope control low side Determines the slope of the motor driver outputs Set identical to slope control high side 0 3 RW 177 Short protection disable 0 Short to GND protection is on 1 Short to GND protection is disabled Use default value 0 1 RW 178 Short detection timer 0 3 2µs 1 1 6µs 2 1 2µs 3 0 8µs Use d...

Page 74: ...pps RWE 196 End switch distance This parameter provides the distance between the end switches after executing the RFS command mode 2 or 3 0 2 147 483 647 µsteps encoder steps R 198 Clear on null This parameter can be used to set bit 2 of axis parameter 201 0 Delete bit 2 of axis parameter 201 1 Clear encoder on next null channel event set bit 2 of axis parameter 201 0 1 RW 200 Boost current Curren...

Page 75: ...uadrature encoder 1 line 4 positions 0 65535 positions RW 212 Max encoder deviation When the actual commanded position and the encoder position parameter 209 differ more than defined by this parameter the motor will be stopped This function is switched off when the maximum deviation is set to zero If the value is negative and the maximum encoder deviation is exceeded the motor current will be swit...

Page 76: ...ent to the actual current scale factor 0 255 1 256 R 237 Position error This parameter indicates the difference between the virtual actual position of the ramp generator and the measured position of the motor 2 147 483 648 2 147 483 647 µsteps encoder steps R 7 1 Velocity Calculation Some axis parameters are related to the speed of the motor The unit of the velocity value is pulse per second pps F...

Page 77: ...module The current adjustment is within the range 0 255 and can be adjusted in 32 steps The most important motor setting since too high values might cause motor damage 0 7 79 87 160 167 240 247 8 15 88 95 168 175 248 255 16 23 96 103 176 183 24 31 104 111 184 191 32 39 112 119 192 199 40 47 120 127 200 207 48 55 128 135 208 215 56 63 136 143 216 223 64 71 144 151 224 231 72 79 152 159 232 239 173 ...

Page 78: ... target position differ Trapezoidal speed ramps are provided When switching into this mode using MVP ABS REL COORD the motor will immediately start when there is a position difference 1 Velocity mode The motor will run continuously and the speed will be changed with constant maximum acceleration if the parameter target speed is changed 2 Torque mode In closed loop mode only the motor can be driven...

Page 79: ...high In closed loop mode the ramp generator provides extended functionality to control position and velocity The torque control block is used to control commutation angle and current level Further it provides an option to compensate back EMF at higher speeds Current level control can be switched off but closed loop operation is still possible When using current level control the current amplitude ...

Page 80: ... The default value is 200 as most stepper motors have 200 fullsteps with 1 8 each If your motor is different you need to adapt parameter 202 by simply configuring the number of fullsteps of the motor AXIS PARAMETERS RELATED TO ENCODER RESOLUTION AND MOTOR RESOLUTION Number Axis parameter Description Units Default Acc 201 Encoder mode Operation mode of the encoder 4 bit 2 Clear encoder on next null...

Page 81: ...he target velocity and the actual target position cannot be reached during movement due to high load blue broken line in Figure 9 2 a maximum correction velocity axis parameter 126 can be defined to compensate the position error between virtual target position of the ramp generator axis parameter 233 and actual position of the drive according to encoder feedback encoder counter axis parameter 209 ...

Page 82: ... POSITIONING MODE Number Axis parameter Description Units Default Acc 0 Target position The desired position in position mode see ramp mode no 138 2 147 483 648 2 147 483 647 encoder steps RW 1 Actual position The current position of the motor 2 147 483 648 2 147 483 647 encoder steps RW 2 Target speed The desired speed in velocity mode see ramp mode parameter 138 In position mode this parameter i...

Page 83: ... and a lag occurs during movement the velocity will be increased to the maximum correction speed to compensate the position lag following error If set to 0 or smaller than target velocity the ramp profile will be simply extended if there is a lag between actual position and commanded position If greater than target velocity the position lag will be compensated on line live 0 327 679 999 pps RW 127...

Page 84: ...t position using a defined ramp profile If the position error is inside the standstill position error limit only the torque control block is used to maintain the target position Position Error microsteps Figure 9 4 Principle and parameters for position maintenance POSITION ERROR INSIDE THE STANDSTILL POSITION ERROR LIMIT BLUE AREA If load is applied to the motor shaft in standstill mode the target...

Page 85: ...ty regulation will be switched off and the system is in a special standstill mode In this mode the position is hold and maintained as long as the position error is within the range of the standstill error limit axis parameter 138 around the target position This parameter is a gain factor for the position error used for position maintenance in standstill mode A value of 20 typically provides good r...

Page 86: ...amp up can be made using a defined acceleration phase by setting axis parameter 5 When the target velocity is reached measured via encoder interface the velocity_reached flag GAP 16 is set A velocity reached window can be defined using axis parameter 17 If the actual velocity is within this window the target velocity is considered as reached Number Axis parameter Description Units Default Acc 16 C...

Page 87: ...essary AXIS PARAMETERS RELATED TO TORQUE MODE Number Axis parameter Description Units Default Acc 14 CL torque mode target current Target RMS current value for torque mode Positive and negative values define rotation direction Writing a target value to this parameter automatically switches to torque mode Reading provides the actual configured target current while in torque mode Reading while in ot...

Page 88: ...r GAP 123 position error GAP 14 45 90 135 0 I_SCALE_MIN SAP 113 45 90 135 I_SCALE_MAX SAP 114 X_TARGET SAP 0 Current Scaler Lower Error Limit SAP 116 Current Scaler Upper Error Limit SAP 117 Figure 9 5 Basic principle of position error dependent current amplitude regulation EXPLANATIONS RELATED TO FIGURE 9 5 Based on the position error with respect to the actual target position the current amplitu...

Page 89: ...s value is added or subtracted from the actual value until the actual target current scale factor is reached Axis parameters 120 and 121 define a delay timer value Each time the current scale factor needs to be updated increased or decreased a timer is started with the respective delay value The next increment or decrement will only be done when the timer is zero If the parameters 120 and 121 are ...

Page 90: ...ps RW 117 CL current scale upper error limit Position error from which on the current amplitude will be increased to its configured maximum parameter 114 This parameter must be higher than axis parameter 116 Default 255 encoder steps RW 118 CL current scale increment value Current scale increment value if the actual current scale factor is below the calculated current scale factor target value Thi...

Page 91: ...nable 1 current scaling function on for closed loop 0 current scaling function off closed loop operation is still possible The current scaling functionality can be switched off if full specified current amplitude shall be used all the time When switched on the current scaling functionality adapts the current according to the configured profile This saves energy and keeps the motor cooler Default 1...

Page 92: ...an be read out on the fly using axis parameter 230 This mechanism is also applied in positioning and torque mode when exceeding the configured corner velocities gamma Velocity 0 max phase angle correction of 90 field weakening Vmin SAP 108 field weakening Vmax SAP 109 Figure 9 8 Principle and parameters for field weakening in velocity mode AXIS PARAMETERS RELATED TO FIELD WEAKENING Number Axis par...

Page 93: ...lag 0 open loop mode or closed loop not initialized 1 closed loop is initialized and ready for use See also axis parameter 129 0 1 150 Motor current Actual motor current mA 151 Current Phase A Actual peak current Phase A mA 152 Current Phase B Actual peak current Phase B mA 153 Supply Voltage Actual value of supply voltage 1 10 V 154 DC Current Actual DC current of the complete module motor mA 155...

Page 94: ...lag is set 9 11 1 Example Program 1 To run example program 1 an encoder with 40000 increments per rotation has to be connected For positioning the commands MVP ABS and WAIT POS are used Initialize the parameters SAP 6 0 128 max current SAP 202 0 200 motor full steps SAP 210 0 40000 encoder steps SAP 4 0 398105 positioning speed SAP 5 0 3981070 acceleration SAP 126 0 1023950 correction speed SAP 12...

Page 95: ...ing position reached interrupts SAP 6 0 128 set max motor current Start encoder detection and wait until ready SAP 132 0 1 Detect GAP 132 0 COMP 2 JC NE Detect Switch on closed loop and wait until ready SAP 129 0 1 Init GAP 133 0 JC ZE Init Let motor run using position reached interrupt VECT 3 PosReached1 EI 3 EI 255 MVP ABS 0 51200 Loop WAIT TICKS 0 1000 JA Loop PosReached1 VECT 3 PosReached2 MVP...

Page 96: ...tch See the TMC 429 data sheet for the different switch modes The default has two switch modes the left switch as the reference switch the right switch as a limit stop switch 10 Right limit switch status The logical state of the right limit switch 11 Left limit switch status The logical state of the left limit switch in three switch mode 12 Right limit switch disable If set deactivates the stop fu...

Page 97: ...imit switch positive limit switch SAP 193 0 4 negative limit switch Search right stop switch then search left stop switch from both sides Search left stop switch from both sides SAP 193 0 1 negative limit switch SAP 193 0 2 negative limit switch positive limit switch Search left stop switch only Search right stop switch then search left stop switch ...

Page 98: ...tive limit switch home switch SAP 193 0 7 home switch SAP 193 0 8 home switch Search home switch in negative direction reverse the direction when left stop switch reached Search home switch in positive direction reverse the direction when right stop switch reached Search home switch in positive direction ignore end switches Search home switch in negative direction ignore end switches ...

Page 99: ...to do it in an interactive way MEANING OF THE LETTERS IN COLUMN ACCESS Access type Related command s Description R GGP Parameter readable W SGP AGP Parameter writable E STGP RSGP Parameter stored permanently in EEPROM Number Global parameter Description Range Access 64 EEPROM magic Setting this parameter to a different value as E4 will cause re initialization of the axis and global parameters to f...

Page 100: ...rdinates are always stored in the EEPROM only 0 or 1 RWE 85 do not restore user variables 0 user variables are restored default 1 user variables are not restored 0 1 RWE 128 TMCL application status 0 stop 1 run 2 step 3 reset 0 3 R 129 Download mode 0 normal mode 1 download mode 0 1 R 130 TMCL program counter The index of the currently executed TMCL instruction R 132 Tick timer A 32 bit counter th...

Page 101: ...mber have a higher priority The following table shows all interrupt parameters that can be set MEANING OF THE LETTERS IN COLUMN ACCESS Access type Related command s Description R GGP Parameter readable W SGP AGP Parameter writable E STGP RSGP Parameter stored permanently in EEPROM Number Global parameter Description Range Access 0 Timer 0 period ms Time between two interrupts ms 32 bit unsigned ms...

Page 102: ...So most but not all standalone TMCL programs look like this Initialization SAP 4 0 500 define max positioning speed SAP 5 0 100 define max acceleration MainLoop do something in this example just running between two positions MVP ABS 0 5000 WAIT POS 0 0 MVP ABS 0 0 WAIT POS 0 0 JA MainLoop end of the main loop run infinitely 12 3 Using Symbolic Constants To make your program better readable and und...

Page 103: ...34 GGP MyVariable 2 Copy the contents of the variable to the accumulator register CALC MUL 2 Multiply accumulator register with two AAP MyVariable 2 Store contents of the accumulator register to the variable Furthermore these variables can provide a powerful way of communication between a TMCL program running on a module and a host The host can change a variable by issuing a direct mode SGP comman...

Page 104: ... mode This way also a set of TMCL routines can be defined that are called by a host In this case it is recommended to place JA commands at the beginning of the TMCL program that jump to the specific routines This assures that the entry addresses of the routines will not change even when the TMCL routines are changed so when changing the TMCL routines the host program does not have to be changed EX...

Page 105: ...fe and whose failure to perform when properly used in accordance with instructions provided can be reasonably expected to result in personal injury or death TRINAMIC Motion Control GmbH Co KG 2013 2014 Information given in this data sheet is believed to be accurate and reliable However neither responsibility is assumed for the consequences of its use nor for any infringement of patents or other ri...

Page 106: ...river stage I2 t control added axis parameters 25 29 I2 t status flag added The value of axis parameter 112 encoder offset can be stored now Corrections Actual position value in open loop mode can be changed now The USB interface reports the correct USB version now 14 2 Document Revision Version Date Author Description 1 00 2012 DEC 06 SD First version 1 10 2013 MAY 23 SK Closed Loop Section and P...

Page 107: ...itioning in closed loop mode encoder steps instead of microsteps Axis parameter 254 updated I2 t control axis parameters 25 29 added I2 t status flag description added Axis parameter 112 description updated 15 References JST JST connector http www jst com TMCL IDE TMCL IDE User Manual see http www trinamic com TMCM 1310 TMCM 1310 Hardware Manual see http www trinamic com ...

Reviews: