J105 STMC
The STMC controller IC accepts one initialisation command, eight motion commands and four 'read register' commands.
Command bytes are written to the command register at address 3B1. A command is usually of the form
Command byte - written to command register data byte 1 - written to data register ... data byte n - written to data register
There may be zero to four data bytes containing information about (for example) how many steps the motor should move. They are defined in detail for each command.
bit 1 bit 0 motor type 1 1 5-phase 1 0 4-phase 0 1 3-phase
This command Must be used after a reset or power-up and whenever Motor parameters are changed.
Note: the on-board driver does not support 5 phase motors.
Bits 3,2,1 and 0 cannot be changed once they are defined, except by resetting the controller IC. The other bits and the data bytes can be changed, by reissuing this command.
initialisation data bytes
The initialisation command has four data bytes. The format is as follows:
Bit Value Function 7 (msb) 0 Always 0 for the initialisation command byte 6 0 Always 0 for the initialisation command byte 5 1 Switch output when the motor is stopped 0 Do not switch output when the motor is stopped. The switch output function reduces power dissipation in the motor by switching the excitation on and off at a few kilohertz, after the motor has stopped. 4 1 Use the external clock (48.675kHz) to define step rates 0 Use the internal clock (12.5kHz) This depends on the range of speeds you wish the motor to cover. See below. 3 1 Positive logic motor drive. Use this when using the onboard driver 0 Negative logic motor drive 2 1 Half-step mode 0 Full-step mode 1 x 0 x Motor type: see below
Motor type:
bit 1 bit 0 motor type 1 1 5-phase 1 0 4-phase 0 1 3-phase
This command must be used after a reset or power-up and whenever motor parameters are changed
Note: the on-board driver does not support 5 phase motors.
Bits 3,2,1 and 0 cannot be changed once they are defined, except by resetting the controller IC. The other bits and the data bytes can be changed, by re-issuing this command.
The pull-in rate is the highest step rate at which the motor can start without losing steps. The value of Byte 1 is the number by which the clock is to be divided to give this rate. For example, if the pull-in rate is 345 steps/second and the clock frequency is 48.675 kHz, the value of this byte is 48675/345, which is 141.
This defines the maximum speed which the motor can reach, and is calculated as for Byte 1 above. For example, if the maximum speed is 825 steps/second and the clock is 48.675 kHz, this byte is 48675/825, which is 59.
These bytes form a 16-bit number which defines how many steps the motor takes to accelerate from the pull-in rate defined by Byte 1 to the maximum speed defined by Byte 2, and to decelerate at the end of the motion. Byte 3 is the less-significant byte of the two. For example, if the motor takes 400 steps to accelerate, Byte 3 is 144 (decimal) and Byte 4 is 1, because 1x256 + 144 equals 400.
To produce smooth acceleration and deceleration, the largest possible divisors should be used for Byte 1 and Byte 2. This is why there is a choice of clock frequencies, as defined by bit 4 of the initialisation command byte. Note also that divisors Less than 5 should not be used.
Motion commands have zero to four data bytes, depending on the command.
There are eight motion commands, which are described in detail below. Each motion command byte contains 3 bits which identify the command, one bit which defines clockwise (cw) or counter clockwise (ccw) rotation and one bit which defines whether an interrupt is generated when the command is finished. If an interrupt is generated, it can be cleared by reading the finish status (see below).
With commands 3 to 7, Limit switches may be used. There are four limit switch inputs, L1 to L4, and one reference input, referred to as CNP. The limit switches should be organised according to the following scheme.
L2 L4 CNP L3 L1 <- CCW motion CW ->
This means that L2 and L1 are emergency stop limits for counter clockwise and clockwise motion, and L4 and L3 are the points at which deceleration starts, for those commands which use deceleration. CNP is intended to be used as a reference point to calibrate motor position at start-up.
The format of a motion command byte is as follows:
Bit Value Function 7 (msb) 0 Always 0 for a motion command byte 6 1 Always 1 for a motion command byte 5 x May be either 0 or 1 4 1 No interrupt on finishing a command 0 Interrupt on finishing a command 3 1 Rotate ccw 0 Rotate cw 2 x 1 x Command number 0 (lsb) x
No data bytes
Sending this command will stop the motor instantaneously. A 'read register' command can report how many steps are left to complete the aborted command, so the motor can be subsequently restarted. However, inertia may carry the motor a few steps further, so if this command is used at high speed, the motor position should be recalibrated.
No data bytes
This command will also stop the motor, but if the command which is aborted is command 3 or 6, which produce accelerating motion, the motor will decelerate to a stop. If other commands are aborted, the motor will stop abruptly.
No data bytes
This command moves the motor by one step, clockwise or counter clockwise, unless it is at a limit, in which case it can only be stepped out of the limit.
Three data bytes
This is a frequently used command, and is the quickest way of making the motor move from one position to another. It moves the motor by the number of steps defined by the three data bytes, accelerating it from the pull-in speed to the maximum speed, as defined by the initialisation command. If the acceleration and deceleration take more steps than the motor is asked to move, the motor wig LI accelerate at the defined rate, but will not reach its maximum speed. The three data bytes form a 24-bit word defining the number of steps to move, and are sent least-significant byte first. The motor actually moves one step more than the number sent. For example, sending data bytes 0,0,0 moves the motor one step. Sending data bytes 255,255,255 (decimal) moves the motor 16,777,216 steps. Sending data bytes of 32,3,0 (decimal) moves the motor 800 steps.
This command will take note of limit switch inputs L3 and L4 to trigger deceleration, and of limit switch inputs L1 and L2 to stop the motor.
Four data bytes
This command moves the motor at a constant speed defined by the value of data
Byte 1, by the number of steps defined by data bytes 2, 3 and 4.
Byte 1 is calculated in the same way as the initialisation speed data, and bytes 2 to 4 are calculated as above. In this command only the emergency stop limit swi tches will stop the motor.
One data byte
This command moves the motor at the speed defined by the data byte until a limit switch input (emergency stop) is received. The data byte is calculated in the same way as the initialisation speed data. The command is often used after power-up to set the motor to one end-stop, so that it can then move in a defined direction to find the reference point.
No data bytes
This command also moves to the Limit, but does it at the maximum speed defined in the initialisation command, using acceleration and deceleration. The deceleration limit switches will bring the motor to a decelerating stop, and the emergency stop limit switches will stop the motor abruptly.
One data byte
This command moves the motor at a constant speed as defined in the data byte until the CNP reference input is detected. If any limit switch is detected, the motor will stop abruptly.
No data bytes are written and one or three data bytes are read.
These commands are used to discover the state of the motor when it is stopped, for example to see if it at a limit switch or to read back how many steps are left in an aborted command. The data bytes are read from the data register.
The format of a read register command byte is as follows:
Bit Value Function 7 (msb) 1 Always 1 for a read register command byte 6 0 Always 0 5 0 Always 0 4 0 Always 0 3 0 Always 0 2 0 Always 0 1 x Command number 0 (lsb) x
One data byte read
This command shows why the motor stopped. The format of the data byte read back is as follows:
[ Bit Value Function 7 (msb) 1 Always 1 6 1 Emergency or decelerating stop 5 1 Motor 'on' (MON) input is low (not active) 4 1 An L1 or L2 limit switch was detected and stopped the motor 3 1 An L3 or L4 limit switch was detected and stopped the motor 2 x 1 x Command number of aborted command 0 (lsb) x
Reading finish status with if this is enabled.
this command will clear the end of command interrupt
The format of a read register command byte is as follows:
One data byte read
Bit Value Function 7 (msb) 1 Always 1 for a read register command byte 6 0 Always 0 5 0 Always 0 4 0 Always 0 3 0 Always 0 2 0 Always 0 1 x Read Register Command number 0 (lsb) x
This returns the state of the inputs at the point where the format of the data byte is as follows:
Bit Value Function 7 (msb) 0 At reference point (CNP) 6 State of MON input 5 Not used 4 Not used 3 0 At cw limit (L1) 2 0 At ccw limit (L2) 1 0 At cw deceleration point (L3) 0 0 At ccw deceleration point (L4)
One data byte read
This returns the state of the outputs of the controller, as follows:
Bit Value Function 7 (msb) S1 phase output 6 S2 phase output 5 S3 phase output 4 S4 phase output 3 S5 phase output 2 HOLD output 1 0 cw motion 1 ccw motion 0 not used
Three data bytes read
This command reads back how many steps are left uncompleted in an aborted command. Three data bytes should be read. The first byte is the least significant and the third byte is the most significant.