kjk25 / TMC2209_ESP32

a port of a TMC2209 Python Raspberry lib to Micropython esp32 Lolin32 Board
GNU General Public License v3.0
8 stars 5 forks source link

Stallguard fires always #4

Closed alxkos closed 11 months ago

alxkos commented 11 months ago

Getting another problem: Stallguard fires right away. only if i'm o very low speed and low acceleration. like 10,15 Here is my code:

` tmc.setDirection_reg(False) tmc.setVSense(True)

tmc.setIScaleAnalog(True) tmc.setInterpolation(True) tmc.setSpreadCycle(False) tmc.setMicrosteppingResolution(1) tmc.setInternalRSense(False)

tmc.setCurrent(200) tmc.setAcceleration(100) tmc.setMaxSpeed(100)

tmc.setMotorEnabled(True)

def my_callback(channel):
print("StallGuard!") tmc.stop()

tmc.getStallguard_Result() tmc.setStallguard_Callback(21, 1000, my_callback)

finishedsuccessfully = tmc.runToPositionSteps(2000, MovementAbsRel.relative) tmc.getStallguard_Result() if(finishedsuccessfully == True): print("Movement finished successfully") else: print("Movement was not completed")

tmc.setMotorEnabled(False)

`

Simple setup, stepper 17hs13 with 0.4A PSU is 9v Any suggestions? Badly wat to use Stallguard instead of using microswitches.

Thanks

alxkos commented 11 months ago

found the problem