AND8399/D How to Measure Bemf on the SLA-pin Prepared by: Tom De Ryck ON Semiconductor http://onsemi.com APPLICATION NOTE Abstract measured 4 times per electrical period. Although the Bemf voltage can be measured 4 times per electrical period, it does not mean that it will be measured 4 times. The Bemf voltage will only be sampled by the motor driver if a microstep position is located on the “coil current zero crossing”. Only then a correct representation (Note 1) of the Bemf voltage can be measured on the SLA−pin. If no microstep position is located on the “coil current zero crossing”, an incorrect value will be measured on the SLA−pin. To enable the possibility to build very accurate stall− and steploss algorithms as also torque adaptive applications, AMIS−305xx has a Speed and Load Angle (SLA) pin which outputs a voltage that reflects the Bemf (Back Electro Magnetic Force) voltage of the motor. To prevent incorrect use of the SLA−pin, this application note describes how the motor driver should be operated to measure the correct Bemf voltage on the SLA−pin. Introduction The Bemf is sampled every so called “coil current zero crossing”. Per coil 2 zero−crossing positions exist per electrical period, resulting in a total of 4 zero crossings per electrical period. Or in short, the Bemf voltage can be IY Coil Current Zero Crossings Next figures display 4 of the in total 7 stepping modes possible with AMIS−305xx. Icoil IY Start IX IX Start t Figure 1. Full Step Mode 1. The voltage measured on the SLA−pin only represents the Bemf voltage. Depending on the SLA Gain setting (see Ref 1) the SLA voltage will be equal to 1/2 or 1/4 of the real Bemf voltage. © Semiconductor Components Industries, LLC, 2010 August, 2010 − Rev. 2 1 Publication Order Number: AND8399/D AND8399/D Icoil IY “coil current zero crossing” IY Start IX IX Start t “coil current zero crossing” Figure 2. Half Step Compensated Mode IY Icoil IY Start “coil current zero crossing” IX IX Start t “coil current zero crossing” Figure 3. 1/4th Stepping Mode IY “coil current zero crossing” Icoil Start IY IX IX Start t “coil current zero crossing” Figure 4. 1/8 Stepping Mode As displayed in above figures, a microstep position is located on the “coil current zero crossing” except for full step mode (Note 2). Only if a microstep position is located on the “coil current zero crossing”, a correct representation of the Bemf voltage can be measured on the SLA−pin. 2. See the Full Step Stepping Mode section for more info on full step steppingmode. http://onsemi.com 2 AND8399/D The several stepping modes of AMIS−305xx offers a lot of flexibility but at the same time could also cause problems when not used in a correct way. Figure 5 displays what could go wrong when switching between stepping modes is done in an incorrect way. IY IY IY IX IX IX Motor is in full step position, stepping mode is 1/8 stepping NXT−pulse is applied. 1/8 of a full step is set. Stepping mode is changed to half stepping and several NXT− pulses are applied Figure 5. Changing of Stepping Mode in an Incorrect Way not sample the Bemf voltage and an incorrect representation of the Bemf voltage will be measured on the SLA−pin. Next figure displays again half stepping but now with the offset included (as displayed on the right side of Figure 5). Above figure demonstrates that care should be taken when changing the stepping mode to a lower resolution. When changing to a lower stepping mode, it is possible that an offset is created resulting in no microstep position at the “coil current zero crossing”. The stepper motor driver will Icoil IY IY IX No microstep at the zero current crossing! IX t No microstep at the zero current crossing! Figure 6. Half Stepping with Offset moment. Changing to a lower resolution may only be done if the Microstep Position is also present in the lower stepping mode. More info on Table 1 can be found in the SLA Check section. Table 1 on page 7 can be used to know at which Microstep Position (see Status Register 3 of AMIS−305xx) the stepping mode may be changed without creating an offset. Changing to a higher resolution can be done at any http://onsemi.com 3 AND8399/D In the second plot (Figure 8) an offset is created. No microstep position is located on the “coil current zero crossing”. The voltage measured on the SLA−pin will not represent the real Bemf voltage of the stepper motor. Below oscilloscope plots display the coil currents and the SLA voltage measured at 1/8 microstepping. In the first plot (Figure 7) no offset is created resulting in a microstep position on the “coil current zero crossing”. The voltage measured on the SLA−pin will represent the real Bemf voltage of the stepper motor. Y−coil X−coil VSLA X−coil “Coil current zero crossing” Y−coil Microstep position is located at the zero current crossing (= full step position). The measured SLA voltage (VSLA) will be a correct representation of the Bemf voltage. VSLA Figure 7. Oscilloscope Plot of 1/8 Microstepping with Microstep Position Located at the Zero Current Crossing http://onsemi.com 4 AND8399/D X−coil VSLA X−coil Y−coil “Coil current zero crossing” Because there is an offset created, no microstep position is located at the zero current crossing (= full step position). The measured SLA voltage (VSLA) will not represent the real Bemf voltage. VSLA Figure 8. Oscilloscope Plot of 1/8 Microstepping with No Microstep Position Located at the Zero Current Crossing http://onsemi.com 5 AND8399/D SLA Check IY Although the microcontroller controls the stepper motor driver, it’s always possible that an offset is created unwontedly. By reading out the Microstep Position (Status Register 3) the microcontroller can check if an offset is created or not. Table 1 displays all possible Microstep Positions for all stepping modes except full step. If at any moment the read out Microstep Position is equal to a value given in this table (for a certain stepping mode), no offset is created (see also Figure 9). If another value is read out, an offset is created and no microstep position will be located on the ”coil current zero crossing” (see also Figure 10). The SLA−voltage will not represent the real Bemf of the stepper motor. 116 112 108 104 100 120 124 0 4 8 12 16 96 92 88 84 80 76 20 24 28 32 IX 36 40 44 48 72 68 64 60 56 52 Figure 9. Possible Microstepping Positions for Correct Bemf Measurement (1/8 Microstepping) IY 126 2 6 122 10 118 14 114 110 106 102 98 18 22 16 94 90 86 82 34 38 42 46 30 78 74 70 66 62 58 54 IX 50 Figure 10. Example of 1/8 Microstepping with Offset http://onsemi.com 6 AND8399/D Table 1. MICROSTEP POSITIONS FOR DIFFERENT STEPPING MODES (no offset) Stepping Mode Stepping Mode 1/32 1/16 1/8 1/4 1/2 1/32 0 0 0 0 0 43 1 2 44 2 46 4 4 48 6 50 8 8 8 52 10 54 12 12 14 56 14 58 16 16 16 16 17 18 62 20 20 64 22 66 24 24 24 68 26 28 70 28 28 72 30 32 74 32 32 32 33 34 36 80 38 41 42 40 40 54 88 98 56 56 56 58 60 62 64 64 64 68 96 98 100 100 102 104 104 104 106 108 108 110 111 112 70 112 112 112 113 114 72 72 114 115 116 74 116 116 117 118 76 118 119 120 78 120 120 121 122 80 80 80 82 122 123 124 124 125 126 84 96 109 110 80 96 107 108 66 76 96 105 106 72 94 103 104 68 92 101 102 64 92 99 100 60 90 97 83 84 42 96 81 82 40 88 95 79 39 40 52 75 78 36 52 77 37 38 32 76 34 35 36 94 73 31 88 1/2 93 71 29 30 50 69 27 1/4 91 92 67 25 26 48 65 23 24 48 63 21 22 48 61 19 20 90 48 59 60 18 1/8 89 57 15 16 88 46 55 13 1/16 87 53 11 12 1/32 86 51 9 10 44 1/2 49 7 8 44 1/4 47 5 6 1/8 45 3 4 1/16 Stepping Mode 84 85 http://onsemi.com 7 127 126 124 120 112 AND8399/D Transparency Mode get all the current out of the coil), the coil voltage will clamp to the power supply voltage (VBB) + 0.6 V. Once the coil current is zero, the coil voltage will decay (transient behavior). The coil voltage will decay to the Bemf voltage of the stepper motor. It’s only at that moment that the coil voltage will be equal to the Bemf voltage of the motor! It’s not 100% correct to say that the voltage on the SLA−pin will represent the real Bemf voltage of the stepper motor if a microstep position is located at the “coil current zero crossing”. At the moment the current less state is entered, the coil voltage is measured. Because at that moment the coil current will not yet be zero (it takes time to I coil t I coil Current Decay Next Microstep Next step Coil Current Zero Crossing Next step Previous Microstep t V coil V BB + 0.6V Voltage Transient V BEMF t Figure 11. Coil Voltage Behavior During Current Less State To help determining if this is the case, AMIS−305xx has a so called ‘transparent’ mode. In this mode the coil voltage during the current less state can be measured on the SLA−pin. This makes it possible to monitor the transient behavior of the coil voltage during this stage and to verify if the real Bemf voltage of the stepper motor can be sampled. If the speed of the stepper motor is set too high, it’s possible that the next (micro)step is set before the transient behavior has ended. If this is the case, the voltage on the SLA−pin will never represent the real Bemf voltage. http://onsemi.com 8 AND8399/D In this mode the coil voltage is also sampled at the PWM rate when the coil current is zero but the voltage on the SLA−pin is only updated from the moment the “coil current zero crossing” state is left (see also Figure 12). The transient behavior will not be seen by the microcontroller (which is also not needed for most applications). Keep in mind that the SLA voltage is only updated when leaving the current less state. The SLA voltage measured during the current less state will actually represent the Bemf voltage of the previous full step. When working in ‘transparent’ mode, the SLA voltage will be updated at the rate of the PWM frequency when the motor is located in the “coil current zero crossing”. The transient behavior can be monitored. As can be seen in Figure 12, the transient behavior has ended before the next (micro)step is set. The real Bemf voltage of the stepper motor can be measured. Verifying the transient behavior of the coil voltage during the current less state is only done during development (for most applications). In the final application it’s not needed to sample this complete transient behavior. For this AMIS−305xx has a so called ‘not transparent’ mode. http://onsemi.com 9 AND8399/D Icoil t Icoil Current Decay Next Microstep Next step Coil Current Zero Crossing Next step Previous Microstep PWM Rate t Vcoil VBB + 0.6V VBEMF Transient behavior VSLA t Last sample before leaving zero crossing is retained. Transparent Mode t VSLA Bemf of previous zero crossing. SLA voltage is only updated after current−less state is left+ a certain delay (50us at room temp). Not Transparent Mode t Figure 12. Voltage Measured on the Coil and SLA−pin for ‘Not Transparent’ Mode http://onsemi.com 10 AND8399/D Maximum Operating Speed Step 5: As explained in Transparency Mode, one needs to be careful when to measure the BEMF. After the start of the coil current zero crossing it takes some time before the real BEMF can be measured (see Figure 11). Leaving the coil current zero crossing stage too early will result in an incorrect BEMF sampling (= the measured voltage on the SLA−pin will not represent the real BEMF). This will limit the maximum operating speed. The maximum operating speed will depend on next parameters: − Stepper motor − Coil current − Operating voltage − Stepping mode It’s best to choose a stepper motor with low series resistance (few Ohms or less). For high speed applications it will also be important to choose a stepper motor with low inductance. The coil current has to be defined in such a way that enough torque is produced by the stepper motor to rotate the load without loosing steps. For silent operation, a high stepping mode is advised. But as will be seen later, this will limit the maximum rotation speed. The operating voltage will depend on the used motor, operating speed and coil current. It’s important to operate the stepper motor within his operating range. Finding the maximum operating speed can best be done by measuring. For this the AMIS−3052x Evaluation Kit can be used. This Evaluation Kit can be ordered from the ON Semiconductor website (www.onsemi.com). Below steps explain how to determine the maximum operating speed by using the AMIS−3052x EVK. Step 1: Remove capacitor C3 from the AMIS−3052x Motherboard (schematics and layout can be found in the Graphical User Interface). This capacitor will filter the SLA signal. Although it’s advised to add this capacitor in the final application, this capacitor will influence our measurement and should be removed. Step 2: Build the Evaluation Kit setup (see documentation provided with the Evaluation Kit). Make sure that the correct operating voltage is used (connect your own power supply if needed) and that the correct stepper motor is used. Step 3: Do not connect any signal to the NXT−pin! Step 4: Press the CLR−pin one time to clear the digital. Step 6: Step 7: Step 8: Set the Coil Current and Stepping Mode (Control Register 0). Set SLA Transparency to Transparent and enable the motor driver (Control Register 2). Connect the NXT signal. Set the NXT frequency very low. Rotor should be rotating very slowly resulting in no BEMF. Verify if there is no offset created by reading the Microstepping Position (Status Register 3). This can easily be done by enabling Check SLA Output in the Graphical User Interface (GUI) of the AMIS−3052x Evaluation Kit (see Figure 13). When checked, the Microstepping Position will color red if an offset is created (when Status Register 3 is read out). Figure 13. Check SLA Output Step 9: http://onsemi.com 11 If the Microstepping Position colors red after reading out SR3, go back to Step 1! Measure the coil current in one of the coils, measure the voltage on the SLA−pin and monitor the NXT−pin. Best is to trigger the oscilloscope on the coil current zero crossing. Figure 14 gives the results measured with a Nidec Servo stepper motor operated at 12 V and 415 mA coil current. Stepping mode was set to 1/8 microstepping. A zoom is taken on the coil current zero crossing. At the rising edge of the NXT signal (purple curve) the coil current will be regulated to zero. Notice that the SLA voltage (yellow curve) claps to 5 V. This is because the coil voltage (not visible on the oscilloscope plot) will clamp to Vbat + 0.6 V (see Figure 11). After this you see the SLA voltage drop to zero. This is the transient part (see Figure 11). Keep in mind that the SLA voltage is only update at the PWM frequency rate (this gives the steps in the SLA voltage). AND8399/D 155us Latest noticeable step in SLA voltage (SLA voltage approx. 0V). Figure 14. Define Maximum Operating Speed The time measured between the rising edge of the NXT signal (purple curve) and the latest noticeable step in the SLA voltage (yellow curve) will define the maximum operating speed. As can be seen in Figure 14 this time is about 155 ms. Knowing that the stepping mode taken is 1/8 microstepping and that the coil current zero crossing should at least take 155 ms, the maximum NXT frequency is: 1 155 ms + 6450 Hz (eq. 1) This will result in a velocity of: 6450 Hz 8 + 806 FS sec (eq. 2) Figure 15 displays the result at 800 FS/sec (close to the maximum speed). The measured SLA voltage at this speed will still represent the real BEMF (measured at the end of the zero crossing). http://onsemi.com 12 AND8399/D Figure 15. SLA Voltage at 800 Full Steps / sec Notice the stable SLA−voltage in Figure 16 when the SLA Transparency is set to Not Transparent (Control Register 2). In Not Transparent the clamping and transient behavior is removed from the SLA signal giving a better view on the BEMF (see also Figure 12). http://onsemi.com 13 AND8399/D Figure 16. SLA Voltage at Maximum Speed in Not Transparent Mode too fast resulting in an incorrect SLA voltage (see Figure 17). The jumps in the SLA voltage is because the coil current zero crossing is left too early and the transient part is sampled (see also Figure 11). Notice in Figure 16 that the measured SLA voltage is about 2.5 V. If the measured voltage would be clamped to 5 V it’s possible that the generated BEMF is too high. Set the SLA Gain to 1/4 (Control Register 2). When the NXT frequency is increased to 7 kHz (875 FS/sec), the BEMF is sometimes sampled http://onsemi.com 14 AND8399/D Figure 17. Too High Speed Results in Incorrect BEMF Sampling − Choose a lower stepping mode (1/4 instead of 1/8 for instance). This will result in longer coil current zero crossings. A trick to increase the maximum operating speed without the need of changing any of the above parameters is by stretching the coil current zero crossing. This principle is also used in AMIS−3062x (see www.onsemi.com) and is called MinSamples. See Application Note AND8371/D for more info on this. If the maximum operating speed is lower than the required operating speed, some of the application parameters need to be changed to increase the maximum operating speed. Next are some possible adjustments that could be done. − Choose stepper motor with lower series resistance − Choose stepper motor with lower inductance. Keep in mind that this will have an effect on the torque! − Increase the operating voltage − Choose a lower coil current. Keep in mind that this will result in a lower torque. http://onsemi.com 15 AND8399/D Full Step Stepping Mode 2. Set coil current. Set the stepping mode to compensated half step. 3. Enable the motor driver (stepper motor should be located in a full step position) 4. Every time a full step has to be set, apply two NXT−pulses fast after each other (keeping NXT−pin limitations in mind). In the next figure one can see that the stepper motor is running in full step mode although the stepping mode of AMIS−305xx is set to compensated half step. Because of the relative high inductance of the motor, the very short time between the two NXT−pulses (see zoomed part of Figure 18) and the internal delay of the driver, the half step position will never be reached on time. The stepper motor will run in full step mode. All explanation given above is only valid if the stepping mode is not set to full step. This is because after a hard reset of the motor driver, full step mode will always start from a half step position meaning that no microstep position will be located on the “coil current zero crossing” (see also Figure 1). Creating an offset on purpose to move the step positions to a “coil current zero crossing” will not be possible making Bemf measurement in this stepping mode impossible. There is however a possibility to operate the stepper motor in full step mode and measure the Bemf voltage. Follow next steps to operate the stepper motor in full step mode by using AMIS−305xx half step stepping mode setting. 1. Reset motor driver http://onsemi.com 16 AND8399/D Y−coil X−coil VSLA VNXT The current rise and fall time are too high to reach the half step position. The stepper motor will run in full step. Y−coil X−coil VSLA VNXT Apply two NXT−pulses fast after each other. Figure 18. Operating Stepper Motor in Full Step by Using Half Step Stepping Mode http://onsemi.com 17 AND8399/D High Temperature When operating the stepper motor driver at high temperature it is possible that the SLA voltage drops between two samples taken. This could create unwanted results. For this reason it’s important to measure the SLA voltage as fast as possible after it has been updated. Next oscilloscope plot displays the problem. “Coil current zero crossing” Between two SLA measurements (= full step positions), the SLA voltage drops because of the high IC temperature. Sampling the SLA voltage too late could result in an incorrect Bemf voltage interpretation. Figure 19. Decrease of SLA−voltage at High Temperature Good PCB design can reduce the drop of the SLA−voltage. If a large enough PCB heat sink is foreseen or an additional head sink is used to get the heat out of the package, the die temperature will drop and the drop in SLA−voltage will reduce. As can be seen, the SLA voltage drops between two full step positions. If the SLA voltage is sampled too late by the microcontroller or DSP, an incorrect Bemf voltage interpretation will occur. If the SLA voltage is sampled right after it has been updated, the temperature effect will have a minimum influence on the result. http://onsemi.com 18 AND8399/D Sample The SLA Voltage Figure 20 gives a typical application schematic. 100 nF VDD D1 100 nF 100 nF VBAT + 100 nF C5 R2 C4 R3 DIR NXT DO DI CLK mC CS CLR ERR R1 SLA C8 C2 C3 VDD 32 VBB 14 VBB 27 VCP 11 9 CPN 5 10 4 31 2 AMIS−30521/ NCV70521 3 C1 100 mF C6 25,26 21,22 13 12 15,16 6 19,20 220 nF C7 220 nF CPP MOTXP MOTXN MOTYP M MOTYN 7 HV20081114.1 1, 17, 23, 8 18 24 30 28 29 TSTO GND Figure 20. Typical Application Schematic one knows how long the clamping and transient parts lasts (defined in section Maximum operating Speed), the microcontroller can sample the SLA voltage right after this transient part. Or to make it even simpler, the microcontroller could sample the SLA voltage at the moment the next microstep is given by the microcontroller. No need to introduce an additional delay4 as would be the case when working in Not Transparent mode (see Figure 21). When working in Transparent mode, the transient behavior will be present on the SLA−pin. The microcontroller should just ignore this. Sampling of the SLA voltage is done by the microcontroller ADC. Because the BEMF can only be sampled once per full step, it’s not needed to have a high sampling rate. The ADC resolution depends on how accurate one wants to measure the SLA voltage3. As explained in Transparency Mode, the SLA voltage is only updated after the coil current zero crossing is left (Not Transparent Mode). Keep this in mind when sampling the SLA voltage. Also, the low−pass filter (R1 and C8) will introduce a delay in the measured signal. Because the SLA voltage is updated at the PWM Frequency rate in Transparent Mode, one could already measure the BEMF during the coil current zero crossing. If 3. The coil voltage is sampled by a Sample−and−Hold circuit. There is no digital conversion done by AMIS−305xx. 4. If the stepper motor is operated close to the maximum operating speed it’s advised to introduce a delay between the NXT pulse and sampling of the SLA voltage. http://onsemi.com 19 AND8399/D Icoil t Icoil Next Microstep Next step Coil Current Zero Crossing Next step Previous Microstep t Vcoil VBB + 0.6V VBEMF t VSLA Earliest moment to sample Easiest moment to sample is at next step . Transparent Mode t VSLA Earliest moment to sample in Not Transparent Not Transparent Mode t Figure 21. Difference Between Transparent and Not Transparent Mode http://onsemi.com 20 AND8399/D Examples Below some examples are given on how to use the SLA−pin. The flowchart given in these examples represent the microcontroller firmware (see Figure 20). All examples and flowcharts given in this document are solely intended to simplify the explanation and to help you better understand how to use the SLA−pin. be initialized. When this is done, the coil current and stepping mode will be set. The motor driver will be enabled and NXT pulses will be send to rotate the motor. The timer will determine the time between NXT pulses and by this determine the rotation speed. In theory the stepper motor should be accelerated to the maximum speed but this is out of the scope of this document. We assume the speed is low enough to start without acceleration. The rotation speed must also be lower than the maximum operating speed (see Section Maximum operating Speed). Drive Motor Figure 22 displays a simple way of driving a stepper motor. In this example the SLA−pin is not used yet. The moment the application is powered, the microcontroller will Power Up Initialize microcontroller Set Coil Current Set Stepping Mode Control Register 0 Enable Motor Control Register 2 Send NXT Pulse Start Timer N Timer Overflow ? Y Figure 22. Simple Motor Control Example Above flowchart is a very simple example of driving a stepper motor. No diagnostics is done, no verification if stepper motor is rotating, ... The only intention of this example is to rotate the motor with a minimum of overhead. Driving a stepper motor in real life applications will be more complex but is out of the scope of this document. Every time a NXT pulse is send the microcontroller will check if the coil current zero crossing phase is left. If so, the microcontroller knows the SLA voltage will be updated and will sample the SLA−pin. An additional delay is added before sampling the SLA−pin (internal update delay of motor driver, see Transparency Mode). Sample SLA The flowchart in Figure 23 gives the moment when to sample the SLA voltage when working in 1/8 microstepping. http://onsemi.com 21 AND8399/D Power Up Initialize microcontroller Set Coil Current Set Stepping Mode Enable Motor Send NXT Pulse Start Timer Read Microstep Position Status Register 3 Values only valid for 1/8 micro−stepping See Table 1 for other stepping modes If MSP = (4 OR 36 OR 68 or 100) Y Delay N Sample SLA−pin Timer Overflow ? N Y Figure 23. Sample SLA voltage (1/8 microstepping) If Transparent mode is chosen, the SLA−pin could already be sampled during the coil current zero crossing. This is given in Figure 24. When the coil current zero crossing is entered, the SLA−pin will be sampled. A delay is added before sampling. In this case this delay is needed to make sure the clamping and transient phase are ended and the real BEMF is sampled (see also Figures 11 and 21). The disadvantage of above flowchart is the need to read out the Microstep Position. Because this takes time (SPI communication), this will limit the maximum operating speed. If needed the microcontroller could implement his own positioner to keep track. This would eliminate the needed SPI communication. This is however out of the scope of this document. Above flowchart can be used when transparency mode is set to Not Transparent or Transparent. However, if Transparent is used the delay before sampling of the SLA−pin can be removed. http://onsemi.com 22 AND8399/D Power Up Initialize microcontroller Set Coil Current Set Stepping Mode Enable Motor Driver Transparent Mode Send NXT Pulse Start Timer Read Microstep Position If MSP = (0 OR 32 OR 64 OR 96) Y Delay N Sample SLA−pin N Timer Overflow ? Y Figure 24. Sample SLA voltage in Transparent Mode Stall Detection Implementing the flowchart as given in Figure 25 will most probably fail. This because the SLA voltage is already sampled at the first coil current zero crossing. During start of the rotation oscillations will be seen in the BEMF (acceleration of the rotor) and by this also in the SLA voltage. It’s possible that these oscillations trigger the stall detection although no stall is present. It’s best to skip the stall detection for the first full steps. This is however out of the scope of this document. The flowchart in Figure 25 gives a simple implementation of stall detection (based on Figure 24). The sampled SLA voltage will be compared to a threshold value. If the sampled SLA voltage is below the threshold, motion will be stopped. The threshold has to be set in such a way that the sampled SLA voltage is higher than the threshold when the motor is free running. If the motor gets blocked, the BEMF will drop and by this also the SLA voltage resulting in a stall detected. Motion will be stopped. http://onsemi.com 23 AND8399/D Power Up Initialize microcontroller Set Coil Current Set Stepping Mode Enable Motor Transparent Mode Send NXT Pulse Start Timer Read Microstep Position If MSP = (0 OR 32 OR 64 OR 96) Y Delay N Sample SLA−pin SLA below Threshold ? Y N Stop Timer Overflow ? N Y Figure 25. Simple Stall Detection SLA Check The SLA voltage can not be sampled nor can stall detection be done. Figure 26 gives a simple solution to this problem. If an offset is detected, motion is stopped. In a real life application the microcontroller could do corrective actions or report the problem. This is out of the scope of this document. With the flowchart given in Figure 25 we are able to sample the SLA voltage in a correct way and to perform simple stall detection. The only issue that could occur is an offset. If for some reason an offset is created, no microstep will be located anymore on the coil current zero crossing. http://onsemi.com 24 AND8399/D Power Up Initialize microcontroller Set Coil Current Set Stepping Mode Enable Motor Transparent Mode Send NXT Pulse Start Timer Read Microstep Position If MSP = (0 OR 32 OR 64 OR 96) MSP = Microstep Position MOD = Remainder of a division Y = 2 for 1/16 microstepping, 4 for 1/8 microstepping 8 for 1/4 microstepping and 16 for half stepping Y Delay N Sample SLA−pin If MSP MOD Y = 0 SLA below Threshold ? N Timer Overflow ? N Y Stop Figure 26. SLA Check http://onsemi.com 25 Y AND8399/D Microcontroller without ADC By sampling the SLA−pin as given in Figure 26, one samples the SLA−pin at the correct moment to make sure that the real BEMF is measured. An offset will be detected as well as a stall condition. By sampling the SLA−pin at the right moment, temperature effect will be eliminated (see High Temperature). To implement above flowcharts one needs to use a microcontroller with ADC. In some cases this ADC is not available. A simple way to enable stall detection in this case is by using a comparator. Vdd Vcc Vdd Rpull −up Micro− Controller GND R1 SLA IO AMIS−305xx COMP GND R3 R2 Figure 27. Stall Detection with Comparator Working with a digital IO can also be beneficial to offload the CPU of the microcontroller. Sampling an analog value could take some time. Monitoring a digital pin gives low CPU load. R1 and R2 set the threshold level. R3 adds a hysteresis to avoid toggling caused by noise. The microcontroller can check if the SLA voltage is above or below the threshold level by monitoring the digital IO pin. The way to implement stall detection stays similar. The only difference with the flowchart in Figure 26 is that instead of sampling the SLA voltage with an ADC, the status of the IO pin is checked to determine if SLA voltage is above or below the threshold level. The moment the status of this digital IO is checked stays the same. If a variable threshold is needed, R1 and R2 can be replaced by a potentiometer or even by a digital potentiometer controlled by the microcontroller (see www.onsemi.com for Digital Programmable Potentiometers and Comparators). R3 is not mandatory but is advised to avoid toggling cause by noise on the SLA−pin. If R3 is not used, a low−pass filter should be added to the SLA−pin (see also Figure 20). Conclusion Implementing the best stall, steploss or torque adaptive algorithm is useless if the SLA−pin of AMIS−305xx is not used properly. By following some simple guidelines, the SLA−pin can be used in a correct and reliable way. References Ref 1: AMIS−305xx datasheet (www.onsemi.com) Company or Product Inquiries For more information about ON Semiconductor’s products or services visit our Web site at http://www.onsemi.com. ON Semiconductor and are registered trademarks of Semiconductor Components Industries, LLC (SCILLC). SCILLC reserves the right to make changes without further notice to any products herein. SCILLC makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does SCILLC assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation special, consequential or incidental damages. “Typical” parameters which may be provided in SCILLC data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All operating parameters, including “Typicals” must be validated for each customer application by customer’s technical experts. SCILLC does not convey any license under its patent rights nor the rights of others. SCILLC products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the SCILLC product could create a situation where personal injury or death may occur. Should Buyer purchase or use SCILLC products for any such unintended or unauthorized application, Buyer shall indemnify and hold SCILLC and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that SCILLC was negligent regarding the design or manufacture of the part. SCILLC is an Equal Opportunity/Affirmative Action Employer. This literature is subject to all applicable copyright laws and is not for resale in any manner. PUBLICATION ORDERING INFORMATION LITERATURE FULFILLMENT: Literature Distribution Center for ON Semiconductor P.O. Box 5163, Denver, Colorado 80217 USA Phone: 303−675−2175 or 800−344−3860 Toll Free USA/Canada Fax: 303−675−2176 or 800−344−3867 Toll Free USA/Canada Email: [email protected] N. American Technical Support: 800−282−9855 Toll Free USA/Canada Europe, Middle East and Africa Technical Support: Phone: 421 33 790 2910 Japan Customer Focus Center Phone: 81−3−5773−3850 http://onsemi.com 26 ON Semiconductor Website: www.onsemi.com Order Literature: http://www.onsemi.com/orderlit For additional information, please contact your local Sales Representative AND8399/D