Application note AN4144 describes a procedure to characterize the stepper motor for use with their voltage mode driver such as the L6470. This procedure starts from knowledge of the stepper motor (either from published values or measurements), creates an initial solution. Then a current probe is attached to one of the windings and the current through the winding is observed during a slow acceleration of the motor. This data is used to perturb the existing solution in an attempt to make the current consistent during the acceleration profile. The procedure can work fairly well, but there are several problems:
- It is not always obvious how to adjust the parameters to get the desired response.
- As the motor accelerates, the windings are heating up so the current decreases.
- The motor parameters must be known or measured.
- A current probe is required.
A semi-automated alternative approach was developed to address some of these issues. It can characterize a stepper motor using only the SPINFamily Evaluation Tool and compatible hardware.
A particularly nice feature of the evaluation tool software is that it can run Python scripts directly in the tool and the tool includes access to the L6470 device registers. The characterization process is as outlined below:
- Remove BEMF correction by setting the ST_SLP, FN_ACC_SLP, and FN_ACC_SLP registers to zero.
- Set the desired current for characterization into the STALL_TH register. This is connected to an internal current monitoring circuit. If the current exceeds the stall threshold, then it can be detected by the latched STEP_LOSS_A or STEP_LOSS_B bits in the status register.
- Start spinning the motor at a slow speed with a KVAL_RUN value high enough for the motor to spin, but not high enough to trip the stall threshold.
- Gradually increase the KVAL_RUN value until both of the STEP_LOSS status bits are clear. The current value of KVAL_RUN specifies the duty cycle required to run the motor at that speed and the specified current.
- Speed up the motor and repeat step 4 again. Repeat for all desired speeds.
This procedure is performed by the attached Python script, "characterize.py". At the completion of the script, it will print a pair of numbers: the speed in steps per second, and the KVAL_RUN value necessary to achieve the desired current. At this point, the data are processed using Excel. A plot of these quantities is shown below.
Next, the dataset was split at some point in the middle, and the two subsets were linearly fit. The split point was determined by minimizing the mean squared error. For reference, see the attached spreadsheet.
The plot below shows the raw KVAL data along with the fit. The fit looks to be good and results in the following BEMF parameters:
ST_SLP = 0x1B
FN_SLP_x = 0x2B
INT_SPEED = 0x1780
KVAL_x = 0x39
These values were tested by setting the stall threshold 3 LSBs higher than the limit and running the motor at each of the speeds and verifying that the STEP_LOSS was not reported (although it was reported on startup as the KVAL_ACC was slightly higher than the KVAL_x computed here).
The technique seems to work well and is simple to perform. There could be several problems, however, with this technique:
- It is unclear how accurate or linear the stall detection thresholds are. This would result in errors setting the current.
- The stall detection circuitry may also be sensitive to glitches and noise. This could cause premature triggering of the circuit and result in lower than expected currents.
Hopefully, this information was helpful. If you have any questions, add a comment to this thread.