background image

TMCM-1021 TMCL

Firmware Manual • Firmware Version V1.42 | Document Revision V1.10 • 2018-JAN-09

57 / 109

Two special functions of this command have been introduced that make it possible to copy all coordinates

or one selected coordinate from the EEPROM to the RAM.

These functions can be accessed using the following special forms of the GCO command:

• GCO 0, 255, 0 copies all coordinates (except coordinate number 0) from the EEPROM to the RAM.

• GCO <coordinate number>, 255, 0 copies the coordinate selected by <coordinate number> from the

EEPROM to the RAM. The coordinate number must be a value between 1 and 20.

©2018 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany

Terms of delivery and rights to technical change reserved.
Download newest version at

www.trinamic.com

Summary of Contents for TMCM-1021 TMCL

Page 1: ...er motor control Supply voltage 24V DC TMCL RS485 interface Step Direction input Additional inputs and outputs coolStep stallGuard2 sensOstep encoder Applications Laboratory Automation Manufacturing S...

Page 2: ...Commands 18 3 6 3 Branch Commands 18 3 6 4 I O Port Commands 19 3 6 5 Calculation Commands 19 3 6 6 Interrupt Processing Commands 20 3 7 Detailed TMCL Command Descriptions 23 3 7 1 ROR Rotate Right 2...

Page 3: ...mands 74 4 Axis Parameters 76 5 Global Parameters 85 5 1 Bank 0 85 5 2 Bank 1 88 5 3 Bank 2 88 5 4 Bank 3 88 6 Module Speci c Hints 90 6 1 Conversion between PPS RPM and RPS 90 6 2 The sensOstep Encod...

Page 4: ...ademark Designations and Symbols 106 11 4 Target User 106 11 5 Disclaimer Life Support Systems 106 11 6 Disclaimer Intended Use 106 11 7 Collateral Documents Tools 107 12 Revision History 108 12 1 Fir...

Page 5: ...cient operation low power dissipation Dynamic current control Integrated protection stallGuard2 feature for stall detection coolStep feature for reduced power consumption and heat dissipation Encoder...

Page 6: ...d adaptive automatic current scaling based on the load measurement via stallGuard2 adapting the required current to the load Energy consumption can be reduced by as much as 75 coolStep allows substant...

Page 7: ...L IDE is running on your PC When the module is connected properly via RS485 then it will be recognized by the TMCL IDE so that it can be used 2 2 Using the TMCL Direct Mode At rst try to use some TMCL...

Page 8: ...ting as too high values can cause motor damage 0 255 RW 7 Standby current The current used when the motor is not running The maximum value is 255 which means 100 of the maximum current of the module T...

Page 9: ...ble the program 2 Click the Download icon or choose Download from the TMCL menu in the TMCL creator to donwload the program to the module 3 Click the Run icon or choose Run from the TMCL menu in the T...

Page 10: ...here are more than two nodes connected to a single bus The Trinamic Motion Control Language TMCL provides a set of structured motion control commands Every motion control command can be given by a hos...

Page 11: ...ing up all bytes including the module address byte using 8 bit addition Here are two examples which show how to do this Checksum calculation in C 1 unsigned char i Checksum unsigned char Command 9 3 S...

Page 12: ...received the reply Note When using CAN interface the reply does not contain an address byte and a checksum byte With CAN the CAN ID is used as the reply address and the checksum is not needed because...

Page 13: ...rogram into the EEPROM and afterwards it will run on the module The TMCL IDE contains an editor and the TMCL assembler where the commands can be entered using their mnemonic format They will be assemb...

Page 14: ...ode RUN This command can be used to start a TMCL program stored in memory STOP Stops a TMCL program which is currently running on the module 3 4 1 Entering and leaving the ASCII Mode The ASCII command...

Page 15: ...odule will start up in ASCII mode else the module will start up in binary mode default Bit 4 and bit 5 determine how the characters that are entered are echoed back Normally both bits are set to zero...

