; On-Boot script for OpenPNP on Liteplacer Mod with Smoothieware edge on Azteeg X5 32bit + 5 x TMC2660 Stepper drivers ; May 2018, mark@makr.zone ; This script sets up the Trinamic TMC2660 drivers ; X Axis (OpenBuilds NEMA17 Stepper http://openbuildspartstore.com/nema-17-stepper-motor/ ) M911.3 P1 O7 Q0 ; Set stallGuard threshold and filtering M911.3 P1 S5 Z1 ; Enable coolStep(tm) M911.3 P1 H350 I50 J2 K2 L0 ; Parametrize coolStep(tm) ; H=minimum stallGuard value (torque reserve) when current should be incremented ; I=hysteresis for stallGuard value before current should again be decremented ; J=decrement current setting by 1 when so many stallGuards samples are over minimum+hysteresis ; (0: 32, 1: 8, 2: 2, 3: 1) ; K=increment current by this value when a stallGuards sample is under the minimum ; (0: 1, 1: 2, 2: 4, 3: 8) ; L=lower current limit (0: half current, 1: quarter current) M911.3 P1 S1 U2 V24 W0 X12 Y0 ; Parametrize spreadCycle(tm) config ; U=constant off time in 12 + (32 * U) ~15MHz clock cycles ; (the shorter, the smoother and faster the motor can turn but the higher the driver losses; long off times lead to audible noise) ; V=blanking time in ~15MHz clock cycles ; W=hysteresis start : how much the current is over the hysteresis end, before the power is cut and the slow decay is started by shortening the coil (1 .. 8) ; X=hysteresis end : how much the current is over the target current, before fast decay is started by reversing the coil (-3 .. 12) ; Y=hysteresis decrement : puts a time limit on the two chopper half-cycles on-time + slow-decay / fast-decay + 2nd slow decay ; the hysteresis is decrement every 16 * Y ~15MHz clock cycles; when it reaches zero the half-cycle is terminated regardles of real decay M911.3 P1 S2 Z1 ; Set random off time on M911.3 P1 S4 Z1 ; Set microstep interpolation M906 X1680 ; With coolStep and the chopper configured, we can now increase the max current to the full 1.68A peak ; Y Axis (OpenBuilds NEMA23 Stepper http://openbuildspartstore.com/nema-23-stepper-motor/ ) M911.3 P2 O7 Q0 ; Set stallGuard threshold and filtering M911.3 P2 S5 Z1 ; Enable coolStep(tm) M911.3 P2 H250 I50 J1 K2 L0 ; Parametrize coolStep(tm) ; H=minimum stallGuard value (torque reserve) when current should be incremented ; I=hysteresis for stallGuard value before current should again be decremented ; J=decrement current setting by 1 when so many stallGuards samples are over minimum+hysteresis ; (0: 32, 1: 8, 2: 2, 3: 1) ; K=increment current by this value when a stallGuards sample is under the minimum ; (0: 1, 1: 2, 2: 4, 3: 8) ; L=lower current limit (0: half current, 1: quarter current) M911.3 P2 S1 U2 V36 W2 X12 Y0 ; Parametrize spreadCycle(tm) config ; U=constant off time in 12 + (32 * U) ~15MHz clock cycles ; (the shorter, the smoother and faster the motor can turn but the higher the driver losses; long off times lead to audible noise) ; V=blanking time in ~15MHz clock cycles ; W=hysteresis start : how much the current is over the hysteresis end, before the power is cut and the slow decay is started by shortening the coil (1 .. 8) ; X=hysteresis end : how much the current is over the target current, before fast decay is started by reversing the coil (-3 .. 12) ; Y=hysteresis decrement : puts a time limit on the two chopper half-cycles on-time + slow-decay / fast-decay + 2nd slow decay ; the hysteresis is decrement every 16 * Y ~15MHz clock cycles; when it reaches zero the half-cycle is terminated regardles of real decay M911.3 P2 S2 Z1 ; Set random off time on M911.3 P2 S4 Z1 ; Set microstep interpolation M906 Y2800 ; With coolStep and the chopper configured, we can now increase the max current to the full 2.8A peak ; Z Axis (Robot Digg Threaded Rod NEMA17 Stepper http://www.robotdigg.com/product/100/150mm-Tr8*8-Acme-Leadscrew-Threaded-Rod-Nema17-Stepper-Motor ) M911.3 P3 O7 Q0 ; Set stallGuard threshold and filtering M911.3 P3 S5 Z1 ; Enable coolStep(tm) M911.3 P3 H250 I50 J1 K2 L0 ; Parametrize coolStep(tm) ; H=minimum stallGuard value (torque reserve) when current should be incremented ; I=hysteresis for stallGuard value before current should again be decremented ; J=decrement current setting by 1 when so many stallGuards samples are over minimum+hysteresis ; (0: 32, 1: 8, 2: 2, 3: 1) ; K=increment current by this value when a stallGuards sample is under the minimum ; (0: 1, 1: 2, 2: 4, 3: 8) ; L=lower current limit (0: half current, 1: quarter current) M911.3 P3 S1 U2 V36 W2 X12 Y0 ; Parametrize spreadCycle(tm) config ; U=constant off time in 12 + (32 * U) ~15MHz clock cycles ; (the shorter, the smoother and faster the motor can turn but the higher the driver losses; long off times lead to audible noise) ; V=blanking time in ~15MHz clock cycles ; W=hysteresis start : how much the current is over the hysteresis end, before the power is cut and the slow decay is started by shortening the coil (1 .. 8) ; X=hysteresis end : how much the current is over the target current, before fast decay is started by reversing the coil (-3 .. 12) ; Y=hysteresis decrement : puts a time limit on the two chopper half-cycles on-time + slow-decay / fast-decay + 2nd slow decay ; the hysteresis is decrement every 16 * Y ~15MHz clock cycles; when it reaches zero the half-cycle is terminated regardles of real decay M911.3 P3 S2 Z1 ; Set random off time on M911.3 P3 S4 Z0 ; Set microstep interpolation M906 Z1200 ; With coolStep and the chopper configured, we can now increase the max current to the full 1.2A peak ; A Axis (NEMA14 Stepper http://www.omc-stepperonline.com/09-nema-14-bipolar-stepper-motor-5ncm7ozin-14hm080504s-p-85.html ) M911.3 P4 O7 Q0 ; Set stallGuard threshold and filtering M911.3 P4 S5 Z1 ; Enable coolStep(tm) M911.3 P4 H450 I50 J2 K2 L0 ; Parametrize coolStep(tm) ; H=minimum stallGuard value (torque reserve) when current should be incremented ; I=hysteresis for stallGuard value before current should again be decremented ; J=decrement current setting by 1 when so many stallGuards samples are over minimum+hysteresis ; (0: 32, 1: 8, 2: 2, 3: 1) ; K=increment current by this value when a stallGuards sample is under the minimum ; (0: 1, 1: 2, 2: 4, 3: 8) ; L=lower current limit (0: half current, 1: quarter current) M911.3 P4 S1 U2 V24 W0 X12 Y0 ; Parametrize spreadCycle(tm) config ; U=constant off time in 12 + (32 * U) ~15MHz clock cycles ; (the shorter, the smoother and faster the motor can turn but the higher the driver losses; long off times lead to audible noise) ; V=blanking time in ~15MHz clock cycles ; W=hysteresis start : how much the current is over the hysteresis end, before the power is cut and the slow decay is started by shortening the coil (1 .. 8) ; X=hysteresis end : how much the current is over the target current, before fast decay is started by reversing the coil (-3 .. 12) ; Y=hysteresis decrement : puts a time limit on the two chopper half-cycles on-time + slow-decay / fast-decay + 2nd slow decay ; the hysteresis is decrement every 16 * Y ~15MHz clock cycles; when it reaches zero the half-cycle is terminated regardles of real decay M911.3 P4 S2 Z1 ; Set random off time on M911.3 P4 S4 Z1 ; Set microstep interpolation M906 A500 ; With coolStep and the chopper configured, we can now increase the max current to the full 0.5A peak ; B Axis (OpenBuilds NEMA17 http://openbuildspartstore.com/nema-17-stepper-motor/ ) M911.3 P5 O7 Q0 ; Set stallGuard threshold and filtering M911.3 P5 S5 Z1 ; Enable coolStep(tm) M911.3 P5 H350 I50 J2 K2 L0 ; Parametrize coolStep(tm) ; H=minimum stallGuard value (torque reserve) when current should be incremented ; I=hysteresis for stallGuard value before current should again be decremented ; J=decrement current setting by 1 when so many stallGuards samples are over minimum+hysteresis ; (0: 32, 1: 8, 2: 2, 3: 1) ; K=increment current by this value when a stallGuards sample is under the minimum ; (0: 1, 1: 2, 2: 4, 3: 8) ; L=lower current limit (0: half current, 1: quarter current) M911.3 P5 S1 U2 V24 W0 X12 Y0 ; Parametrize spreadCycle(tm) config ; U=constant off time in 12 + (32 * U) ~15MHz clock cycles ; (the shorter, the smoother and faster the motor can turn but the higher the driver losses; long off times lead to audible noise) ; V=blanking time in ~15MHz clock cycles ; W=hysteresis start : how much the current is over the hysteresis end, before the power is cut and the slow decay is started by shortening the coil (1 .. 8) ; X=hysteresis end : how much the current is over the target current, before fast decay is started by reversing the coil (-3 .. 12) ; Y=hysteresis decrement : puts a time limit on the two chopper half-cycles on-time + slow-decay / fast-decay + 2nd slow decay ; the hysteresis is decrement every 16 * Y ~15MHz clock cycles; when it reaches zero the half-cycle is terminated regardles of real decay M911.3 P5 S2 Z1 ; Set random off time on M911.3 P5 S4 Z1 ; Set microstep interpolation M906 B1680 ; With coolStep and the chopper configured, we can now increase the max current to the full 1.68A peak G4 S1 ; wait a sec ;G28 ; go home, will you M84 ; the above commands enable the motors - disable for now