ZJAllen / ShushEngine

Python stepper motor driver for TMC5160
GNU General Public License v3.0
15 stars 9 forks source link

get_position() issue #7

Closed mstopps closed 3 years ago

mstopps commented 3 years ago

get_position() appears to corrupt the tmc5160. Following a 'read' operation such as get_velocity() or get_position() , the motor becomes very rough, motor power cycling is required to 'reset' the drive. Example.py replicates the issue, commenting out m.get_position() (& Vm power rest) allows normal operation. I'm using the TMC5160-EVAL board. Any suggestions appreciated!

`

GPIO Settings

m0_cs = 8 # Mod in init_spi(self) Board.spi.no_cs = True

m0_enable = 6

import shush import time

m0 = shush.Motor(1) m0.enable_motor()

def spin(target): m0.set_VMAX(20000) m0.go_to(target)

while(True):

spin(12800)
#print(m0.get_position())           # when get_position used here (drive corrupts immediately)
time.sleep(1)
#print(m0.get_position())           # when get_position used here (drive corrupts after initial move)
spin(0)
#print(m0.get_position())           # but, when get_position used here (as in original example) all is OK
time.sleep(1)

`

mstopps commented 3 years ago

Re tested with TMC5160 BOB, all working fine! The issue appears with TMC5160-EVAL board only, spi packets to and from device are as expected, but motor drive corrupts.