Page 16: ...ter restore mo tion control speci c settings SGP 9 parameter bank number value Set global parameter module speci c settings e g communication settings or TMCL user variables GGP 10 parameter bank numb...

Page 17: ...CX 33 operation Process accumulator and X register AAP 34 parameter motor number Accumulator to axis parameter AGP 35 parameter bank number Accumulator to global parameter CLE 36 ag Clear an error ag...

Page 18: ...module itself These commands can also be used in direct mode and in standalone mode Parameter Commands Mnemonic Command number Meaning SAP 5 Set axis parameter GAP 6 Get axis parameter STAP 7 Store ax...

Page 19: ...se commands are intended to be used for calculations within TMCL applications Although they could also be used in direct mode it does not make much sense to do so Calculation Commands Mnemonic Command...

Page 20: ...Command number Meaning EI 25 Enable interrupt DI 26 Disable interrupt VECT 37 Set interrupt vector RETI 38 Return from interrupt Table 11 Interrupt Processing Commands 3 6 6 1 Interrupt Types There ar...

Page 21: ...ds with parameter bank 3 SGP type 3 value Please refer to the SGP command chapter 3 7 9 for further information about that 3 6 6 4 Using Interrupts in TMCL To use an interrupt the following things hav...

Page 22: ...program better readable use the provided include le Interrupts inc This le de nes symbolic constants for all interrupt numbers which can be used in all interrupt commands The beginning of the program...

Page 23: ...y mode is selected Then the velocity value is transferred to axis parameter 2 target velocity Related commands ROL MST SAP GAP Mnemonic ROR axis velocity Binary Representation Instruction Type Motor B...

Page 24: ...velocity Related commands ROR MST SAP GAP Mnemonic ROL axis velocity Binary Representation Instruction Type Motor Bank Value 2 0 0 2147483648 2147583647 Reply in Direct Mode Status Value 100 OK don t...

Page 25: ...monic MST axis Binary Representation Instruction Type Motor Bank Value 3 0 0 0 Reply in Direct Mode Status Value 100 OK don t care Example Stop motor 0 Mnemonic MST 0 Binary Form of MST 0 Field Value...

Page 26: ...2147483648 2147483647 231 231 1 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 M...

Page 27: ...e motor 0 from current position 10000 microsteps backward Mnemonic MVP REL 0 10000 Binary Form of MVP REL 0 10000 Field Value Target address 01h Instruction number 04h Type 01h Motor Bank 00h Value By...

Page 28: ...er 04h Type 02h Motor Bank 00h Value Byte 3 00h Value Byte 2 00h Value Byte 1 00h Value Byte 0 08h Checksum 0Fh Note Before moving to a stored coordinate the coordinate has to be set using an SCO CCO...

Page 29: ...parameter speci ed by the parameter number Related commands GAP AAP Mnemonic SAP parameter number axis value Binary representation Binary Representation Instruction Type Motor Bank Value 5 see chapter...

Page 30: ...nd values that can be used together with this command please refer to section 4 Internal function The speci ed value gets copied to the accumulator Related commands SAP AAP Mnemonic GAP parameter numb...

Page 31: ...4 Internal function The axis parameter speci ed by the type and bank number will be stored in the EEPROM Related commands SAP AAP GAP RSAP Mnemonic STAP parameter number bank Binary Representation Ins...

Page 32: ...ernal function The axis parameter speci ed by the type and bank number will be restored from the EEPROM Related commands SAP AAP GAP RSAP Mnemonic RSAP parameter number bank Binary Representation Inst...

Page 33: ...For a table with parameters and values which can be used together with this command please refer to section 5 Internal function The speci ed value will be copied to the global parameter speci ed by th...

Page 34: ...er with this command please refer to section 5 Internal function The global parameter speci ed by the type and bank number will be copied to the accumulator register Related commands SGP AGP Mnemonic...

Page 35: ...n be used together with this command please refer to dection 5 3 Internal function The global parameter speci ed by the type and bank number will be stored in the EEPROM Related commands SGP AGP GGP R...

