For my last part of this road test I'm looking at the stall guard function. This works by sensing the current through the motor coils so my first step was to look at the datasheet chapter 9 on sense resistors. Thanks to jancumps for reviewing the schematic earlier in the roadtest and identifying that the evaluation board uses a 0.06Ω resistor. Note that there are two sense resistors, one for each of the motor coils.

Sense Resistors DatasheetSense Resistor

The motor current can then be determined with the following calculation and the parameters set in the registers:

Current Calcuation Current Parameters

To simplify my testing I'll set the IRun and IHold values to be the same and set the IHold to zero. I also want to ensure that the motor current is well below what the motor capabilities.

To calculate the parameters I put the equation into a google sheet: https://docs.google.com/spreadsheets/d/1a_DELRjCXUpWIEZDAQksnYStvxky-kvp0BULAeh2S6I/edit?usp=sharing

 

My initial values were iRun = 15, Global Scaler = 3 which gives a current reading of 0.62A, slightly more that the readings I'd had from the power supply when I'd did the test for driving the stepper motor.

 

There was more reading to be done at this point as the stall guard was covered in Chapter 13.

 

There's another two paramters mentioned here. TCOOLTHR and TSTEP which are covered in 6.2.

Set TCOOLTHRS to a value above TSTEP and enable sg_stop to enable the stop on stall feature. Make sure, that the motor is safely stopped whenever it is stalled. Increase SGT if the motor becomes stopped before a stall occurs. Restart the motor by disabling sg_stop or by reading and writing back the RAMP_STAT register (write+clear function).

Velocity settings

Stall Guard IDE

The sg_stop mentioned in the above text is found in the SW_MODE register an sgt (stall guard threshold) is in the COOLCONF register. These can all be viewed in the IDE via the register browser

Stall Registers

The stall guard IDE provides access to configure these registers and provides a graphical display of the resulting outputs. I applied a simple load to the 3D printed drum by grabbing the outer rim. The sg_stop flag was also set. As the load was applied the graph moved down and as it went below the threshold the motor stopped. I reset the motor using the reset button but this did not re-enable the stop on stall. So I toggled sg_stop and that did result in the stop on stall being re-enabled.

The registers don't automatically update with the stallGuard2 settings. So you need to press the button to read out all the registers.

Button "read out"

Stall Guard Screen

Note that when the motor is stopped the shaft will be locked depending on the value of the standby current (IHold). So a large load could back drive the motor if iHold is to low and the mechanical setup allows back driving.

I had initially thought that the dcStep wizard would also allow the tuning of the stallGuard2 functionality. However, that is a completely different piece of functionality and hence does not apply in this case.

dcStep is a new efficient stepper motor commutation scheme that focusses on utilizing most of the available output torque (ca. 80%) of the stepper motor. With dcStep, a stepper motor behaves like a DC motor if the load exceeds the motor output torque for the actual working point. It automatically adapts the motor velocity to the actual load by moving along the shape of the stepper motor torque curve. Due to this automatic load dependent deceleration and acceleration, the stepper motor does not lose any steps or stalls with the tradeoff of having a varying velocity. Nevertheless, it will arrive at the target position in any case without step loss. That is, dcStep keeps load and torque in balance.

Although the parameters are a little complex and scatter around the manual, the IDE screen does allow these to be easily configured and Stallguard does work as expected to protect the motor and systems from mechanical faults.