3.5.34 DI (disable interrupt) ..........................54 3.5.35 RETI (return from interrupt) ........................55 3.5.36 Customer Specific TMCL Command Extension (UF0… UF7/user function) ........56 3.5.37 Request Target Position Reached Event ....................57 3.5.38 TMCL Control Functions ..........................58 Axis Parameters ................................60 www.trinamic.com...
Page 3
Using Symbolic Constants ..........................77 Using Variables ..............................78 Using Subroutines ............................. 78 Mixing Direct Mode and Standalone Mode ....................79 Life Support Policy ..............................80 Revision History ................................81 Document Revision ............................81 Firmware Revision ............................81 10 References ..................................82 www.trinamic.com...
0.06… 0.12 Nm max. holding torque and 24V DC nominal supply voltage. With its high energy efficiency from TRINAMIC’s coolStep technology cost for power consumption is kept down. TMCL™ firmware allows for standalone operation and direct mode.
Page 5
PD-1021 TMCL Firmware V1.29 Manual (Rev. 1.06 / 2014-APR-14) TRINAMIC – E TMCL NIQUE EATURES ASY TO SE WITH 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.
Choose COM port and type with the parameters shown in Figure 2.2 (baud rate 9600). Click OK. Figure 2.2 Setup dialogue and connection tab of the TMCL-IDE. Please refer to the TMCL-IDE User Manual for more information (see www.TRINAMIC.com). www.trinamic.com...
TMCL program. The command will be shown immediately on the editor. Note: Please mind chapter 7 (programming techniques) of the TMCL-IDE User Manual on www.trinamic.com. Here you will find information about creating general structures of TMCL programs. In particular initialization, main loop, symbolic constants, variables, and subroutines are described there.
Standby current The current limit two seconds after the motor has 0… 255 stopped. Microstep full step 0… 8 resolution half step 4 microsteps 8 microsteps 16 microsteps 32 microsteps 64 microsteps 128 microsteps 256 microsteps www.trinamic.com...
Click the Assemble icon to convert the TMCL program into binary code. Then download the program to the PD-1021 by clicking the Download icon. Click the Run icon. The desired program will be executed. Click the Stop button to stop the program. www.trinamic.com...
PD-1021 TMCL Firmware V1.29 Manual (Rev. 1.06 / 2014-APR-14) 3 TMCL and the TMCL-IDE: Introduction As with most TRINAMIC modules the software running on the microprocessor of the PD-1061 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.
Status (e.g. 100 means “no error”) Command number Value (MSB first!) Checksum The checksum is also calculated by adding up all the other bytes using an 8-bit addition. Do not send the next command before you have received the reply! www.trinamic.com...
<parameter>, <bank number> Get global parameter (read out module specific settings e.g. communication settings or TMCL user variables) STGP <parameter>, <bank number> Store global parameter (TMCL user variables only) RSGP <parameter>, <bank number> Restore global parameter (TMCL user variable only) www.trinamic.com...
Command number Meaning Set axis parameter Get axis parameter STAP Store axis parameter into EEPROM RSAP Restore axis parameter from EEPROM Set global parameter Get global parameter STGP Store global parameter into EEPROM RSGP Restore global parameter from EEPROM www.trinamic.com...
Page 15
TMCL program running on the module. 3.4.2.6 Interrupt Commands Due to some customer requests, interrupt processing has been introduced in the TMCL firmware for ARM based modules. Mnemonic Command number Meaning Enable interrupt Disable interrupt VECT Set interrupt vector RETI Return from interrupt www.trinamic.com...
Page 16
If necessary, configure the interrupt using an SGP <type>, 3, <value> command. Enable the interrupt using an EI <interrupt> command. Globally enable interrupts using an EI 255 command. An interrupt handling routine must always end with a RETI command www.trinamic.com...
Page 17
The beginning of the program above then looks like the following: #include Interrupts.inc VECT TI_TIMER0, Timer0Irq SGP TI_TIMER0, 3, 1000 EI TI_TIMER0 EI TI_GLOBAL Please also take a look at the other example programs. www.trinamic.com...
STATUS VALUE 100 – OK (don't care) Example: Rotate right, velocity = 10000 Mnemonic: ROR 0, 10000 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
STATUS VALUE 100 – OK (don't care) Example: Rotate left, velocity = 10000 Mnemonic: ROL 0, 10000 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Reply in direct mode: STATUS VALUE 100 – OK (don't care) Example: Stop motor Mnemonic: MST 0 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) Example: Move motor from current position 10000 steps backward (move relative –10000) Mnemonic: MVP REL, 0, -10000 Binary: www.trinamic.com...
Page 22
Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) When moving to a coordinate, the coordinate has to be set properly in advance with the help of the SCO, CCO or ACO command. www.trinamic.com...
Set the absolute maximum current of the motor during movements to approx. 78% of max. module current: Mnemonic: SAP 6, 0, 200 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) Reply: Byte Index Function Host- Target- Status Instruction Operand Operand Operand Operand Checksum address address Byte3 Byte2 Byte1 Byte0 Value (hex) Status = 100 (no error), position = 2000 www.trinamic.com...
Value (hex) Note: The STAP command will not have any effect when the configuration EEPROM is locked (refer to 5.1). In direct mode, the error code 5 (configuration EEPROM locked, see also section 0) will be returned in this case. www.trinamic.com...
For a table with parameters which can be used together with this command please refer to chapter 4. Example: Restore the maximum current of motor Mnemonic: RSAP 6, 0 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Example: Set the serial address of the target device (module) to 3 Mnemonic: SGP 66, 0, 3 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) Reply: Byte Index Function Host- Target- Status Instruction Operand Operand Operand Operand Checksum address address Byte3 Byte2 Byte1 Byte0 Value (hex) Status = 100 (no error), Value = 1 www.trinamic.com...
For a table with parameters and bank numbers which can be used together with this command please refer to chapter 5. Example: Store user variable #42 Mnemonic: STGP 42, 2 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
For a table with parameters and bank numbers which can be used together with this command please refer to chapter 5. Example: Restore user variable #42 Mnemonic: RSGP 42, 2 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
– ref. search is active Example: Start reference search of motor Mnemonic: RFS START, 0 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Please note, that the module has four I/O pins including two open drain outputs: Power, communication and I/O Pin 7: OUT_0 (open collector) Pin 8: OUT_1 (open collector) Please refer to the Hardware Manual for further information. Figure 3.1: I/O connector of PD-1021 www.trinamic.com...
Page 33
Example: Set both output pins high. Mnemonic: SIO 255, 2, 127 The following program will show the states of the input lines on the output lines: Loop: GIO 255, 0 SIO 255, 2,-1 JA Loop www.trinamic.com...
Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) Reply: Byte Index Function Host- Target- Status Instruction Operand Operand Operand Operand Checksum address address Byte3 Byte2 Byte1 Byte0 Value (hex) value: 506 www.trinamic.com...
Page 35
3.5.15.3 I/O bank 2 – the states of digital outputs The states of the OUT lines (that have been set by SIO commands) can be read back using bank 2. I/O port Command Result range OUT_0 GIO 0, 2 OUT_1 GIO 1, 2 www.trinamic.com...
8 NOT – logical invert accu 9 LOAD – load operand to accu Example: Multiply accu by -5000 Mnemonic: CALC MUL, -5000 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
//jump, type: 5 greater/equal, the label must be defined somewhere else in the program Binary format of the COMP 1000 command: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
//jump, type: 5 greater/equal Label: ROL 0, 1000 Binary format of JC GE, Label when Label is at address 10: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
//Jump to the label Loop Binary format of JA Loop assuming that the label Loop is at address 20: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
//Continue with the command following the CSUB command Binary format of the CSUB SubW command assuming that the label SubW is at address 100: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
(don't care) (don't care) (don't care) Example: please see the CSUB example (section 3.5.20). Binary format of RSUB: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
10 milliseconds Example: Wait for motor to reach its target position, without timeout Mnemonic: WAIT POS, 0, 0 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
SCO 0, 255, 0 copies all coordinates (except coordinate number 0) from RAM to the EEPROM. SCO <coordinate number>, 255, 0 copies the coordinate selected by <coordinate number> to the EEPROM. The coordinate number must be a value between 1 and www.trinamic.com...
(except coordinate number 0) from the EEPROM to the RAM. GCO <coordinate number>, 255, 0 copies the coordinate selected by <coordinate number> from the EEPROM to the RAM. The coordinate number must be a value between 1 and 20. www.trinamic.com...
100 – OK (don't care) Example: Store current position of the axe to coordinate 3 Mnemonic: CCO 3, 0 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Example: Copy the actual value of the accumulator to coordinate 1 of motor Mnemonic: ACO 1, 0 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
9 LOAD – load accu to X-register 10 SWAP – swap accu with X-register Example: Multiply accu by X-register Mnemonic: CALCX MUL Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
// transfer result to target position of motor 0 JA Start // jump back to start Binary format of the AAP 0,0 command: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
For a table with parameters and bank numbers which can be used together with this command please refer to chapter 5. Example: Copy accumulator to TMCL user variable #3 Mnemonic: AGP 3, 2 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
4 – (EPO) position flag 5 – (ESD) shutdown flag Example: Reset the timeout flag Mnemonic: CLE ETO Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
IN_0 change IN_1 change Example: Define interrupt vector at target position 500 VECT 3, 500 Binary format of VECT: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Byte3 Byte2 Byte1 Byte0 Value (hex) Enable interrupt when target position reached EI, 3 Binary format of EI: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Byte3 Byte2 Byte1 Byte0 Value (hex) Disable interrupt when target position reached DI, 3 Binary format of DI: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
(don't care) (don’t care) Example: Terminate interrupt handling and continue with normal program execution RETI Binary format of RETI: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Checksum address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
The user definable functions UF0… UF7 are predefined functions 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.
> Additional reply in direct mode (after motors have reached their target positions): Byte Index Function Target- Target- Status Instruction Operand Operand Operand Operand Checksum address address Byte3 Byte2 Byte1 Byte0 Value (hex) Motor bit <checksum mask > www.trinamic.com...
1234 settings EEPROM to their factory defaults This command does not send back a reply. – Request target send an additional reply when the (don't care) (don't care) (don't care) position reached event motor has reached target position www.trinamic.com...
Page 59
The version number is output in the value field of the reply in the following way: Byte index in value field Contents Version number, low byte Version number, high byte Type number, low byte (currently not used) Type number, high byte (currently not used) www.trinamic.com...
Current … 247…255 -> max. current). Standby current Current limit after the motor has stopped plus 0… 255 power down delay time (see parameter 214). Same range and meaning as for parameter 6 Position reached 1 when target position = actual position 0 otherwise www.trinamic.com...
Page 61
1 – classic const. off time Chopper Hysteresis decrement setting. This setting 0… 3 hysteresis determines the slope of the hysteresis during decrement on time and during fast decay time. 0 – fast decrement 3 – very slow decrement www.trinamic.com...
Page 62
Scaling: 0… 3: 1, 2, 4, 8 0: slow increment 3: fast increment / fast reaction to rising load smartEnergy The lower threshold for the stallGuard2 value 0… 15 hysteresis start (see smart Energy current up step). www.trinamic.com...
Page 63
Above this speed motor will stop in case [pps] stallGuard2 load value reaches zero. smartEnergy Above this speed coolStep will be enabled. 0… +268.435.454 threshold speed [pps] smartEnergy Sets the motor current which is used blow the 0… 255 slow run current threshold speed. www.trinamic.com...
Page 64
Time after which the power to the motor will 0… 65535 delay be cut when its velocity has reached zero. 0 = never [msec] Actual load value Readout of the actual load value used for stall 0… 1023 detection. www.trinamic.com...
Page 65
Automatic current switching like (2), but the ENABLE input is used to switch the driver stage completely off or on. Always use run current like (3), but the ENABLE pin is used to switch the driver stage completely off or www.trinamic.com...
The unit of the velocity <value> is pulse per second (pps). For calculating the speed it is necessary to set the microstep resolution of the driver (axis parameter 140) first. Further, the fullsteps of the motor must be given. Now, calculate as follows: www.trinamic.com...
123 Current and parameter 123 Velocity and parameter 123 Time parameter 123 stallGuard2™ parameter The lower threshold of the coolStep™ current can be adjusted up to I6/4. Refer to parameter 168. Figure 4.1: coolStep adjustment points and thresholds www.trinamic.com...
Page 68
Above this speed coolStep becomes enabled. Standstill period before the current is changed down to standby power down delay current. The standard value is 200 (value equates 2000msec). For further information about the coolStep™ feature please refer to the TMC262 Datasheet. www.trinamic.com...
76800 baud Not supported by Windows! 115200 baud 230400 baud 250000 baud Not supported by Windows! 500000 baud Not supported by Windows! 1000000 baud Not supported by Windows! serial address The module (target) address for RS485 (default: 1) 0… 255 www.trinamic.com...
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 (see section 7.3) these variables form the interface between extensions of the firmware (written in C) and TMCL applications. www.trinamic.com...
… +2 general purpose variable #19 for use in TMCL applications … +2 20… 55 general purpose variables #20… for use in TMCL applications … +2 56… 255 general purpose variables #56… for use in TMCL applications … +2 #255 www.trinamic.com...
Adding 128 to these values reverses the polarity of the home switch input. The next two pages show all possible modes of reference search according to the specific commands on top of each drawing. www.trinamic.com...
Page 74
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.com...
Page 75
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. SAP 193, 0, 8 home switch Search home switch in negative direction, ignore end switches. www.trinamic.com...
To overcome this problem, set the telegram pause time (global parameter #75) of the module to 15 (or more if needed) by issuing an SGP 75, 0, 15 command in direct mode. The parameter will automatically be stored in the configuration EEPROM. www.trinamic.com...
CSUB command that called the subroutine. This mechanism can also be nested. From a subroutine called by a CSUB command other subroutines can be called. In the current version of TMCL eight levels of nested subroutine calls are allowed. www.trinamic.com...
2 to call the third function. You can see the addresses of the TMCL labels (that are needed for the run commands) by using the Generate symbol file function of the TMCL-IDE. Please refer to the TMCL-IDE User Manual for further information about the TMCL-IDE. www.trinamic.com...
PD-1021 TMCL Firmware V1.29 Manual (Rev. 1.06 / 2014-APR-14) 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 &...
Error correction related to magnetic encoder. Update rate increased. 1.28 2013-SEP-24 Not deployed for PD-1021 1.29 2014-JAN-14 Firmware version 1.29 is intended for PD-1021 versions from 1.0 to 1.4. Earlier firmware versions are not compatible with PD-1021 V1.4.devices! Axis parameter 197 added. Figure 8.2: Firmware revision www.trinamic.com...
Need help?
Do you have a question about the PANdrive PD-1021 and is the answer not in the manual?
Questions and answers