Save stealthChop2 auto tune parameters to read on startup
-
I just got StealthChop2 working on my Duet 3 with this macro which includes the automatic tuning sequence on X and Y
; enable_stealthChop2.g ; sets stealthChop2 parameters and uses a homing sequence for the driver to automatically tune its current regulation parameters ; default stealthChop2 parameters (for standstill noise reduction) are tpwmthrs(V)=2000, thigh(H)=200, tcoolthrs(T)=2000 ; stealthChop2 tested (under no printing conditions) flawlessly up to 150mm/s (higher speeds not yet tested) ;homing x and y in default mode of operation G91 ; relative positioning ;G1 H2 Z5 F240 ; lift z 5mm relative to current position ;enable when using this macro in conjunction with z homing G1 H1 X{-move.axes[0].max-5} Y{move.axes[1].max+5} F3600 ; move quickly to x or y endstop and stop there G1 H1 X{-move.axes[0].max-5} ; home x G1 H1 Y{move.axes[1].max+5} ; home y G1 X5 Y-5 ; back up 5mm G1 H1 X{-move.axes[0].max-5} F360 ; home x slowly (second pass) G1 H1 Y{move.axes[1].max+5} ; home y slowly (second pass) M400 ; wait for moves to finish ;enable stealthChop2 and tuning step AT#1 M18 X Y ; disable x and y steppers M569 P0.0 D3 V0 H0 ; enable stealthchop and set tpwmthrs and thigh for X M569 P0.1 D3 V0 H0 ; enable stealthchop and set tpwmthrs and thigh for Y M915 P0.0 T0 ; set tcoolthrs for X M915 P0.1 T0 ; set tcoolthrs for Y M17 X Y ; enable x and y steppers with full run current G4 P150 ; pause for 150ms to satisfy AT1 condition G92 X{move.axes[0].min} Y{move.axes[1].max} ; set home positions again after position loss due to M18 G90 ; absolute positioning ;tuning step AT#2 G1 Y{move.axes[1].max/2} F6000 ; tuning move at "typical speed" that is a straight line in order to move both steppers (CoreXY) significantly i.e. >400 full steps @ 60-300RPM ->F(150RPM*beltpitch*pulleyteeth) G1 X{move.axes[0].max/2} ; move to bed center
(stealthChop2 runs very stable up to 150mm and beyond, thus I set the H V and T parameter to 0 so that the drivers will exclusively run in stealthChop2)
After running the macro the values of pwmOfsAuto and pwmGradAuto differ from the values they have on startup. In the TMC5160 datasheet says that these values could be saved to pwmOfs and pwmGrad in the driver register as starting points for the automatic tuning process when starting up the machine. I figure with these values set I could set all the stealthChop2 parameters in the config and spare running my macro from above...
Is there a way we can do that? Maybe with the M569 C parameter? If so what would the C value be exactly?If this helps here is a table of the register these values reside in:
-
@schild0r yes it's possible, if you know what you are doing. See https://duet3d.dozuki.com/Wiki/M569.2 for how to read and write the TMC5160 registers directly.
-
@dc42 thanks, somehow i missed that there is an M569.2 command. Now I only need to find out which register it is I am looking for. Guess I'll have to go reading through them one by one til I find something familiar...
Driver register 0x70 (R112) is at 0x00000000 althought the datasheet says this would be the one I am looking for and M569 P0.0 reports that there are non zero values -
@Schild0r Just out of curiosity, why did you set your tpwmthrs, thigh, and tcoolthrs to 0? Shouldn't these values be set to a feed rate you'll use for printing?