Page 36: ...rnal function The global parameter speci ed by the type and bank number will be restored from the EEPROM Related commands SGP AGP GGP STGP Mnemonic RSGP parameter number bank Binary Representation Ins...

Page 37: ...ference search algorithm to meet your needs please see chapter 4 Internal function The internal reference search state machine is started or stoped or its state is queried Related commands SAP GAP WAI...

Page 38: ...RT Field Value Target address 01h Instruction number 0Dh Type 00h Motor Bank 00h Value Byte 3 00h Value Byte 2 00h Value Byte 1 00h Value Byte 0 00h Checksum 0Eh 2018 TRINAMIC Motion Control GmbH Co K...

Page 39: ...ruction Type Motor Bank Value 14 port number bank number 2 0 1 Reply in Direct Mode Status Value 100 OK 0 don t care Example Set output 0 bank 2 to high Mnemonic SIO 0 2 1 Binary Form of SIO 0 2 1 Fie...

Page 40: ...e interpreted as a bit vector where each of the lower eight bits represents one of the digital outputs So the range for x is 0 255 The value x can also be 1 In this case the value will be taken from t...

Page 41: ...the accumulator The actual status of a digital output line can also be read Internal function The state of the i o line speci ed by the type parameter and the bank parameter is read Related commands S...

Page 42: ...0 0 1 Special case GIO 255 0 reads all general purpose inputs simulataneously and puts the result into the lower eight bits of the accumulator register Special case GIO 11 0 checks if the sensOstep e...

Page 43: ...sion V1 10 2018 JAN 09 43 109 Digital Outputs in Bank 2 Port Command Range OUT0 GIO 0 2 0 1 OUT1 GIO 1 2 0 1 2018 TRINAMIC Motion Control GmbH Co KG Hamburg Germany Terms of delivery and rights to tec...

Page 44: ...AP GGP GIO Mnemonic CALC operation operand Binary representation Binary Representation Instruction Type Motor Bank Value 19 0 ADD add to accumulator 0 don t care operand 1 SUB subtract from accumulato...

Page 45: ...FFh Value Byte 2 FFh Value Byte 1 ECh Value Byte 0 78h Checksum 78h Reply Status no error value 5000 Field Value Host address 02h Target address 01h Status 64h Instruction 13h Value Byte 3 FFh Value...

Page 46: ...jump Related commands JC GAP GGP GIO CALC CALCX Mnemonic COMP operand Binary Representation Instruction Type Motor Bank Value 20 0 don t care 0 don t care operand Example Jump to the address given by...

Page 47: ...ands JA COMP WAIT CLE Mnemonic JC condition label Binary Representation Instruction Type Motor Bank Value 21 0 ZE zero 0 don t care jump address 1 NZ not zero 2 EQ equal 3 NE not equal 4 GT greater 5...

Page 48: ...abel at address 10 Field Value Target address 01h Instruction number 15h Type 05h Motor Bank 00h Value Byte 3 00h Value Byte 2 00h Value Byte 1 00h Value Byte 0 0Ah Checksum 25h 2018 TRINAMIC Motion C...

Page 49: ...r Bank Value 22 0 don t care 0 don t care jump address Example An in nite loop in TMCL 1 Loop MVP ABS 0 51200 3 WAIT POS 0 0 MVP ABS 0 0 5 WAIT POS 0 0 JA Loop Binary form of the JA Loop command when...

Page 50: ...ic CSUB label Binary Representation Instruction Type Motor Bank Value 23 0 don t care 0 don t care subroutine address Example Call a subroutine Loop 2 MVP ABS 0 10000 CSUB SubW Save program counter an...

Page 51: ...nored if the stack is empty Related commands CSUB Mnemonic RSUB Binary Representation Instruction Type Motor Bank Value 24 0 don t care 0 don t care 0 don t care Example Please see the CSUB example se...

Page 52: ...ks parameter Special case for the ticks parameter When this parameter is set to 1 the contents of the accumulator register will be taken for this value So for example WAIT TICKS 0 1 will wait as long...

