MODULE FOR STEPPER MOTORS MODULE Firmware Version V1.19 TMCL™ FIRMWARE MANUAL + + TMCM-1140 1-Axis Stepper Controller / Driver 2 A / 24 V sensOstep™ Encoder USB, RS485, and CAN + UNIQUE FEATURES: TRINAMIC Motion Control GmbH & Co. KG Hamburg, Germany www.trinamic.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) Table of Contents 1 2 Features........................................................................................................................................................................... 4 Putting the Module into Operation ........................................................................................................................ 6 2.1 Basic Set-Up .....................................................................
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 3.6.36 Customer Specific TMCL Command Extension (UF0… UF7 / User Function) ............................... 60 3.6.37 Request Target Position Reached Event ............................................................................................... 60 3.6.38 TMCL Control Functions ............................................................................................................................. 61 4 Axis Parameters ..................
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 4 1 Features The TMCM-1140 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. The module can be mounted on the back of NEMA 17 (42mm flange size) stepper motors and has been designed for coil currents up to 2 A RMS and 24 V DC supply voltage.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 5 TRINAMICS UNIQUE FEATURES – EASY TO USE WITH TMCL stallGuard2™ stallGuard2 is a high-precision sensorless load measurement using the back EMF on the coils. It can be used for stall detection as well as other uses at loads below those which stall the motor. The stallGuard2 measurement value changes linearly over a wide range of load, velocity, and current settings. At maximum motor load, the value goes to zero or near to zero.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 6 2 Putting the Module into Operation Here you can find basic information for putting your TMCM-1140 into operation. If you are already common with TRINAMICs modules you may skip this chapter.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 1. 7 Connect power supply and choose your interface a) Connect CAN or RS485 and power supply CAN interface will be de-activated in case USB is connected due to internal sharing of hardware resources. Pin 1 2 3 4 5 6 Label GND VDD RS485+ RS485CAN_H CAN_L Description System and signal ground VDD (+9V…+28V) RS485 interface, diff. signal (non-inverting) RS485 interface, diff. signal (inverting) CAN interface, diff.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 4. Switch ON the power supply Turn power ON. The green LED for power lights up and the motor is powered but in standstill now. If this does not occur, switch power OFF and check your connections as well as the power supply. 2.1.1 Start the TMCL-IDE Software Development Environment The TMCL-IDE is available on www.trinamic.com. Installing the TMCL-IDE: Make sure the COM port you intend to use is not blocked by another program.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 9 2.2 Using TMCL Direct Mode 1. Start TMCL Direct Mode. Direct Mode 2. If the communication is established the TMCM-1140 is automatically detected. If the module is not detected, please check all points above (cables, interface, power supply, COM port, baud rate). 3. Issue a command by choosing Instruction, Type (if necessary), Motor, and Value and click Execute to send it to the module.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 2.2.1 10 Important Motor Settings There are some axis parameters which have to be adjusted right in the beginning after installing your module. Please set the upper limiting values for the speed (axis parameter 4), the acceleration (axis parameter 5), and the current (axis parameter 6). Further set the standby current (axis parameter 7) and choose your microstep resolution with axis parameter 140.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 2.3 Testing with a Simple TMCL Program Type in the following program: Loop: ROL 0, 500 WAIT TICKS, 0, 500 MST 0 ROR 0, 500 WAIT TICKS, 0, 500 MST 0 //Rotate motor 0 with speed 10000 SAP 4, 0, 500 SAP 5, 0, 50 MVP ABS, 0, 10000 WAIT POS, 0, 0 MVP ABS, 0, -10000 WAIT POS, 0, 0 JA Loop //Set max. Velocity //Set max.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 12 3 TMCL and the TMCL-IDE: Introduction As with most TRINAMIC modules the software running on the microprocessor of the TMCM-1140 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-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 3.1.1 13 Checksum Calculation As mentioned above, the checksum is calculated by adding up all bytes (including the module address byte) using 8-bit addition.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 3.2.1 14 Status Codes The reply contains a status code. The status code can have one of the following values: Code 100 101 1 2 3 4 5 6 Meaning Successfully executed, no error Command loaded into TMCL program EEPROM Wrong checksum Invalid command Wrong type Invalid value Configuration EEPROM locked Command not available 3.3 Standalone Applications The module is equipped with a TMCL memory for storing TMCL applications.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 15 3.4 TMCL Command Overview In this section a short overview of the TMCL commands is given. 3.4.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 3.4.2 16 Commands Listed According to Subject Area 3.4.2.1 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. Mnemonic ROL ROR MVP MST RFS SCO CCO GCO Command number 2 1 4 3 13 30 32 31 Meaning Rotate left Rotate right Move to position Motor stop Reference search Store coordinate Capture coordinate Get coordinate 3.4.2.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 17 3.4.2.5 Calculation Commands These 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.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 3.4.2.6.3 18 Interrupt Vectors The following table shows all interrupt vectors that can be used. Interrupt number 0 1 2 3 15 21 27 28 39 40 255 3.4.2.6.4 Interrupt type Timer 0 Timer 1 Timer 2 (Target) position reached Stall (stallGuard2) Deviation Stop left Stop right IN_0 change IN_1 change Global interrupts Further Configuration of Interrupts Some interrupts need further configuration (e.g. the timer interval of a timer interrupt).
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 19 In the example above, the interrupt numbers are used directly. To make the program better readable use the provided include file Interrupts.inc. This file defines symbolic constants 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.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 20 3.5 The ASCII Interface There is also an ASCII interface that can be used to communicate with the module and to send some commands as text strings. THE FOLLOWING COMMANDS CAN BE USED IN ASCII MODE: ROL, ROR, MST, MVP, SAP, GAP, STAP, RSAP, SGP, GGP, STGP, RSGP, RFS, SIO, GIO, SCO, GCO, CCO, UF0, UF1, UF2, UF3, UF4, UF5, UF6, and UF7.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 21 3.5.3 Configuring the ASCII Interface The module can be configured so that it starts up either in binary mode or in ASCII mode. Global parameter 67 is used for this purpose (please see also chapter 5.1). Bit 0 determines the startup mode: if this bit is set, the module starts up in ASCII mode, else it will start up in binary mode (default). Bit 4 and Bit 5 determine how the characters that are entered are echoed back.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 22 3.6 Commands 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) With this command the motor will be instructed to rotate with a specified velocity in right direction (increasing the position counter). Internal function: First, velocity mode is selected. Then, the velocity value is transferred to axis parameter #0 (target velocity).
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 3.6.2 23 ROL (rotate left) With this command the motor will be instructed to rotate with a specified velocity (opposite direction compared to ROR, decreasing the position counter). Internal function: First, velocity mode is selected. Then, the velocity value is transferred to axis parameter #0 (target velocity). The module is based on the TMC429 stepper motor controller and the TMC262 power driver.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 3.6.3 24 MST (motor stop) With this command the motor will be instructed to stop with a soft stop. Internal function: The axis parameter target velocity is set to zero. Related commands: ROL, ROR, SAP, GAP Mnemonic: MST 0 Binary representation: INSTRUCTION NO.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 3.6.4 25 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-1140 TMCL Firmware V1.19 Manual (Rev. 1.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 3.6.5 27 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. Please use command STAP (store axis parameter) in order to store any setting permanently. For a table with parameters and values which can be used together with this command please refer to chapter 4.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 3.6.6 28 GAP (get axis parameter) Most parameters of the TMCM-1140 can be adjusted individually for the axis. With this 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 conditioned jumps). In direct mode the value read is only output in the value field of the reply (without affecting the accumulator).
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 3.6.7 29 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 (refer to axis parameter list in chapter 4). For a table with parameters and values which can be used together with this command please refer to chapter 4.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 3.6.8 30 RSAP (restore axis parameter) For all configuration-related axis parameters non-volatile memory locations are provided. By default, most parameters are automatically restored after power up (refer to axis parameter list in chapter 4). A single parameter that has been changed before can be reset by this instruction also. For a table with parameters and values which can be used together with this command please refer to chapter 4.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 3.6.9 31 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-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 32 3.6.10 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, only bank 0 and 1 are used for global parameters, and bank 2 is used for user variables.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 33 3.6.11 STGP (store global parameter) This command is used to store TMCL user variables permanently in the EEPROM of the module. Some global parameters are located in RAM memory, so without storing modifications are lost at power down. This instruction enables enduring storing. Most parameters are automatically restored after power up.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 34 3.6.12 RSGP (restore global parameter) With this command the contents of a TMCL user variable can be restored from the EEPROM. By default, most parameters are automatically restored after power up. A single parameter that has been changed before can be reset by this instruction. Internal function: the specified parameter is copied from the configuration EEPROM memory to its RAM location.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 35 3.6.13 RFS (reference search) The TMCM-1140 has a built-in reference search algorithm which can be used. The reference search algorithm provides switching point calibration and three switch modes. The status of the reference search can also be queried to see if it has already finished. (In a TMCL program it is better to use the WAIT command to wait for the end of a reference search.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 36 3.6.14 SIO (set input / output) - SIO sets the status of the general digital output either to low (0) or to high (1). Bank 2 is used for this purpose. SIO is used to switch the pull-up resistors for all digital inputs ON (1) and OFF (0). Bank 0 is used for this purpose. Internal function: the passed value is transferred to the specified output line.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 37 ADDRESSING BOTH OUTPUT LINES WITH ONE SIO COMMAND: - Set the type parameter to 255 and the bank parameter to 2. The value parameter must then be set to a value between 0… 255, where every bit represents one output line. Furthermore, the value can also be set to -1. In this special case, the contents of the lower 8 bits of the accumulator are copied to the output pins. Example: Set all output pins high.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 38 3.6.15 GIO (get input /output) With this command the status of the two available general purpose inputs of the module can be read out. The function reads a digital or analogue input port. Digital lines will read 0 and 1, while the ADC channels deliver their 12 bit result in the range of 0… 4095.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 39 Multipurpose I/O 8 1 Figure 3.2 I/O connector 3.6.15.1 I/O Bank 0 – Digital Inputs: The ADIN lines can be read as digital or analogue inputs at the same time. The analogue values can be accessed in bank 1. Pin 6 7 8 I/O port IN_0 IN_1 IN_2 Command GIO 0, 0 GIO 1, 0 GIO 2, 0 Range 0/1 0/1 0/1 READING ALL DIGITAL INPUTS WITH ONE GIO COMMAND: - Set the type parameter to 255 and the bank parameter to 0.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 40 3.6.16 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-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 41 3.6.17 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. The host address and the reply are only used to take the instruction to the TMCL program memory while the program loads down. It does not make sense to use this command in direct mode.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 42 3.6.18 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 function is for standalone operation only. The host address and the reply are only used to take the instruction to the TMCL program memory while the program loads down.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 43 3.6.19 JA (jump always) Jump to a fixed address in the TMCL program memory. This command is intended for standalone operation only. The host address and the reply are only used to take the instruction to the TMCL program memory while the program loads down. This command cannot be used in direct mode. Internal function: the TMCL program counter is set to the passed value.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 44 3.6.20 CSUB (call subroutine) This function calls a subroutine in the TMCL program memory. It is intended for standalone operation only. The host address and the reply are only used to take the instruction to the TMCL program memory while the program loads down. This command cannot be used in direct mode. Internal function: The actual TMCL program counter value is saved to an internal stack, afterwards overwritten with the passed value.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 45 3.6.21 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. The host address and the reply are only used to take the instruction to the TMCL program memory while the program loads down. This command cannot be used in direct mode. Internal function: The TMCL program counter is set to the last value of the stack.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 46 3.6.22 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. The host address and the reply are only used to take the instruction to the TMCL program memory while the program loads down. This command cannot be used in direct mode.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 47 3.6.23 STOP (stop TMCL program execution) This function stops executing a TMCL program. The host address and the reply are only used to transfer the instruction to the TMCL program memory. This command should be placed at the end of every standalone TMCL program. It is not to be used in direct mode. Internal function: TMCL instruction fetching is stopped. Related commands: none Mnemonic: STOP Binary representation: INSTRUCTION NO.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 48 3.6.24 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-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 49 3.6.25 GCO (get coordinate) This command makes possible to read out a previously stored coordinate. In standalone mode the requested value is copied to the accumulator register for further processing purposes such as conditioned jumps. In direct mode, the value is only output in the value field of the reply, without affecting the accumulator.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 50 3.6.26 CCO (capture coordinate) The actual position of the axis is copied 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). Please see the SCO and GCO commands on how to copy coordinates between RAM and EEPROM.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 51 3.6.27 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). Please note also that the coordinate number 0 is always stored in RAM only.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 52 3.6.28 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.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 53 3.6.29 AAP (accumulator 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. For a table with parameters and values which can be used together with this command please refer to chapter 4.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 54 3.6.30 AGP (accumulator 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. Note: The global parameters in bank 0 are EEPROM-only and thus should not be modified automatically by a standalone application.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 55 3.6.31 CLE (clear error flags) This command clears the internal error flags. It is intended for use in standalone mode only and must not be used in direct mode. The - following error flags can be cleared by this command (determined by the parameter): ALL: clear all error flags. ETO: clear the timeout flag.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 56 3.6.32 VECT (set interrupt vector) The VECT command defines an interrupt vector. It needs an interrupt number and a label as parameter (like in JA, JC and CSUB commands). This label must be the entry point of the interrupt handling routine. Related commands: EI, DI, RETI Mnemonic: VECT ,
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 57 3.6.33 EI (enable interrupt) The EI command enables an interrupt. It needs the interrupt number as parameter. Interrupt number 255 globally enables interrupts. Related command: DI, VECT, RETI Mnemonic: EI Binary representation: INSTRUCTION NO.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 58 3.6.34 DI (disable interrupt) The DI command disables an interrupt. It needs the interrupt number as parameter. Interrupt number 255 globally disables interrupts. Related command: EI, VECT, RETI Mnemonic: DI Binary representation: INSTRUCTION NO.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 59 3.6.35 RETI (return from interrupt) This command terminates the interrupt handling routine, and the normal program execution continues. At the end of an interrupt handling routine the RETI command must be executed. Internal function: the 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.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 60 3.6.36 Customer Specific TMCL Command Extension (UF0… UF7 / User Function) The user definable functions UF0… UF7 are predefined, functions without topic for user specific purposes. Contact TRINAMIC for the customer specific programming of these functions. Internal function: Call user specific functions implemented in C by TRINAMIC. Related commands: none Mnemonic: UF0… UF7 Binary representation: INSTRUCTION NO.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 61 3.6.38 TMCL Control Functions The following functions are for host control purposes only and are not allowed for standalone mode. In most cases, there is no need for the customer to use one of those functions (except command 139). TMCL control commands have no mnemonics, as they cannot be used in TMCL programs. These Functions are to be used only by the TMCL-IDE (e.g. to download a TMCL application into the module).
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 62 SPECIAL REPLY FORMAT OF COMMAND 136: Type set to 0 - reply as a string: Byte index 1 2… 9 - Contents Host Address Version string (8 characters, e.g. 1140V1.17) There is no checksum in this reply format! To get also the last byte when using the CAN bus interface, just send this command in an eight byte frame instead of a seven byte frame. Then, eight bytes will be sent back, so you will get all characters of the version string.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 63 4 Axis Parameters The following sections describe all axis parameters that can be used with the SAP, GAP, AAP, STAP and RSAP commands. MEANING OF THE LETTERS IN COLUMN ACCESS: Access type R W E Related command(s) GAP SAP, AAP STAP, RSAP Description Parameter readable Parameter writable Parameter automatically restored from EEPROM after reset or power-on.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) Number 6 Axis Parameter Absolute max. current (CS / Current Scale) 64 Description Range [Unit] The maximum value is 255. This value means 0… 255 100% of the maximum current of the module. The current adjustment is within the range 0… 255 and can be adjusted in 32 steps.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) Number 140 Axis Parameter Microstep resolution 149 Soft stop flag 153 Ramp divisor 154 Pulse divisor 160 Step interpolation enable 162 Chopper blank time 163 Chopper mode 164 Chopper hysteresis decrement 165 Chopper hysteresis end 166 Chopper hysteresis start www.trinamic.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) Number 167 Axis Parameter Description Range [Unit] Chopper off time The off time setting controls the minimum 0 / 2… 15 chopper frequency. An off time within the range of 5µs to 20µs will fit. 66 Acc. RW Off time setting for constant tOff chopper: NCLK= 12 + 32*tOFF (Minimum is 64 clocks) 168 169 Setting this parameter to zero completely disables all driver transistors and the motor can free-wheel.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) Number 174 Axis Parameter stallGuard2™ threshold 175 Slope control high side 176 Slope control low side 177 short protection disable 178 Short detection timer 179 Vsense 180 smartEnergy actual current Description This signed value controls stallGuard2™ threshold level for stall output and sets the optimum measurement range for readout. A lower value gives a higher sensitivity. Zero is the starting value.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) Number 193 Axis Parameter Description Range [Unit] Ref.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 70 4.1 stallGuard2 The module is equipped with TMC262 motor driver chip. The TMC262 features load measurement that 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. At maximum motor load the stallGuard2 value goes to zero.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) COOLSTEP RELATED 71 AXIS PARAMETERS smartEnergy is an earlier name for coolStep. Number I6 I7 I168 I169 I171 I183 Axis parameter Description 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… Absolute max. current (CS / 255 divided by eight; e.g. step 0 = 0… 7, step 1 = 8… 15 and so Current Scale) on).
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 72 5 Global Parameters GLOBAL PARAMETERS ARE GROUPED INTO 4 BANKS: - bank bank bank bank 0 1 2 3 (global configuration of the module) (user C variables) (user TMCL variables) (interrupt configuration) Please use SGP and GGP commands to write and read global parameters. 5.1 Bank 0 Parameters with numbers from 64 on configure stuff like the serial address of the module RS485 baud rate or the CAN bit rate.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) Number 69 Parameter CAN bit rate 70 CAN reply ID 71 CAN ID 73 Configuration EEPROM lock flag 75 Telegram pause time 76 Serial host address Auto start mode 77 79 81 83 128 End switch polarity TMCL code protection CAN secondary address TMCL application status 129 Download mode 130 132 TMCL program counter Tick timer 133 Random number www.trinamic.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 74 5.2 Bank 1 The global parameter bank 1 is normally not available. It may be used for customer specific extensions of the firmware. Together with user definable commands these variables form the interface between extensions of the firmware (written in C) and TMCL applications. 5.3 Bank 2 Bank 2 contains general purpose 32 bit variables for the use in TMCL applications.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 75 5.4 Bank 3 Bank 3 contains interrupt parameters. Some interrupts need configuration (e.g. the timer interval of a timer interrupt). This can be done using the SGP commands with parameter bank 3 (SGP , 3, ). The parameter number defines the priority of an interrupt. Interrupts with a lower number have a higher priority.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 76 6 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 point search algorithm or the incremental sensOstep encoder. 6.1 Reference Search The built-in reference search features switching point calibration and support of one or two reference switches.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) SAP 193, 0, 1 negative limit switch Search left stop switch only. SAP 193, 0, 2 negative limit switch positive limit switch Search right stop switch, then search left stop switch. SAP 193, 0, 3 negative limit switch positive limit switch Search right stop switch, then search left stop switch from both sides. SAP 193, 0, 4 negative limit switch Search left stop switch from both sides. www.trinamic.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) SAP 193, 0, 5 negative limit switch positive limit switch home switch Search home switch in negative direction, reverse the direction when left stop switch reached. SAP 193, 0, 6 negative limit switch positive limit switch home switch Search home switch in positive direction, reverse the direction when right stop switch reached. SAP 193, 0, 7 home switch Search home switch in positive direction, ignore end switches.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 79 6.2 Changing the Prescaler Value of an Encoder The TMCM-1140 module offers the integrated sensOstep encoder. The built-in encoder has 1024 steps/rotation. Note: This hint about selecting a prescaler value is valid for the internal sensOstep encoder and for external encoders, if their resolution is 1024 steps/rotation. For different encoder resolutions new values have to be identified.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 80 6.3 Using the RS485 Interface With most RS485 converters that can be attached to the COM port of a PC the data direction is controlled by the RTS pin of the COM port. Please note that this will only work with Windows 2000, Windows XP or Windows NT4, not with Windows 95, Windows 98 or Windows ME (due to a bug in these operating systems). Another problem is that Windows 2000/XP/NT4 switches the direction back to receive too late.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 81 7 TMCL Programming Techniques and Structure 7.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. 7.2 Main Loop Embedded systems normally use a main loop that runs infinitely. This is also the case in a TMCL application that is running stand alone.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 82 Just 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. 7.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 83 7.6 Mixing Direct Mode and Standalone Mode Direct mode and standalone mode can also be mixed. When a TMCL program is being executed in standalone mode, direct mode commands are also processed (and they do not disturb the flow of the program running in standalone mode). So, it is also possible to query e.g. the actual position of the motor in direct mode while a TMCL program is running.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 8 Life Support Policy TRINAMIC Motion Control GmbH & Co. KG does not authorize or warrant any of its products for use in life support systems, without the specific written consent of TRINAMIC Motion Control GmbH & Co. KG.
TMCM-1140 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 9 Revision History 9.1 Firmware Revision Version 1.18 Date 2012-MAY-06 Description Release 9.2 Document Revision Author Version Date 1.00 2012-JUN-20 SD 1.