Skip to content

Sienci-Labs/Plugins_motor

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trinamic stepper driver plugins

These plugins adds settings, M-Code extensions and reports for TMC2130, TMC2209 and TMC5160 stepper drivers.

They support Marlin-style M-codes such as M122, M911, M912, M913 and M914 - some with extensions and some with sligthly different syntax.

M-codes

M122 - output debug info or reset driver.

M122 axes <H-> <S-> <Q-> <I>

  • H - 0 = SFILT off, 1 = SFILT on (TMC2130) only.
  • I - reinitialize driver.
  • S - 0 = disable StallGuard and live output of sg-value, 1 = enable StallGuard and live output.
  • Q - not yet enabled.

Examples:
M122 - output debug info for all enabled drivers. This is a plain text report, do not issue from a sender!
M122 Y - output debug info for Y axis only. This is a plain text report, do not issue from a sender!
M122 I - reset drivers.
M122 X S1 - enable live output of StallGuard value for tuning. Do not enable when running g-code jobs!

M906 - set stepper current

M906 axes

Note: Stepper current is not permanently stored.

Example:
M122 X700 Y950

M911 - Report prewarn flags

M911

M912 - Clear prewarn flags

M912

M913 - Set hybrid threshold

M913 axes

Note: Hybrid threshold is not permanently stored.

Example:
M913 X31

M914 - Set homing sensitivity.

M914 axes

Note: Homing sensitivity is not permanently stored.

Example:
M914 X31

Settings

Settings are provided for axis enable, homing, stepper current, microsteps and sensorless homing. More to follow.

$14x - Stepper current. x = 0 for X-axis, 1 for Y axis etc.

$15x - Motor microsteps. x = 0 for X-axis, 1 for Y axis etc.

Valid values are 1, 2, 4, , 8, 16, 32, 64, 128 and 256.

$20x - StallGuard sensitivity, fast (locate) threshold. x = 0 for X-axis, 1 for Y axis etc.

Range is -64 to 63 for Stallguard2 (TMC2130, TMC5160), 0 - 255 for StallGuard4 (TMC2209).

$21x - Hold current as percentage of stepper current. x = 0 for X-axis, 1 for Y axis etc.

$22x - StallGuard sensitivity, slow (seek) threshold. x = 0 for X-axis, 1 for Y axis etc.

Range is -64 to 63 for Stallguard2 (TMC2130, TMC5160), 0 - 255 for StallGuard4 (TMC2209).

$338 - Driver enable

Parameter is a axismask where value is sum of X=1, Y=2, Z=4 etc.

NOTE: Some boards does not allow mixed drivers, for these this setting is not available.

$339 - Sensorless homing enable

Parameter is a axismask where value is sum of X=1, Y=2, Z=4 etc.

Sensorless homing requires tuning of parameters, the datasheet has information about how to:

TMC2130
TMC2209
TMC5160

Some parameters are hard coded and require recompilation/reflashing to change.

Note that tuning is not trivial, for one-off machines it is likely that endstop switches will be the best/easiest option to implement.


The driver and driver configuration has to be extended to support these plugins.

Dependencies:

Trinamic library

Trinamic TMC2130 I2C<>SPI Bridge (optional)


2023-01-11

Releases

No releases published

Packages

No packages published

Languages

  • C 99.8%
  • CMake 0.2%