MODULE FOR BLDC MOTORS MODULE Firmware Version V2.00 TMCL™ FIRMWARE MANUAL + + TMCM-1640 1-Axis BLDC Controller / Driver Module 5A / 24 V Hall Sensor Interface Encoder Interface RS485 and USB Interface FOC Firmware + TRINAMIC Motion Control GmbH & Co. KG Hamburg, Germany www.trinamic.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) Table of Contents 1 2 3 Features ........................................................................................................................................................................... 4 Overview ......................................................................................................................................................................... 5 Putting the TMCM-1640 into Operation ......................
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 11 Revision History .......................................................................................................................................................... 56 11.1 Firmware Revision ............................................................................................................................................. 56 11.2 Document Revision ................................................................................
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 1 4 Features The TMCM-1640 is a highly compact controller/driver module for brushless DC (BLDC) motors with up to 5A coil current, optional encoder and/or hall sensor feedback. For communication the module offers RS485 and (mini-)USB interface. Applications - Compact single-axis brushless DC motor solutions Electrical data - Supply voltage: +24V DC nom. (+12V… +28.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 2 5 Overview The software running on the microprocessor of the TMCM-1640 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 – normally – untouched throughout the whole lifetime, the firmware can be updated by the user. New versions can be downloaded free of charge from the TRINAMIC website (http://www.trinamic.com).
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 3 6 Putting the TMCM-1640 into Operation Here you can find basic information for putting your module into operation. The text contains a simple example for a TMCL program and a short description of operating the module in direct mode. THINGS YOU NEED: - TMCM-1640 USB interface and appropriate cable or RS485 interface / adapter and appropriate cable Nominal supply voltage +24V DC (+12… +28.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) Pin 1 2 3 2. 5. Label GND +5V A B N Description Encoder supply and signal ground +5V output for encoder supply (max. 100mA) Encoder channel a Encoder channel b Encoder index / null channel Connect the hall sensor: Pin 1 2 3 4 5 4. Description Motor coil phase 1 / U Motor coil phase 2 / V Motor coil phase 3 / W Connect the encoder (optional): Pin 1 2 3 4 5 3.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 6. 8 Connect the power supply as follows: Pin 1 Label +U 2 GND Description Module and driver stage power supply input Module ground (power supply and signal ground) Please note, that there is no protection against reverse polarity and only limited protection against voltages above the upper maximum limit. The power supply typically should be within a range of +12 to +28.5V.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) Figure 3.1: Setup menu 9 Figure 3.2: Connection tab of TMCL-IDE 3.2 Operating the Module in Direct Mode Start TMCL Direct Mode. Direct Mode If the communication is established the TMCM-1640 is automatically detected. If the module is not detected, please check all points above (cables, interface, power supply, COM port, baud rate).
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 4 10 TMCL™ The TMCM-1640 module supports TMCL direct mode and standalone TMCL program execution. You can store up to 2048 TMCL instructions on it. In direct mode the TMCL communication over USB/RS485 follows a strict master/slave relationship. That is, a host computer (e.g. PC/PLC) acting as the interface bus master will send a command to the module.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 11 Checksum calculation As mentioned above, the checksum is calculated by adding up all bytes (including the module address byte) using 8-bit addition.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 12 4.3 Standalone Applications The module is equipped with an EEPROM for storing TMCL applications. You can use the TMCL-IDE for developing standalone TMCL applications. You can load your program down into the EEPROM and then it will run on the module. The TMCL-IDE contains an editor and a TMCL assembler where the commands can be entered using their mnemonic format. They will be assembled automatically into their binary representations.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 13 4.5 TMCL Command Overview The following section provides a short overview of the TMCL commands supported by the TMCM-1640. 4.5.1 Motion Commands These commands control the motion of the motor. They are the most important commands and can be used in direct or in standalone mode. Mnemonic ROL ROR MVP MST 4.5.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 4.5.5 14 Calculation Commands These commands are intended to be used for calculations within TMCL applications in standalone mode, only. For calculating purposes there are an accumulator (or accu or A register) and an X register. When executed in a TMCL program (in standalone mode), all TMCL commands that read a value store the result in the accumulator. The X register can be used as an additional memory when doing calculations.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 15 4.6 Commands The module specific commands are explained in more detail on the following pages. They are listed according to their command number. 4.6.1 ROR (rotate right) 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 #2 (target velocity).
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 4.6.2 16 ROL (rotate left) 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 #2 (target velocity).
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 4.6.3 17 MST (motor stop) The motor will be instructed to stop. Internal function: The axis parameter target velocity is set to zero. Related commands: ROL, ROR, SAP, GAP Mnemonic: MST 0 Binary representation: COMMAND 3 TYPE don’t care MOT/BANK 0 Reply in direct mode: STATUS 100 – OK COMMAND 3 VALUE don’t care VALUE don’t care Example: Stop motor Mnemonic: MST 0 Binary: Byte Index Function Value (hex) 0 Targetaddress $01 www.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 4.6.4 18 MVP (move to position) The motor will be instructed to move to a specified relative or absolute position. It uses the acceleration/deceleration ramp and the positioning speed programmed into the unit. This command is nonblocking (like all commands). A reply will be sent immediately after command interpretation. Further commands may follow without waiting for the motor reaching its end position.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 4.6.5 19 SAP (set axis parameter) Most of the motion control parameters of the module can be specified by using the SAP command. The settings will be stored in SRAM and therefore are volatile. Thus, information will be lost after power off. Please use command STAP (store axis parameter) in order to store any setting permanently.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 4.6.6 20 GAP (get axis parameter) Most parameters of the TMCM-1640 can be adjusted individually. They can be read out using the GAP command.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 4.6.7 21 STAP (store axis parameter) The STAP command stores an axis parameter previously set with a Set Axis Parameter command (SAP) permanently. Most parameters are automatically restored after power up. Internal function: An axis parameter value stored in SRAM will be transferred to EEPROM and loaded from EEPORM after next power up.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 4.6.8 22 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. A single parameter that has been changed before can be reset by this instruction also. Internal function: The specified parameter is copied from the configuration EEPROM memory to its RAM location.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 4.6.9 23 SGP (set global parameter) Global parameters are related to the host interface, peripherals or other 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 only bank 2 is intended to use for user variables.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 24 4.6.10 GGP (get global parameter) All global parameters can be read with this function. Related commands: SGP, STGP, RSGP Mnemonic: GGP , Binary representation: COMMAND 10 TYPE Reply in direct mode: STATUS 100 – OK VALUE MOT/BANK VALUE don’t care A list of all parameters which can be used for the GGP command is shown in section 6.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 25 4.6.12 RSGP (restore global parameter) This instruction copies a value from the configuration EEPROM to its RAM location and so recovers the permanently stored value of a RAM-located parameter. Most parameters are automatically restored after power up.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 26 4.6.13 SIO (set output) and GIO (get input / output) The TMCM-1640 provides two commands for dealing with inputs and outputs: - SIO sets the status of the general digital output either to low (0) or to high (1). With GIO the status of the two available general purpose inputs of the module can be read out. The command reads out a digital or analogue input port.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 27 Mnemonic: GIO , Binary representation: INSTRUCTION NO.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 28 4.6.14 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-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 29 4.6.15 COMP (compare) The specified number is compared to the value in the accumulator register. The result of the comparison can be used for example by the conditional jump (JC) instruction. This command is intended for use in standalone operation, only. The host address and the reply are required to take the instruction to the TMCL program memory while the TMCL program downloads. It does not make sense to use this command in direct mode.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 30 4.6.16 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. This function is for standalone operation only. The host address and the reply are required to take the instruction to the TMCL program memory while the TMCL program downloads.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 31 4.6.17 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 required to take the instruction to the TMCL program memory while the TMCL program downloads. This command cannot be used in direct mode. Internal function: The TMCL program counter is set to the passed value.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 32 4.6.18 CSUB (call subroutine) and RSUB (return from subroutine) For implementing subroutines there are two commands: - CSUB calls a subroutine in the TMCL program memory. It is intended for standalone operation, only. The host address and the reply are required to take the instruction to the TMCL program memory while the TMCL program downloads. This command cannot be used in direct mode.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 33 4.6.19 WAIT (wait for an event to occur) This instruction interrupts the execution of the TMCL program until the specified condition is met. The WAIT command is intended for standalone operation only. The host address and the reply are used for communication with the TMCL memory. This command is not to be used in direct mode.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 34 4.6.20 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. Every standalone TMCL program needs the STOP command at its end. It is not to be used in direct mode. Internal function: TMCL instruction fetching is stopped.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 35 4.6.21 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-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 36 4.6.22 AAP (accumulator to axis parameter) The content of the accumulator register is transferred to the specified axis parameter. For practical use, 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.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 37 4.6.23 AGP (accumulator to global parameter) The content of the accumulator register is transferred to the specified global parameter. For practical use, 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.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 38 4.6.25 Command 136 - Get Firmware Version Command 136 is used for reading out the module type and firmware version as a string or in binary format. (Motor/Bank and Value are ignored.) Other control functions can be used with axis parameters. Command Type 136 0 – string 1 – binary Parameter Description Firmware version Get the module type and firmware revision as a string or in binary format. (Motor/Bank and Value are ignored.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 5 39 Axis Parameter Overview (SAP, GAP, STAP, RSAP, AAP) The following section describes all axis parameters that can be used with the SAP, GAP, STAP, RSAP and AAP commands. MEANING OF THE LETTERS IN COLUMN ACCESS: Access type R W E Related command(s) GAP SAP, AAP STAP, RSAP Number 0 Axis Parameter Description Range [Unit] Target position The target position of a currently executed ramp.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) Number 30 Axis Parameter Description Minute counter Counts the module operational time in minutes. 133 PID regulation loop delay Current regulation loop delay Activate ramp 134 146 150 151 152 155 156 159 161 162 163 Delay of the position and velocity Delay of the PID current regulator. 40 Range [Unit] 0… +4294967295 [min] 0… +4294967295 [ms] 0… +4294967295 [50µs] 1: Activate velocity ramp generator for position 0/1 and velocity mode.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) Number 164 Axis Parameter Description Left stop switch Activate stop Bit 0 enable switch Bit 1 165 166 173 177 200 201 209 210 211 226 228 229 230 234 Range [Unit] 0… 3 Please see parameter 166 for selecting the stop switch input polarity. Actual encoder This value represents the internal commutation -2147483648… commutation offset. +2147483647 offset (0 … max.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) Number 235 238 239 240 244 245 249 250 251 253 254 42 Axis Parameter I parameter for velocity PID Mass inertia constant BEMF constant Description I parameter of velocity PID regulator. Motor coil resistance Init sine delay Resistance of motor coil. Used for current, position, and velocity regulation. Duration for sine initialization sequence.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 43 5.1 Axis Parameter Sorted by Functionality The following section describes all axis parameters that can be used with the SAP, GAP, STAP, RSAP and AAP 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-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) Number 177 249 244 159 Axis Parameter Description Start current Motor current for controlled commutation. This parameter is used in commutation mode.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) Number 229 Axis Parameter Description Velocity PID Sum of errors of PID velocity regulator error sum 45 Range [Unit] -2147483648… +2147483647 Access R Range [Unit] -2147483648… +2147483647 [rpm] Access RWE VELOCITY RAMP PARAMETER Number 4 11 13 146 Axis Parameter Description Max. ramp The maximum velocity used for velocity ramp in velocity velocity mode and positioning mode.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) Number 166 Axis Parameter Description Bit 0 Left stop switch Stop switch polarity polarity Range [Unit] 0… 3 Access RWE -2147483648… +2147483647 -2147483648… +2147483647 RWE Description Actual supply voltage. Actual temperature of the motor driver. Range [Unit] 0… +4294967295 0… +4294967295 Access R R Bit 0: Overcurrent flag. This flag is set if max. current limit is exceeded. Bit 1: Undervoltage flag.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 6 47 Global Parameter Overview (SGP, GGP, STGP, RSGP, AGP) The following section describes all global parameters that can be used with the SGP, GGP, STGP and RSGP commands. TWO BANKS ARE USED FOR GLOBAL PARAMETERS: - Bank 0 (global configuration of the module) Bank 2 (user TMCL variables) 6.1 Bank 0 Parameters 64… 255 Parameters below 63 configure stuff like the serial address of the module RS485 baud rate or the telegram pause time.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) Number 81 85 128 129 Global parameter TMCL code protection do not restore user variables TMCL application status 132 download mode TMCL program counter tick timer 255 suppress reply 130 48 Description Range Access Protect a TMCL program against disassembling or overwriting.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 7 7.1 49 Motor Regulation Structure of the Cascaded Motor Regulation Modes The TMCM-1640 supports a current, velocity, and position PID regulation mode for motor control in different application areas. These regulation modes are cascaded as shown in figure 12.1. The individual modes are explained in the following sections.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 50 7.2 Current Regulation The current regulation mode uses a PID regulator to adjust a desired motor current. This target current can be set by axis parameter 155. The maximal target current is limited by axis parameter 6. The PID regulation uses three basic parameters: The P and I value as well as the timing control value.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 7.3 51 Velocity Regulation Based on the current regulation the motor velocity can be controlled by the velocity PID regulator. TIMING CONTROL VALUE Also, the velocity PID regulator uses a timing control value (PID regulation loop delay, axis parameter 133) which determines how often the PID regulator is invoked.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 52 7.4 Velocity Ramp Generator For a controlled start up of the motor's velocity a velocity ramp generator can be activated/deactivated by axis parameter 146. The ramp generator uses the maximal allowed motor velocity (axis parameter 4), the acceleration (axis parameter 11) und the desired target velocity (axis parameter 2) to calculate a ramp generator velocity for the following velocity PID regulator. 7.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 53 NOTE: - In order to minimize the time until this flag becomes set, the positioning tolerance MVP target reached distance can be chosen with axis parameter 10. - Since the motor typically is assumed not to signal target reached when the target was just passed in a short moment at a high velocity, additionally the maximum target reached velocity (MVP target reached velocity) can be defined by axis parameter 7.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 8 54 Temperature Calculation Axis parameter 152 delivers the actual ADC value of the motor driver. This ADC value can be converted to a temperature in °C as follows: Example 1: ADC = 1000 RNTC ≈ 6.81 Example 2: ADC = 1200 RNTC ≈ 5.31 T ≈ 35 9 T ≈ 42 I²t Monitoring The I²t monitor determines the sum of the square of the motor current over a given time. The integrating time is motor specific.
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 10 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-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 11 Revision History 11.1 Firmware Revision Version Date Author 2.00 2012-JUN-10 ED ED – Enrico Dressler Description New FOC firmware 11.2 Document Revision Version Date Author 2.