Part # Application Notes Industrial L6207 AN2044 datasheet

Part Manufacturer: ST Microelectronics

ST Microelectronics

Part Description: Operating principals for PractiSPIN™ stepper motor motion control

Part Details:

AN2044 APPLICATION NOTE OPERATING PRINCIPALS FOR PRACTISPIN STEPPER MOTOR MOTION CONTROL 1 REQUIREMENTSIn operating a stepper motor system one of the most common requirements will be to executea relative move. The move will usually be specified as a fixed number of basic motor steps inthe clockwise or counter-clockwise direction. It is common practice to execute this move alonga trapezoidal shaped velocity vs. time profile.This profile is determined by the number of steps to be moved and the required accel, decel,and peak speed. Very often system designers require that a move be made in the shortesttime possible and in these cases the accel, decel and peak speed are set to the maximum thatthe system can achieve. Given the move distance, accel, decel, and peak speed requirement, a profile can be deter-mined. Since the control structure of the practispin software is designed such that the velocityand accel/decel rate can be changed at will, the task of pre-calculating the velocity profile boilsdown to determining the position values where operation switches from accel to constantspeed and then from constant speed to decel. Since this is a relative move, we can assumethat motion starts at position = 0, time = 0, and velocity = 0. Figure 1 shows a typical trapezoi-dal velocity vs. time profile Figure 1. Trapezoidal Velocity vs. Time Profile Let: P = total move distance in steps P1 = steps required to accel from 0 to V P2 = steps required to decel from V to 0 V = peak velocity in steps per second (steps/sec) V1 = average velocity during accel or decel Rev. 1 AN2044/0904 1/9 AN2044 APPLICATION NOTE A = required accel rate in steps per second per second (steps/sec2) D = required decel rate in steps per second per second (steps/sec2) T1 = acceleration time in seconds T2 = deceleration time in seconds 2 TRAPEZOIDAL POSITION FORMULASIf we assume that the velocity will rise from 0 to V at a constant rate of acceleration: 1) T1 = V / A2) V1 = V / 23) P1 = V1 T1 Substituting 1 and 2 into 3 yields:4) P1 = V2 / 2A In the same manner we have:5) P2 = V2 / 2D Once P1 and P2 have been calculated a check can be made to determine whether a trapezoi-dal profile is possible or whether a triangular move must be made instead. If the total numberof steps required to accel and decel ( P1 + P2 ) is less than the total move distance, P, thenthere will be some "room" left for a constant velocity portion of the profile. If, on the other hand,P1 + P2 is greater than P, then the move profile cannot be allowed to get up to the requestedspeed since just getting up to speed and back down (at the requested accel and decel) wouldcause a move that would overshoot the target position.If P1 + P2 is greater than P then a triangular rather than trapezoidal profile must be projected.With a triangular velocity profile there is no constant velocity portion of the move.The motor will accelerate at A and then abruptly switch to decelerating at D in order to "land"at the desired position at zero speed. In the case of a triangular profile we have only one im-portant parameter to calculate, that being the motor position at which the system must switchfrom accel to decel mode.The calculation is, however, somewhat more complicated than the trapezoidal case. Figure 2shows a typical triangular velocity vs. time profile. Figure 2. Triangular Velocity vs. Time Profile 2/9 AN2044 APPLICATION NOTE 3 TRIANGULAR POSITION FORMULASIn a triangular move, the total distance is the distance to accel plus the distance to decel:6) P = P1 + P2 Substituting 4 and 5 into 6 yields:7) P = V2 / 2A + V2 / 2D Multiplying both sides of 7 by 2AD to clear fractions yields:8) 2ADP = DV2 + AV2 Extracting the common factor V2 on the RHS of 8 yields:9)2ADP = V2( D + A ) Dividing both sides of 9 by 2A( A + D) yields:10)DP / ( A + D ) = V2 / 2A Substituting 4 into 10 and re-arranging yields:11)P1 = PD / ( D + A ) Equation 11 is our final result and is the most convenient form of the formula for calculatingthe position at which the mode must be switched from accel to decel for a triangular move.Please note also that this formula passes a fundamental "sanity" test. If the accel and decel rates are equal, then P1 = P / 2. This is intuitively obvious. The system would have to spend half the total distance acceleratingand the other half decelerating. As the decel rate is increased, we can spend more time accelerating before we have to "puton the brakes" to come to a stop at the required position. The Practispin stores P, D, and A as unsigned 16 bit variables. A 16 by 16 multiply subroutineis used to get the product PD, which is 32 bit. A 32 by 16 divide subroutine is used to get the quotient of PD and ( D + A ). Note: If ( D + A )overflows 16 bits then both terms are pre-divided by 2 before the main divide is executed. The same subroutines are used to calculate formulas 4 and 5 in the trapezoidal case. Pleasenote that execution time for these calculations is not critical since they are done only once permove and are completed before the move begins. 4 PRACTISPIN STEPPER MOTOR CONTROL SCHEME 4.1 20 KHZ INTERRUPTThe heart of the stepper motor control mechanism is the 20KHZ interrupt. This interrupt in-vokes an Interrupt Service Routine (ISR) which executes repeatedly on a fixed time interval of50 microseconds. In the subsequent discussion we will call this 50 microsecond interval aTICK and this will serve as our basic time unit. In order to maintain a consistent system of units we will measure position in steps, velocity insteps/tick, and acceleration/deceleration in steps/tick2. The calculation performed by the ISRamount to a real time simulation of the motion system. The ISR calculates real time values for 3/9

Please click the following link to download the datasheet:

Application Notes Industrial L6207 AN2044.pdf Datasheet