Page 53: ...onic WAIT POS 0 0 Binary Form of WAIT POS 0 0 Field Value Target address 01h Instruction number 1Bh Type 01h Motor Bank 00h Value Byte 3 00h Value Byte 2 00h Value Byte 1 00h Value Byte 0 00h Checksum...

Page 54: ...ne mode will be stopped Related commands none Mnemonic STOP Binary Representation Instruction Type Motor Bank Value 28 0 don t care 0 don t care 0 don t care Example Mnemonic STOP Binary Form of STOP...

Page 55: ...ue 30 coordinate number motor number position 0 20 0 231 231 1 Example Set coordinate 1 of motor 0 to 1000 Mnemonic SCO 1 0 1000 Binary Form of SCO 1 0 1000 Field Value Target address 01h Instruction...

Page 56: ...s stored in RAM only Internal function the desired value is read out of the internal coordinate array copied to the accumulator register and in direct mode returned in the value eld of the reply Relat...

Page 57: ...be accessed using the following special forms of the GCO command GCO 0 255 0 copies all coordinates except coordinate number 0 from the EEPROM to the RAM GCO coordinate number 255 0 copies the coordi...

Page 58: ...tual position of the selected motor is copied to selected coordinate array entry Related commands SCO GCO ACO MVP COORD Mnemonic CCO coordinate number motor number Binary Representation Instruction Ty...

Page 59: ...motor is copied to selected coordinate array entry Related commands SCO GCO CO MVP COORD Mnemonic ACO coordinate number motor number Binary Representation Instruction Type Motor Bank Value 39 coordin...

Page 60: ...on Type Motor Bank Value 33 0 ADD add X register to accumulator 0 don t care 0 don t care 1 SUB subtract X register from accumulator 2 MUL multiply accumulator by X register 3 DIV divide accumulator b...

Page 61: ...UL Field Value Target address 01h Instruction number 21h Type 02h Motor Bank 00h Value Byte 3 00h Value Byte 2 00h Value Byte 1 00h Value Byte 0 00h Checksum 24h 2018 TRINAMIC Motion Control GmbH Co K...

Page 62: ...AP GAP SGP GGP GIO GCO CALC CALCX Mnemonic AAP parameter number motor number Binary Representation Instruction Type Motor Bank Value 34 see chapter 4 0 value Reply in Direct Mode Status Value 100 OK d...

Page 63: ...hat can be used with this com mand please see section 5 Related commands AAP SGP GGP SAP GAP GIO Mnemonic AGP parameter number bank number Binary Representation Instruction Type Motor Bank Value 35 pa...

Page 64: ...he external alarm ag EDV clear the deviation ag EPO clear the position error ag Related commands JC WAIT Mnemonic CLE ags Binary Representation Instruction Type Motor Bank Value 36 0 ALL all ags 0 don...

Page 65: ...O Field Value Target address 01h Instruction number 24h Type 01h Motor Bank 00h Value Byte 3 00h Value Byte 2 00h Value Byte 1 00h Value Byte 0 00h Checksum 26h 2018 TRINAMIC Motion Control GmbH Co KG...

Page 66: ...Related commands DI VECT RETI Mnemonic EI interrupt number Binary Representation Instruction Type Motor Bank Value 25 interrupt number 0 don t care 0 don t care Reply in Direct Mode Status Value 100 O...

Page 67: ...Related commands EI VECT RETI Mnemonic DI interrupt number Binary Representation Instruction Type Motor Bank Value 26 interrupt number 0 don t care 0 don t care Reply in Direct Mode Status Value 100...

Page 68: ...ended for use in standalone mode only Info Please see table 12 for a list of interrupts that can be used on the TMCM 1021 module Related commands EI DI RETI Mnemonic VECT interrupt number label Binary...

Page 69: ...el is at 50 Field Value Target address 01h Instruction number 25h Type FFh Motor Bank 00h Value Byte 3 00h Value Byte 2 00h Value Byte 1 00h Value Byte 0 32h Checksum 58h 2018 TRINAMIC Motion Control...

