PANDRIVE™ PANdrive™ for BLDC/PMSM PD-x-1670 TMCL™ Firmware Manual Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 PD-x-1670 is an easy to use and rather compact PANdrive™ smart BLDC motor. The module is controlled via CAN bus interface and comes with two firmware options – TMCL and CANopen. The PD-x-1670 line offer an integrated hall sensor based encoder for closed-loop FOC based operation.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 2 / 82 Contents 1 Features 4 2 First Steps with TMCL 2.1 Basic Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Using the TMCL Direct Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 Testing with a simple TMCL Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3 / 82 3.6.32 Request Target Position reached Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 3.6.33 TMCL Control Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 4 Axis Parameters 61 5 Global Parameters 67 5.1 Bank 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 6 Motor Regulation 6.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 1 4 / 82 Features The PD42-x-1670 is a single axis PANdrive™ for three-phase BLDC 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 has been designed for coil currents up to 6.8A Peak at 24V DC supply voltage and has four digital inputs.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 2 5 / 82 First Steps with TMCL In this chapter you can find some hints for your first steps with the PD-x-1670 and TMCL. You may skip this chapter if you are already familiar with TMCL and the TMCL-IDE. Things that you will need • Your PD-x-1670 PANdrive. • A power supply (24V DC) for your PD-x-1670 PANdrive. • A CAN adapter. • The TMCL-IDE 3.x already installed on your PC 2.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 5 ROR 0 , 500 WAIT TICKS , 0 , 500 MST 0 6 / 82 // rotate motor 0 with +500 rpm 7 9 11 13 15 SAP 4 , 0 , 2000 SAP 11 , 0 , 1000 Loop : MVP ABS , 0 , 512000 WAIT POS , 0 , 0 MVP ABS , 0 , -512000 WAIT POS , 0 , 0 JA Loop // set max . velocity // set max .
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3 7 / 82 TMCL and the TMCL-IDE — An Introduction The PD-x-1670 supports TMCL direct mode (binary commands). It also implements standalone TMCL program execution. This makes it possible to write TMCL programs using the TMCL-IDE and store them in the memory of the module. In direct mode the TMCL communication over RS-232, RS-485, CAN, and USB follows a strict master/slave relationship.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 8 / 82 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 1: 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.2 9 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.3 10 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.4 11 / 82 TMCL Command Overview This sections gives a short overview of all TMCL commands.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 13 / 82 Parameter Commands Mnemonic Command number Meaning SAP 5 Set axis parameter GAP 6 Get axis parameter STAP 7 Store axis parameter RSAP 8 Restore axis parameter SGP 9 Set global parameter GGP 10 Get global parameter STGP 11 Store global parameter RSGP 12 Restore global parameter Table 6: Parameter Commands 3.5.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 14 / 82 I/O Port Commands Mnemonic Command number Meaning SIO 14 Set output GIO 15 Get input Table 8: I/O Port Commands 3.5.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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6 15 / 82 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]).
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.2 16 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.3 17 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.4 18 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 20 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.5 21 / 82 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. Info For a table with parameters and values which can be used together with this command please refer to section 4.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.6 22 / 82 GAP (Get Axis Parameter) Most motion / driver related parameters of the PD-x-1670 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).
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.7 23 / 82 STAP (Store Axis Parameter) This command is used to store TMCL axis parameters permanently in the EEPROM of the module. This command is mainly needed to store the default configuration of the module. The contents of the user variables can either be automatically or manually restored at power on.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.8 24 / 82 RSAP (Restore Axis Parameter) With this command the contents of an axis parameter can be restored from the EEPROM. By default, all axis parameters are automatically restored after power up. An axis parameter that has been changed before can be reset to the stored value by this instruction.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.9 25 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.10 26 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.11 27 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.12 28 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.13 29 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 Digital Outputs in Bank 2 Port Description Command Range 0 - OUTPUT_0 Digital output 0 SIO 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.14 31 / 82 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 bit result in the range of 0. . . .
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 32 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 Digital Outputs in Bank 2 Port Description Command Range 0 - OUTPUT_0 Digital output 0 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.15 34 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.16 36 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.17 37 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.18 39 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.19 40 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.20 41 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.21 42 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.22 44 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.23 45 / 82 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).
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.24 46 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 47 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.25 48 / 82 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).
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.26 49 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.27 50 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.28 52 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.29 53 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.30 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.31 56 / 82 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. . .
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.32 57 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 3.6.33 59 / 82 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).
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 60 / 82 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).
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 4 61 / 82 Axis Parameters Most motor controller features of the PD-x-1670 module are controlled by axis parameters. Axis parameters can be modified or read using SAP, GAP and AAP commands. Some axis parameters can also be stored to or restored from the EEPROM using STAP and RSAP commands. This chapter describes all axis parameters that can be used on the PD-x-1670 module.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 Number Axis Parameter 100 Bode Control_Mode 101 Bode Target_Mode Description 62 / 82 Range [Units] Default Access 0 ...2 0 R 0 ...4 0 R 0 - direct sine wave 1 - direct square wave 2 - sweeep sine wave 0 - no target 1 - torque target 2 - velocity target 3 - position target 4 - stopped 102 Bode Actual_Magnitude Actual magnitude (ratio of actual to target value). −2147483648 . . . 2147483647 [0.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 63 / 82 Number Axis Parameter Description Range [Units] Default Access 155 target torque Get desired target current or set target current to activate current regulation mode. (+= turn motor in right direction; -= turn motor in left direction) −7400 . . .
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 64 / 82 Number Axis Parameter Description Range [Units] Default Access 181 PWM loops PWM loops per second. 0 . . . 4294967295 0 R 182 Torque loops Torque loops per second. 0 . . . 4294967295 0 R 183 Velocity loops Velocity loops per second. 0 . . . 4294967295 0 R 190 debug value 0 Free used debugging value. −2147483648 . . .
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 65 / 82 Number Axis Parameter Description Range [Units] Default Access 215 driver status acknowledge Acknowledge driver status. 0 ...0 0 W 216 driver init spi Disables the driver and initializes the driver SPI access. 0 ...0 0 W 217 driver status register 2 TMC6130 status register 2. 0 . . . 65535 0 RW 218 driver status register 3 TMC6130 status register 3. 0 . . .
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 Number Axis Parameter 255 enable driver Description Range [Units] Default Access 0 ...1 0 RW 0 - driver disabled 1 - driver enabled Table 11: All PD-x-1670 Axis 0 Parameters ©2018 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany Terms of delivery and rights to technical change reserved. Download newest version at www.trinamic.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 5 67 / 82 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. 5.1 Bank 0 Parameters with numbers from 64 on configure all settings that affect the overall behaviour of a module.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 68 / 82 All Global Parameters of the PD-x-1670 Module in Bank 0 Number Global Parameter Description Range [Units] Default Access 65 serial baud rate RS485/RS232 baud rate 0 - 9600 baud 1 - 14400 baud 2 - 19200 baud 3 - 28800 baud 4 - 38400 baud 5 - 57600 baud 6 - 76800 baud 7 - 115200 baud 0 ...7 7 RW 66 serial address The module (target) address for RS485, RS232, and virtual COM port. 1 . . .
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 6 69 / 82 Motor Regulation 6.1 Structure of Cascaded Motor Regulation Modes The PD-x-1670 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 1. Individual modes are explained in the following subsections. Figure 1: Cascaded Regulation 6.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 70 / 82 Figure 2: Current Regulation (See parameter descriptions in Table 14) Current Regulation Parameters Parameter Description IACT U AL Actual motor current (GAP 150) IT ARGET Target motor current (SAP 155) IM ax Max.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 6.3.1 71 / 82 Timing Control Value The velocity PI regulator uses a timing control value (velocity regulation loop multiplier, axis parameter 133) which determines how often the PID regulator is invoked.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 72 / 82 1. Set the velocity I parameter to zero. 2. Start the motor by using a medium target velocity (e.g. 2000 rpm). 3. Modify the current P parameter. (a) Start from a low value and go to a higher value, until the actual motor speed reaches 80 or 90% of the target velocity. (b) The lasting 10 or 20% speed difference can be reduced by slowly increasing the velocity I parameter. 6.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 73 / 82 Position Regulation Parameters Parameter Description nACT U AL Actual motor position (GAP 1) nT ARGET Target motor position (SAP 0) PP ARAM Position P parameter (SAP 230) VM AX Max. allowed velocity (SAP 4) VT ARGET New target velocity for the ramp generator (GAP 13) Table 16: Position Regulation Parameters 6.5.2.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 74 / 82 Figure 5: Positioning Algorithm 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 11 JA MainLoop 7.3 75 / 82 // end of the main loop = > run infinitely Using Symbolic Constants To make your program better readable and understandable, symbolic constants should be taken for all important numerical values that are used in the program. The TMCL-IDE provides an include file with symbolic names for all important axis parameters and global parameters.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 76 / 82 Please see the following example: 1 3 5 7 9 11 MyVariable = 42 // Use a symbolic name for the user variable // ( This makes the program better readable and understandable .) SGP MyVariable , 2 , 1234 // Initialize the variable with the value 1234 ... ...
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 2 4 6 8 10 77 / 82 // Jump commands to the TMCL routines Func1 : JA Func1Start Func2 : JA Func2Start Func3 : JA Func3Start Func1Start : MVP ABS , 0 , 1000 WAIT POS , 0 , 0 MVP ABS , 0 , 0 WAIT POS , 0 , 0 STOP 12 14 16 Func2Start : ROL 0 , 500 WAIT TICKS , 0 , 100 MST 0 STOP 18 20 22 Func3Start : ROR 0 , 1000 WAIT TICKS , 0 , 700 MST 0 STOP This example provides three very simple TMCL routines.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 8 78 / 82 Figures Index 1 2 3 Cascaded Regulation . . . . . . . . . . Current Regulation . . . . . . . . . . . Velocity Regulation . . . . . . . . . . . 69 70 71 ©2018 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany Terms of delivery and rights to technical change reserved. Download newest version at www.trinamic.com 4 Positioning Regulation . . . . . . . . . 72 5 Positioning Algorithm . . . . .
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 9 79 / 82 Tables Index 1 2 3 4 5 6 7 8 9 10 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 . . . . . . TMCL Control Commands . . . . . . . . . . . . . . . . . . . . .
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 10 80 / 82 Supplemental Directives 10.1 Producer Information 10.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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 81 / 82 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.
PD-x-1670 TMCL™ Firmware Manual • Firmware Version V2.0 | Document Revision V1.0 • 2018-Oct-29 11 11.1 Revision History Firmware Revision Version Date Author Description 2.00 26.10.2018 ED First release. Table 17: Firmware Revision 11.2 Document Revision Version Date Author Description 1.00 29.10.2018 ED First release. Table 18: Document Revision ©2018 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany Terms of delivery and rights to technical change reserved.