MODULE Module for Stepper TMCM-1240 TMCL™ Firmware Manual Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 The TMCM-1240 is a single axis controller/driver module for 2-phase bipolar stepper motors. The TMCM-1240 TMCL firmware allows to control the module using TMCL™ commands, supporting standalone operation as well as direct mode control, making use of the Trinamic TMC5160 motion controller and motor driver.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 2 / 132 Contents 1 Features 1.1 stallGuard2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 coolStep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 sixPoint Motion Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 6 6 7 2 First Steps with TMCL 2.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.26 3.6.27 3.6.28 3.6.29 3.6.30 3.6.31 3.6.32 3.6.33 3.6.34 3.6.35 3.6.36 3.6.37 3.6.38 3.6.39 3.6.40 3.6.41 3.6.42 3.6.43 3.6.44 3.6.45 3.6.46 3.6.47 3.6.48 3.6.49 3.6.50 3.6.51 3 / 132 CALCX (Calculate using the X Register) . . . . . . . . . . . . . . . . . . . . AAP (Accu to Axis Parameter) . . . . . . . . . . . . . . . . . . . . . . . . . AGP (Accu to Global Parameter) . . . . . . . . . . . . . . . . .
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 8 TMCL Programming Techniques and Structure 8.1 Initialization . . . . . . . . . . . . . . . . . . . . . 8.2 Main Loop . . . . . . . . . . . . . . . . . . . . . . 8.3 Using Symbolic Constants . . . . . . . . . . . . . 8.4 Using Variables . . . . . . . . . . . . . . . . . . . 8.5 Using Subroutines . . . . . . . . . . . . . . . . . 8.6 Combining Direct Mode and Standalone Mode 8.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 1 5 / 132 Features The TMCM-1240 is a single axis controller/driver module for 2-phase bipolar stepper motors with state of the art feature set. It is highly integrated, offers a convenient handling and can be used in many decentralized applications.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 6 / 132 Electrical data • Supply voltage: +24V DC nominal (10. . . 30V DC supply range). • Motor current: up to 2A RMS / 2.8A peak (programmable). Please see also the separate Hardware Manual. 1.1 stallGuard2 stallGuard2 is a high-precision sensorless load measurement using the back EMF of the coils. It can be used for stall detection as well as other uses at loads below those which stall the motor.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 0,9 7 / 132 Efficiency with coolStep 0,8 Efficiency with 50v torque reserve 0,7 0,6 0,5 Efficiency 0,4 0,3 0,2 0,1 0 0 50 100 150 200 250 300 350 Velocity [RPM] Figure 2: Energy Efficiency Example with coolStep 1.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 2 8 / 132 First Steps with TMCL In this chapter you can find some hints for your first steps with the TMCM-1240 and TMCL. You may skip this chapter if you are already familiar with TMCL and the TMCL-IDE. Things that you will need • Your TMCM-1240 module. • A USB cable. • A power supply (24V DC) for your TMCM-1240 module. • The TMCL-IDE 3.x already installed on your PC. • A two-phase bipolar stepper motor. 2.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 9 / 132 Most important axis parameters Number Axis Parameter Description Range [Units] Access 4 Maximum positioning speed The maximum speed used for positioning ramps. 0. . . 7999774 [pps] RW 5 Maximum acceleration Maximum acceleration in positioning ramps. Acceleration and deceleration value in velocity mode. 0. . .
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 10 / 132 7 9 11 13 15 SAP 4 , 0 , 51200 SAP 5 , 0 , 51200 Loop : MVP ABS , 0 , 512000 WAIT POS , 0 , 0 MVP ABS , 0 , -512000 WAIT POS , 0 , 0 JA Loop // Set max . Velocity // Set max . Acceleration // Move to Position 512000 // Wait until position reached // Move to Position -512000 // Wait until position reached // Infinite Loop After you have done that, take the following steps: 1.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3 11 / 132 TMCL and the TMCL-IDE — An Introduction As with most TRINAMIC modules the software running on the microprocessor of the TMCM-1240 consists of two parts, a boot loader and the firmware itself. Whereas the boot loader is installed during production and testing at TRINAMIC and remains untouched throughout the whole lifetime, the firmware can be updated by the user.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 12 / 132 TMCL Command Format Bytes Meaning 1 Module address 1 Command number 1 Type number 1 Motor or Bank number 4 Value (MSB first!) 1 Checksum Table 2: TMCL Command Format Info Note 3.1.1 The checksum is calculated by accumulating all the other bytes using an 8-bit addition. When using the CAN interface, leave out the address byte and the checksum byte.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.2 13 / 132 Reply Format Every time a command has been sent to a module, the module sends a reply. The reply format with RS-232, RS-485, RS-422 and USB is as follows: TMCL Reply Format Bytes Meaning 1 Reply address 1 Module address 1 Status (e.g.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.3 14 / 132 Standalone Applications The module is equipped with a TMCL memory for storing TMCL applications. You can use the TMCL-IDE for developing standalone TMCL applications. You can download a program 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.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.4 15 / 132 TMCL Command Overview This sections gives a short overview of all TMCL commands.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 Command Number AIV 57 Parameter 17 / 132 Description Accumulator to indexed variable Table 5: Overview of all TMCL Commands 3.5 3.5.1 TMCL Commands by Subject Motion Commands These commands control the motion of the motor. They are the most important commands and can be used in direct mode or in standalone mode.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.5.3 18 / 132 Branch Commands These commands are used to control the program flow (loops, conditions, jumps etc.). Using them in direct mode does not make sense. They are intended for standalone mode only.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 20 / 132 Interrupt Vectors Interrupt number Interrupt type 0 Timer 0 1 Timer 1 2 Timer 2 3 Target position reached 0 15 stallGuard axis 0 21 Deviation axis 0 27 Left stop switch 0 28 Right stop switch 0 39 Input change 0 40 Input change 1 41 Input change 2 255 Global interrupts Table 12: Interrupt Vectors 3.5.6.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6 23 / 132 Detailed TMCL Command Descriptions The module specific commands are explained in more detail on the following pages. They are listed according to their command number. 3.6.1 ROR (Rotate Right) The motor is instructed to rotate with a specified velocity in right direction (increasing the position counter). The velocity is given in microsteps per second (pulse per second [pps]).
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.2 24 / 132 ROL (Rotate Left) The motor is instructed to rotate with a specified velocity in left direction (decreasing the position counter). The velocity is given in microsteps per second (pulse per second [pps]). 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.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.3 25 / 132 MST (Motor Stop) The motor is instructed to stop with a soft stop. Internal function: The velocity mode is selected. Then, the target speed (axis parameter #0) is set to zero. Related commands: ROR, ROL, SAP, GAP. Mnemonic: MST 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.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.4 26 / 132 MVP (Move to Position) With this command the motor will be instructed to move to a specified relative or absolute position. It will use the acceleration/deceleration ramp and the positioning speed programmed into the unit. This command is non-blocking - that is, a reply will be sent immediately after command interpretation and initialization of the motion controller.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 Binary Form of MVP ABS, 0, 90000 Field Value Target address 01h Instruction number 04h Type 00h Motor/Bank 00h Value (Byte 3) 00h Value (Byte 2) 01h Value (Byte 1) 5Fh Value (Byte 0) 90h Checksum F5h Example Move motor 0 from current position 10000 steps backward.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 28 / 132 Binary Form of MVP COORD, 0, 8 Field Value Target address 01h Instruction number 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 or ACO command. ©2018 TRINAMIC Motion Control GmbH & Co.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.5 29 / 132 SAP (Set Axis Parameter) With this command most of the motion control parameters of the module can be specified. The settings will be stored in SRAM and therefore are volatile. That is, information will be lost after power off. For a table with parameters and values which can be used together with this command please refer to section 4.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.6 30 / 132 GAP (Get Axis Parameter) Most motion / driver related parameters of the TMCM-1240 can be adjusted using e.g. the SAP command. With the GAP parameter they can be read out. In standalone mode the requested value is also transferred to the accumulator register for further processing purposes (such as conditional jumps).
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.7 31 / 132 SGP (Set Global Parameter) With this command most of the module specific parameters not directly related to motion control can be specified and the TMCL user variables can be changed. Global parameters are related to the host interface, peripherals or application specific variables. The different groups of these parameters are organized in banks to allow a larger total number for future products.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.8 32 / 132 GGP (Get Global Parameter) All global parameters can be read with this function. Global parameters are related to the host interface, peripherals or application specific variables. The different groups of these parameters are organized in banks to allow a larger total number for future products. Currently, bank 0 is used for global parameters, and bank 2 is used for user variables.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.9 33 / 132 STGP (Store Global Parameter) This command is used to store TMCL global parameters permanently in the EEPROM of the module. This command is mainly needed to store the TMCL user variables (located in bank 2) in the EEPROM of the module, as most other global parameters (located in bank 0) are stored automatically when being modified.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.10 34 / 132 RSGP (Restore Global Parameter) With this command the contents of a TMCL user variable can be restored from the EEPROM. By default, all user variables are automatically restored after power up. A user variable that has been changed before can be reset to the stored value by this instruction.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.11 35 / 132 RFS (Reference Search) The TMCM-1240 has a built-in reference search algorithm. The reference search algorithm provides different refrence search modes. This command starts or stops the built-in reference search algorithm. The status of the reference search can also be queried to see if it already has finished.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 Binary Form of RFS START 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. KG, Hamburg, Germany Terms of delivery and rights to technical change reserved. Download newest version at www.trinamic.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.12 37 / 132 SIO (Set Output) This command sets the states of the general purpose digital outputs. Internal function: The state of the output line specified by the type parameter is set according to the value passed to this command. Related commands: GIO.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 38 / 132 Digital Outputs in Bank 2 Port Command Range OUT0 SIO 0, 2, 0/1 Pull-up Resistor Control The SIO command can also be used to program the pull-up resistors of the IN0, IN1 and IN2 inputs. The pull-up resistor of the IN0/HOME input can separately be switched on and off whereas the pull-up resistors of the IN1 and IN2 inputs can be switched on and off together.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.13 39 / 132 GIO (Get Input) With this command the status of the available general purpose outputs of the module can be read. The function reads a digital or an analog input port. Digital lines will read as 0 or 1, while the ADC channels deliver their 12 bit result in the range of 0. . . 4095.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 40 / 132 Reply (Status=no error, Value=302) Field Value Host address 02h Target address 01h Status 64h Instruction 0Fh Value (Byte 3) 00h Value (Byte 2) 00h Value (Byte 1) 01h Value (Byte 0) 2Eh Checksum A5h Bank 0 – Digital Inputs The analog input lines can be read as digital or analog inputs at the same time. The digital input states can be accessed in bank 0.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 Digital Outputs in Bank 2 Port Command Range OUT0 GIO 0, 2 0/1 ©2018 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany Terms of delivery and rights to technical change reserved. Download newest version at www.trinamic.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.14 42 / 132 CALC (Calculate) A value in the accumulator variable, previously read by a function such as GAP (get axis parameter) can be modified with this instruction. Nine different arithmetic functions can be chosen and one constant operand value must be specified. The result is written back to the accumulator, for further processing like comparisons or data transfer.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.15 44 / 132 COMP (Compare) The specified number is compared to the value in the accumulator register. The result of the comparison can for example be used by the conditional jump (JC) instruction. This command is intended for use in standalone operation only. Internal function: The accumulator register is compared with the sepcified value.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.16 45 / 132 JC (Jump conditional) The JC instruction enables a conditional jump to a fixed address in the TMCL program memory, if the specified condition is met. The conditions refer to the result of a preceding comparison. Please refer to COMP instruction for examples. This command is intended for standalone operation only.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 Binary form of JC GE, Label assuming Label 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 Control GmbH & Co. KG, Hamburg, Germany Terms of delivery and rights to technical change reserved. Download newest version at www.trinamic.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.17 47 / 132 JA (Jump always) Jump to a fixed address in the TMCL program memory. This command is intended for standalone operation only. Internal function: The TMCL program counter is set to the value passed to this command. Related commands: JC, WAIT, CSUB.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.18 48 / 132 CSUB (Call Subroutine) This function calls a subroutine in the TMCL program memory. It is intended for standalone operation only. Internal function: the actual TMCL program counter value is saved to an internal stack, afterwards overwritten with the passed value. The number of entries in the internal stack is limited to 8. This also limits nesting of subroutine calls to 8.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.19 49 / 132 RSUB (Return from Subroutine) Return from a subroutine to the command after the CSUB command. This command is intended for use in standalone mode only. Internal function: the TMCL program counter is set to the last value saved on the stack. The command will be ignored if the stack is empty. Related commands: CSUB.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.20 50 / 132 WAIT (Wait for an Event to occur) This instruction interrupts the execution of the TMCL program until the specified condition is met. This command is intended for standalone operation only. There are five different wait conditions that can be used: • TICKS: Wait until the number of timer ticks specified by the parameter has been reached.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 Wait for motor 0 to reach its target position, without timeout. Mnemonic: 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 1Dh ©2018 TRINAMIC Motion Control GmbH & Co.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.21 52 / 132 STOP (Stop TMCL Program Execution – End of TMCL Program) This command stops the execution of a TMCL program. It is intended for use in standalone operation only. Internal function: Execution of a TMCL program in standalone mode will be stopped. Related commands: none.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.22 53 / 132 SCO (Set Coordinate) Up to 20 position values (coordinates) can be stored for every axis for use with the MVP COORD command. This command sets a coordinate to a specified value. Depending on the global parameter 84, the coordinates are only stored in RAM or also stored in the EEPROM and copied back on startup (with the default setting the coordinates are stored in RAM only).
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.23 54 / 132 GCO (Get Coordinate) Using this command previously stored coordinate can be read back. In standalone mode the requested value is copied to the accumulator register for further processing purposes such as conditional jumps. In direct mode, the value is only output in the value field of the reply, without affecting the accumulator.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 55 / 132 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.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.24 56 / 132 CCO (Capture Coordinate) This command copies the actual position of the axis to the selected coordinate variable. Depending on the global parameter 84, the coordinates are only stored in RAM or also stored in the EEPROM and copied back on startup (with the default setting the coordinates are stored in RAM only).
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.25 57 / 132 ACO (Accu to Coordinate) With the ACO command the actual value of the accumulator is copied to a selected coordinate of the motor. Depending on the global parameter 84, the coordinates are only stored in RAM or also stored in the EEPROM and copied back on startup (with the default setting the coordinates are stored in RAM only). Note Coordinate #0 is always stored in RAM only.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.26 58 / 132 CALCX (Calculate using the X Register) This instruction is very similar to CALC, but the second operand comes from the X register. The X register can be loaded with the LOAD or the SWAP type of this instruction. The result is written back to the accumulator for further processing like comparisons or data transfer. This command is mainly intended for use in standalone mode.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 Binary Form of CALCX MUL 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. KG, Hamburg, Germany Terms of delivery and rights to technical change reserved. Download newest version at www.trinamic.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.27 60 / 132 AAP (Accu to Axis Parameter) The content of the accumulator register is transferred to the specified axis parameter. For practical usage, the accumulator has to be loaded e.g. by a preceding GAP instruction. The accumulator may have been modified by the CALC or CALCX (calculate) instruction. This command is mainly intended for use in standalone mode.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.28 61 / 132 AGP (Accu to Global Parameter) The content of the accumulator register is transferred to the specified global parameter. For practical usage, the accumulator has to be loaded e.g. by a preceding GAP instruction. The accumulator may have been modified by the CALC or CALCX (calculate) instruction. This command is mainly intended for use in standalone mode.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.29 CLE (Clear Error Flags) This command clears the internal error flags. It is mainly intended for use in standalone mode. The following error flags can be cleared by this command (determined by the <flag> parameter): • ALL: clear all error flags. • ETO: clear the timeout flag. • EAL: clear the external alarm flag. • EDV: clear the deviation flag. • EPO: clear the position error flag. Related commands: JC, WAIT.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 Binary Form of CLE ETO 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, Hamburg, Germany Terms of delivery and rights to technical change reserved. Download newest version at www.trinamic.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.30 64 / 132 EI (Enable Interrupt) The EI command enables an interrupt. It needs the interrupt number as parameter. Interrupt number 255 globally enables interrupt processing. This command is mainly intended for use in standalone mode. Please see table 12 for a list of interrupts that can be used on the TMCM-1240 module. Info Related commands: DI, VECT, RETI.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.31 65 / 132 DI (Disable Interrupt) The DI command disables an interrupt. It needs the interrupt number as parameter. Interrupt number 255 globally disables interrupt processing. This command is mainly intended for use in standalone mode. Please see table 12 for a list of interrupts that can be used on the TMCM-1240 module. Info Related commands: EI, VECT, RETI.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.32 66 / 132 VECT (Define Interrupt Vector) The VECT command defines an interrupt vector. It takes an interrupt number and a label (just like with JA, JC and CSUB commands) as parameters. The label must be the entry point of the interrupt handling routine for this interrupts. Interrupt vectors can also be re-defined. This command is intended for use in standalone mode only.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 Binary form of VECT (assuming label 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 GmbH & Co. KG, Hamburg, Germany Terms of delivery and rights to technical change reserved. Download newest version at www.trinamic.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.33 68 / 132 RETI (Return from Interrupt) This command terminates an interrupt handling routine. Normal program flow will be continued then. This command is intended for use in standalone mode only. An interrupt routine must always end with a RETI command. Do not allow the normal program flow to run into an interrupt routine.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.34 69 / 132 CALCVV (Calculate using two User Variables) The CALCVV instruction directly uses the contents of two user variables for an arithmetic operation, storing the result in the first user variable. This eliminates the need for using the accumulator register and/or X register for such purposes. The parameters of this command are the arithmetic function, the index of the first user variable (0. . .
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.35 71 / 132 CALCVA (Calculate using a User Variable and the Accumulator Register) The CALCVA instruction directly modifies a user variable using an arithmetical operation and the contents of the accumulator register. The parameters of this command are the arithmetic function and the index of a user variable (0. . . 255). This command is mainly intended for use in standalone mode.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.36 73 / 132 CALCAV (Calculate using the Accumulator Register and a User Variable) The CALCAV instruction modifies the accumulator register using an arithmetical operation and the contents of a user variable. The parameters of this command are the arithmetic function and the index of a user variable (0. . . 255). This command is mainly intended for use in standalone mode.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.37 75 / 132 CALCVX (Calculate using a User Variable and the X Register) The CALCVX instruction directly modifies a user variable using an arithmetical operation and the contents of the X register. The parameters of this command are the arithmetic function and the index of a user variable (0. . . 255). This command is mainly intended for use in standalone mode.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.38 77 / 132 CALCXV (Calculate using the X Register and a User Variable) The CALCXV instruction modifies the X register using an arithmetical operation and the contents of a user variable. The parameters of this command are the arithmetic function and the index of a user variable (0. . . 255). This command is mainly intended for use in standalone mode.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.39 79 / 132 CALCV (Calculate using a User Variable and a Direct Value) The CALCV directly modifies a user variable using an arithmetical operation and a direct value. This eliminates the need of using the accumulator register for such a purpose and thus can make the program shorter and faster. The parameters of this command are the arithmetic function, the index of a user variable (0. . .
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.40 81 / 132 RST (Restart) Stop the program, reset the TMCL interpreter and then re-start the program at the given label. This command can be used to re-start the TMCL program from anywhere in the program, also out of subroutines or interrupt rotuines. This command is intended for standalone operation only.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.41 82 / 132 DJNZ (Decrement and Jump if not Zero) Decrement a given user variable and jump to the given address if the user variable is greater than zero. This command can for example be used to easily program a counting loop, using any user variable as the loop counter. This command is intended for standalone operation only. Internal function: The user variable passed to this command is decremented.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.42 83 / 132 CALL (Conditional Subroutine Call) The CALL command calls a subroutine in the TMCL program, but only if the specifed condition is met. Otherwise the program execution will be continued with the next command following the CALL command. The conditions refer to the result of a preceding comparison or assignment. This command is intended for standalone operation only.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 14 16 RunRight : RORA 0 RSUB 18 20 22 24 MotorStop : GAP 2 , 0 JC ZE , MotorIsStopped MST 0 MotorIsStopped : RSUB Binary form of CALL LT, RunLeft (assuming RunLeft at address 100) Field Value Target address 01h Instruction number 50h Type 06h Motor/Bank 00h Value (Byte 3) 00h Value (Byte 2) 00h Value (Byte 1) 00h Value (Byte 0) 64h Checksum BBh ©2018 TRINAMIC Motion Control GmbH & Co.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.43 85 / 132 MVPA (Move to Position specified by Accumulator Register) With this command the motor will be instructed to move to a specified relative or absolute position. The contents of the accumulator register will be used as the target position. This command is non-blocking which means that a reply will be sent immediately after command interpretation and initialization of the motion controller.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 Binary Form of MVPA ABS, 0 Field Value Target address 01h Instruction number 2Eh Type 00h Motor/Bank 00h Value (Byte 3) 00h Value (Byte 2) 00h Value (Byte 1) 00h Value (Byte 0) 00h Checksum 2Fh ©2018 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany Terms of delivery and rights to technical change reserved. Download newest version at www.trinamic.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.44 87 / 132 ROLA (Rotate Left using the Accumulator Register) Rotate in left direction (decreasing the position counter) using the velocity specified by the contents of the accumulator register. The velocity is given in microsteps per second (pulse per second [pps]). Internal function: • First, velocity mode is selected.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.45 88 / 132 RORA (Rotate Right using the Accumulator Register) Rotate in right direction (increasing the position counter) using the velocity specified by the contents of the accumulator register. The velocity is given in microsteps per second (pulse per second [pps]). Internal function: • First, velocity mode is selected.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.46 89 / 132 SIV (Set Indexed Variable) This command copies a direct value to a TMCL user variable. The index of the user variable (0. . . 255) is specified by the content of the X register. Therefore the value in the X register must not be lower than zero or greater than 255. Otherwise this command will be ignored. This command is mainly intended for use in standalone mode.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.47 90 / 132 GIV (Get Indexed Variable) This command reads a TMCL user variable and copies its content to the accumulator register. The index of the user variable (0. . . 255) is specified by the X register. Therefore the content of the X register must not be lower than zero or greater than 255. Otherwise this command will be ignored. This command is mainly intended for use in standalone mode.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.48 91 / 132 AIV (Accumulator to Indexed Variable) This command copies the content of the accumulator to a TMCL user variable. The index of the user variable (0. . . 255) is specified by the content of the X register. Therefore the value in the X register must not be lower than zero or greater than 255. Otherwise this command will be ignored. This command is mainly intended for use in standalone mode.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.49 92 / 132 Customer specific Command Extensions (UF0. . . UF7 – User Functions) These commands are used for customer specific extensions of TMCL. They will be implemented in C by Trinamic. Please contact the sales department of Trinamic Motion Control GmbH & Co KG if you need a customized TMCL firmware. Related commands: none. Mnemonic: UF0. . .
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.50 93 / 132 Request Target Position reached Event This command is the only exception to the TMCL protocol, as it sends two replies: One immediately after the command has been executed (like all other commands also), and one additional reply that will be sent when the motor has reached its target position.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 3.6.51 95 / 132 TMCL Control Commands There is a set of TMCL commands which are called TMCL control commands. These commands can only be used in direct mode and not in a standalone program. For this reason they only have opcodes, but no mnemonics. Most of these commands are only used by the TMCL-IDE (in order to implement e.g. the debugging functions in the TMCL creator).
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 Instruction Description Type Value 135 – get application status Return information about the current status, depending on the type field. 0 - return mode, wait flag, memory pointer 1 - return mode, wait flag, program counter 2 - return accumulator 3 - return X register 0 (don’t care) 136 – get firmware version Return firmware version in string format (special reply) or binary format).
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 4 97 / 132 Axis Parameters Most motor controller features of the TMCM-1240 module are controlled by axis parameters. Axis parameters can be modified or read using SAP, GAP and AAP commands. This chapter describes all axis parameters that can be used on the TMCM-1240 module.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 98 / 132 Number Axis Parameter Description Range [Units] Access 6 Maximum current Motor current used when motor is running. The maximum value is 255 which means 100% of the maximum current of the module. The current can be adjusted in 32 steps: 0. . . 255 RW 0. . . 7 79. . . 87 160. . . 167 240. . . 247 8. . . 15 88. . . 95 168. . . 175 248. . . 255 16. . . 23 96. . . 103 176. . . 183 24.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 99 / 132 Number Axis Parameter Description Range [Units] Access 16 Velocity V1 First acceleration / decelaration phase target velocizy (in position mode only). Setting this value to 0 turns off the first acceleration / deceleration phase, maximum acceleration (axis parameter 5) and maximum decleration (axis parameter 17) are used only. 0. . .
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 100 / 132 Number Axis Parameter Description Range [Units] Access 31 Power down ramp Controls the number of clock cycles for motor power down after a motion as soon as the motor has stopped and the setting time has expired. The smooth transition avoids a motor jerk upon power down. 0=instant power down, 15=longest possible power down ramp. 0. . . 15 [0.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 101 / 132 Number Axis Parameter Description Range [Units] Access 162 Chopper blank time Selects the comparator blank time. This time needs to safely cover the switching event and the duration of the ringing on the sense resistor. Normally leave at the default value. 0..
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 102 / 132 Number Axis Parameter Description Range [Units] Access 170 smartEnergy hysteresis Sets the distance between the lower and the upper threshold for stallGuard2 reading. Above the upper threshold the motor current becomes decreased. Hysteresis: ([AP 172] + 1) ∗ 32 Upper stallGuard threshold: ([AP 172]+[AP 170]+ 1) ∗ 32 0. . .
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 103 / 132 Number Axis Parameter Description Range [Units] Access 185 Chopper synchronization This parameter allows synchronization of the chopper for both phases of a two phase motor in order to avoid the occurrence of a beat, especially at low velocities. 0: chopper sync function chopSync off 1. . . 15: chopper synchronization 0. . .
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 Number 193 Axis Parameter Reference search mode Description 1 Search left stop switch only. 2 Search right stop switch, then search left stop switch. 3 Search right stop switch, then search left stop switch from both sides. 4 Search left stop switch from both sides. 5 Search home switch in negative direction, reverse the direction when left stop switch reached.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 105 / 132 Number Axis Parameter Description Range [Units] Access 204 Freewheeling mode Stand still option when the standby current (parameter 7) is set to zero and stealthChop is active. 0 normal operation 0. . .
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 106 / 132 Number Axis Parameter Description Range [Units] 212 Maximum internal encoder deviation When the actual position (parameter #1) and the encoder position (parameter #209) differ more than set here the motor will be stopped. Setting this parameter to zero turns off this feature. Please see also 6.2. 0 RW . . .
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 5 107 / 132 Global Parameters The following sections describe all global parameters that can be used with the SGP, GGP, AGP, STGP and RSGP commands. Global parameters are grouped into banks: • Bank 0: Global configuration of the module. • Bank 1: Not used. • Bank 2: TMCL user variables. • Bank 3: TMCL interrupt configuration. 5.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 108 / 132 All Global Parameters of the TMCM-1240 Module in Bank 0 Number 65 Global Parameter RS485 baud rate Description 0 9600 1 14400 2 19200 3 28800 4 38400 5 57600 6 76800 7 115200 8 230400 Range [Units] Access 0. . . 8 RWA Default 66 Serial address Module (target) address for RS485. 1. . . 255 RWA 68 Serial heartbeat Serial heartbeat for RS485 interface and USB interface.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 109 / 132 Number Global Parameter Description Range [Units] Access 77 Auto start mode 0 - Do not start TMCL application after power up (default). 1 - Start TMCL application automatically after power up. 0/1 RWA 81 TMCL code protection Protect a TMCL program against disassembling or overwriting.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 110 / 132 Number Global Parameter Description Range [Units] Access 133 Random number Returns a random number. The seed value can be set by writing to this parameter. 0. . . 2147483647 RW 255 Suppress reply The reply in direct mode will be suppressed when this parameter is set to 1. This parameter cannot be stored to EEPROM and will be reset to 0 on startup.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 111 / 132 Number Global Parameter Description Range [Units] 1 Timer 1 period (ms) Time between two interrupts 0. . . 4294967295 RW [ms] 2 Timer 2 period (ms) Time between two interrupts 0. . . 4294967295 RW [ms] 27 Stop left 0 trigger transition 0=off, 1=low-high, 2=high-low, 3=both 0. . . 3 RW 28 Stop right 0 trigger transition 0=off, 1=low-high, 2=high-low, 3=both 0. . .
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 6 112 / 132 Module Specific Hints This section contains some hints that are specific to the TMCM-1240 module. 6.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 6.3 113 / 132 External Encoders External encoders with ABN interface can also be attached to the TMCM-1240 module. Please see the Hardware Manual on how to connect an external encoder. Consider the following things when using an external ABN encoder: • The encoder counter can be read by software and can be used to monitor the current position of the motor.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 7 114 / 132 Hints and Tips This chapter gives some hints and tips on using the functionality of TMCL, for example how to use and parameterize the built-in reference search algorithm. You will also find basic information about stallGuard2™ and coolStep™ in this chapter. 7.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 7.1.1 115 / 132 Mode 1 Reference search mode 1 only searches the left end switch. Select this mode by setting axis parameter #193 to 1. Figure 4 illustrates this. Add 64 to the mode number (i.e. set axis parameter #193 to 65) to search the right end switch instead of the left end switch.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 L 116 / 132 R start stop left limit / end / stop switch right limit / end / stop switch : reference search speed (axis parameter 194) : reference switch speed (axis parameter 195) Figure 6: Reference search Mode 3 7.1.4 Mode 4 Reference search mode 4 searches the left end switch only, but from both sides so that the middle of the switch will be found and used as the zero point. This is shown in figure 7.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 117 / 132 Home L R start stop left limit / end / stop switch home switch : reference search speed (axis parameter 194) : reference switch speed (axis parameter 195) Figure 8: Reference search Mode 5 7.1.6 Mode 6 Reference search mode 6 searches the home switch in positive direction. The search direction will be reversed if the right limit switch is reached. This is shown in figure 9.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 L 118 / 132 R start stop home switch : reference search speed (axis parameter 194) : reference switch speed (axis parameter 195) Figure 10: Reference search Mode 7 7.1.8 Mode 8 Reference search mode 8 searches the home switch in positive direction, ignoring the limit switch inputs. It is recommende mainly for use with a circular axis.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 7.2 119 / 132 stallGuard2 The module is equipped with motor driver chips that feature load measurement. This load measurement can be used for stall detection. stallGuard2 delivers a sensorless load measurement of the motor as well as a stall detection signal. The measured value changes linear with the load on the motor in a wide range of load, velocity and current settings.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 7.3 120 / 132 coolStep This section gives an overview of the coolStep related parameters. Please bear in mind that the figure only shows one example for a drive. There are parameters which concern the configuration of the current. Other parameters are there for velocity regulation and for time adjustment. Figure 12 shows all the adjustment points for coolStep.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 coolStep Adjustment Points and Thresholds Number Axis Parameter Description I6 Absolute maximum current The maximum value is 255. This value means 100% of the maximum current of the module. The current adjustment is within the range 0. . . 255 and can be adjusted in 32 steps (0. . . 255 divided by eight; e.g. step 0 = 0. . . 7, step 1 = 8. . . 15 and so on).
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 7.4 122 / 132 Velocity and Acceleration Calculation When the unit mode (axis parameter #255) is set to 1 (which is also the default value), all velocity parameters on the TMCM-1240 are given in microsteps per second (also called pulse per second or pps). Acceleration and deceleration units are given in pps2 . When axis parameter #255 is set to 0 the internal units of the ramp generators are directly used.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 7.5 123 / 132 sixPoint Ramp The TMCM-1240 is equipped with a motion controller that supports TRINAMIC’s sixPoint ramp technology. Please see also section 1.3 for more information about the sixPoint ramp.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 8 124 / 132 TMCL Programming Techniques and Structure 8.1 Initialization The first task in a TMCL program (like in other programs also) is to initialize all parameters where different values than the default values are necessary. For this purpose, SAP and SGP commands are used. 8.2 Main Loop Embedded systems normally use a main loop that runs infinitely.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 17 125 / 132 WAIT POS , Motor0 , 0 JA MainLoop Have a look at the file TMCLParam.tmc provided with the TMCL-IDE. It contains symbolic constants that define all important parameter numbers. Using constants for other values makes it easier to change them when they are used more than once in a program. You can change the definition of the constant and do not have to change all occurrences of it in your program. 8.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 8.5 126 / 132 Using Subroutines The CSUB and RSUB commands provide a mechanism for using subroutines. The CSUB command branches to the given label. When an RSUB command is executed the control goes back to the command that follows the CSUB command that called the subroutine. This mechanism can also be nested. From a subroutine called by a CSUB command other subroutines can be called.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 127 / 132 This example provides three very simple TMCL routines. They can be called from a host by issuing a run command with address 0 to call the first function, or a run command with address 1 to call the second function, or a run command with address 2 to call the third function.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 9 128 / 132 Figures Index 1 2 3 4 5 6 stallGuard2 Load Measurement as a Function of Load . . . . . . . . . . . . 6 Energy Efficiency Example with coolStep 7 Typical motion profile with TRINAMIC’s sixPoint motion controller . . . . . . . 7 Reference search Mode 1 . . . . . . . 115 Reference search Mode 2 . . . . . . . 115 Reference search Mode 3 . . . . . . . 116 ©2018 TRINAMIC Motion Control GmbH & Co.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 129 / 132 Tables Index Most important Axis Parameters . TMCL Command Format . . . . . . TMCL Reply Format . . . . . . . . . TMCL Status Codes . . . . . . . . . Overview of all TMCL Commands . Motion Commands . . . . . . . . . Parameter Commands . . . . . . . Branch Commands . . . . . . . . . I/O Port Commands . . . . . . . . Calculation Commands . . . . . .
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 11 130 / 132 Supplemental Directives 11.1 Producer Information 11.2 Copyright TRINAMIC owns the content of this user manual in its entirety, including but not limited to pictures, logos, trademarks, and resources. © Copyright 2018 TRINAMIC. All rights reserved. Electronically published by TRINAMIC, Germany.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 131 / 132 or of any other nature are made hereunder with respect to information/specification or the products to which information refers and no guarantee with respect to compliance to the intended use is given. In particular, this also applies to the stated possible applications or areas of applications of the product.
TMCM-1240 TMCL™ Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03 12 Revision History 12.1 Firmware Revision Version Date Author Description V1.43 2017-DEC-01 OK First release version. V1.44 Not deployed. V1.45 2018-DEC-03 OK Logic of axis parameters #10 and #11 inverted. New TMCL commands added. Support for hardware V1.2. Table 24: Firmware Revision 12.2 Document Revision Version Date Author Description V1.00 2017-DEC-01 OK First release version.