Page 70: ...and program counter are copied back so that normal program ow will continue Related commands EI DI VECT Mnemonic RETI Binary Representation Instruction Type Motor Bank Value 38 interrupt number 0 don...

Page 71: ...ic Please contact the sales department of Trinamic Motion Control GmbH Co KG if you need a customized TMCL rmware Related commands none Mnemonic UF0 UF7 Binary Representation Instruction Type Motor Ba...

Page 72: ...r which motors one would like to have a position reached message The value eld contains a bit mask where every bit stands for one motor For one motor modules like the TMCM 1021 it only makes sense to...

Page 73: ...or bit mask Checksum depends also on motor bit mask Additional Reply after Motor has reached Target Position Field Value Target address 01h Host address 02h Status 80h 128 Command 8Ah 138 Value Byte 3...

Page 74: ...Description Type Value 128 stop application stop a running TMCL application 0 don t care 0 don t care 129 run application start or continue TMCL program execution 0 from current address 0 don t care...

Page 75: ...ry format 0 don t care 137 restore factory settings Reset all settings in the EEPROM to their factory defaults This command does not send a reply 0 don t care set to 1234 255 software reset Restart th...

Page 76: ...All Axis Parameters of the TMCM 1021 Module Number Axis Parameter Description Range Units Access 0 Target position The desired target position in position mode 2147483648 2147483647 steps RW 1 Actual...

Page 77: ...tor is not running The maximum value is 255 which means 100 of the maximum current of the module This value should be as low as possible so that the motor can cool down when it is not moving Please se...

Page 78: ...eps 7 128 microsteps 8 256 microsteps 0 8 RW 160 Step interpolation enable Step interpolation is supported with 16 mi crostep setting only With this option activated each microstepstep will internally...

Page 79: ...e sine wave offset 0 8 RW 167 Chopper off time TOff The off time setting controls the minimum chopper frequency An off time within the range of 5 s to 20 s will t Off time setting for constant t Off c...

Page 80: ...4 stallGuard2 threshold This signed value controls stallGuard2 threshold level for stall output and sets the optimum mea surement range for readout A lower value gives a higher sensitivity Zero is the...

Page 81: ...status value provides the actual motor cur rent setting as controlled by coolStep The value goes up to the CS value and down to the portion of CS as speci ed by SEIMIN Actual motor current scaling fa...

Page 82: ...tead of the left reference switch can be used with mode 1 4 1 8 RW 194 Reference search speed This value speci es the speed for roughly search ing the reference switch 0 2147483647 pps RW 195 Referenc...

Page 83: ...t to ground A 1 short condition detected driver cur rently shut down Bit 4 Short to ground B 1 short condition detected driver cur rently shut down Bit 5 Open load A 1 no chopper event has happened du...

Page 84: ...hold and run current after the rst step pulse the module automatically switches over to run current and a con gurable time af ter the last step pulse the module auto matically switches back to hold c...

Page 85: ...anging these parameters and use the appropriate func tions of the TMCL IDE to do it in an interactive way Some con gurations of the interface for example baud rates that are not supported by the PC ma...

Page 86: ...p and no further command is received by the module the motor will be stopped Setting this parameter to 0 de fault turns off the serial heartbeat function 0 65535 RWA 75 Telegram pause time Pause time...

Page 87: ...variables are restored default 1 user variables are not restored 0 1 RWA 87 Serial secondary address Second module target address for RS485 Setting this parameter to 0 switches off the secondary addre...

Page 88: ...to 256 user variables are available Please see table 16 for an explanation of the different parameter access types User Variables in Bank 2 Number Global Parameter Description Range Units Access 0 55...

Page 89: ...0 off 1 low high 2 high low 3 both 0 3 RW 39 Input 0 trigger transition 0 off 1 low high 2 high low 3 both 0 3 RW 40 Input 1 trigger transition 0 off 1 low high 2 high low 3 both 0 3 RW 41 Input 2 tr...

