uStepper / uStepper-S-lite

14 stars 4 forks source link

Microstepping #2

Closed wormyrocks closed 4 years ago

wormyrocks commented 5 years ago

It looks like the functions to control microstepping on the TMC2208 are currently unimplemented, and the MS1/MS2 pins are pulled high in the schematic, implying a default setting of 16 microsteps. Is it easy to modify the hardware to reconfigure those pins, and subsequently adjust in software?

Thanks!

uStepperOld commented 5 years ago

Hi,

In order to change the microstep setting, hardware modifications are not necessary. The microstep setting can be set by changing the value of "mstep_reg_select" bit from 0 to 1 in the "GCONF" register, and changing the value of "MRES" bits in the "CHOPCONF" register to the desired microstepping resolution (see the TMC2208 datasheet)

to change these values, you can use the "writeRegister()" function of the "TMC2208" class. however, i can see that it has been implemented as a protected function (I will change this in the next release), so in order to use it, you will need to open up "tmc2208.h" and move line 377 above line 368

also, when you call the "stepper.setup()" in the arduino setup function, you will need to adjust the "stepsPerRevolution" argument to the new microstepping (see the documentation: http://ustepper.com/docs/ustepperslite/html/classuStepperSLite.html#a522818baa29b655181ab43d6ece90cff)

I hope the above description can help you out !

Best Regards, Thomas Olsen