Page 90: ...an integrated sensOstep encoder This built in encoder has a resolution of 1024 steps per rotation Please consider the following hints when using the built in encoder The encoder counter can be read by...

Page 91: ...0 400 2 SAP 140 0 1 0 390625 SAP 210 0 200 Table 20 Internal Encoder Settings Other encoder prescalers than those shown in table 20 can also be used but are mostly not needed for the internal encoder...

Page 92: ...rection setting the reference point to the center of the two switching points The speed used for this calibration is de ned by axis parameter 195 Axis parameter 193 de nes the reference search mode to...

Page 93: ...de number i e set axis parameter 193 to 66 to search the left end switch rst and then use the right end switch as the zero point left limit end stop switch L R right limit end stop switch start stop r...

Page 94: ...e number i e set axis parameter 193 to 68 to search the right end switch instead left limit end stop switch L R stop reference search speed axis parameter 194 reference switch speed axis parameter 195...

Page 95: ...ity of the home switch input L R right limit end stop switch reference search speed axis parameter 194 reference switch speed axis parameter 195 start stop home switch Figure 8 Reference search Mode 6...

Page 96: ...is recommende mainly for use with a circular axis The exact middle of the switch will be found and used as the zero point Figure 10 illustrates this Add 128 to the mode number i e set axis parameter 1...

Page 97: ...goes to zero This corresponds to a load angle of 90 between the magnetic eld of the stator and magnets in the rotor This also is the most energy e cient point of operation for the motor Stall detecti...

Page 98: ...urrent in the coolStep area depending on the load has to be con gured using parameters I169 and I171 In this chapter only basic axis parameters are mentioned which concern coolStep and stallGuard2 The...

Page 99: ...tallGuard2 measurements per decrement Scaling 0 3 32 8 2 1 0 slow decrement 3 fast decrement I171 smartEnergy current up step Sets the current increment step The current becomes incremented for each m...

Page 100: ...alone TMCL programs look like this 1 Initialization SAP 4 0 50000 define maximum positioning speed 3 SAP 5 0 10000 define maximum acceleration 5 MainLoop do something in this example just running betw...

Page 101: ...red in the EEPROM back to the user variable Global parameter 85 controls if user variables will be restored from the EEPROM automatically on startup default setting or not user variables will then be...

Page 102: ...les The host can then change the value of a user variable using a direct mode SGP command which is regularly polled by the TMCL program e g in its main loop and so the TMCL program can react on such c...

Page 103: ...cally For stand alone operation the module has to start the TMCL program in its memory automatically after power on In order to achieve this switch on the Autostart option of the module This is contro...

Page 104: ...arch Mode 1 93 4 Reference search Mode 2 93 5 Reference search Mode 3 94 6 Reference search Mode 4 94 7 Reference search Mode 5 95 8 Reference search Mode 6 95 9 Reference search Mode 7 96 10 Referenc...

Page 105: ...21 13 TMCL Control Commands 75 14 Meaning of the Letters in the Access Column 76 15 All Axis Parameters of the TMCM 1021 Module 84 16 Meaning of the Letters in the Access Column 85 17 All Global Param...

Page 106: ...for the rst time in the document All trademarks and brand names used are property of their respective owners 11 4 Target User The documentation provided here is for programmers and engineers only who...

Page 107: ...RINAMIC s speci c written consent TRINAMIC products are not designed nor intended for use in military or aerospace applications or environ ments or in automotive applications unless speci cally design...

Page 108: ...1021 V1 26 2013 AUG 30 OK Clock frequency raised to 16MHz V1 27 2013 AUG 30 OK Problem with magnetic encoder xed V1 28 2013 SEP 27 OK No changes related to the TMCM PD 1021 V1 29 2014 JAN 20 OK First...

Page 109: ...1 08 2017 MAR 21 OK Document completely revised V1 07 2017 SEP 21 OK Axis parameter 3 corrected V1 10 2018 JAN 09 OK Typo in description of axis parameter 204 corrected Table 24 Document Revision 2018...

Reviews: