This module is used to control SPI based stepper motor driver chips, like the Panucatt Bigfoot series.
This module is enabled in config with:
motor_driver_control.motor1.enable true # where motor1 is any name you wish
# V2 uses driver-specific sections
# Enable by defining settings in [tmc2660] or [tmc2590] sections
# See full example below
The chip this controls is set with:
motor_driver_control.motor1.chip DRV8711 # this can be one of DRV8711 or TMC2660
# The latter can control any TMC26x derivative
# V2 uses section headers to specify chip type
[tmc2660] # For TMC2660 drivers
# or
[tmc2590] # For TMC2590 drivers
The SPI channel to use must be set with:
motor_driver_control.motor1.spi_channel 0 # or 1
motor_driver_control.motor1.spi_cs_pin 0.10 # any pin
motor_driver_control.motor1.spi_frequency 100000 # the SPI frequency to use
# V2 SPI configuration is typically handled by board definition
# SPI pins and channels are pre-configured for the board
# No explicit SPI configuration needed in most cases
Other config settings:
motor_driver_control.motor1.axis X # for display purposes and for setting in Mxxx commands and telling the system which axis it controls
motor_driver_control.motor1.alarm true # enable alarm checking of chip, and report with a console message
motor_driver_control.motor1.halt_on_alarm true # set to true to force a halt on any alarm condition
motor_driver_control.motor1.current 3000 # set the motor current in milliamps
motor_driver_control.motor1.max_current 4000 # the maximum current the chip allows
motor_driver_control.motor1.microsteps 128 # the microsteps for this driver
[actuator]
alpha.microsteps = 128 # Set microsteps in actuator section
[current control]
alpha.current = 3.0 # Current in amps (3000mA = 3.0A)
common.check_driver_errors = true # Enable alarm checking
common.halt_on_driver_alarm = true # Halt on alarm condition
Some chip-specific configs are…
motor_driver_control.motor1.sense_resistor xxx # set the sense resistor used, this value is chip specific, set to the default for commonly used drivers
motor_driver_control.motor1.gain xxx # set the gain for a DRV8711, leave at default if you do not know what this is
# direct register setting... order and codes are chip dependent, values are in 32-bit Hex
motor_driver_control.motor1.reg 00002,981C0,A0000,C000E,E0060
# V2 chip-specific settings for TMC drivers
[tmc2660]
alpha.step_interpolation = false # Enable/disable step interpolation
alpha.standstill_current = 0 # Standstill current (0 to disable)
[tmc2590]
alpha.step_interpolation = false
alpha.standstill_current = 0
An example of config entries is as follows, this sets two advanced drivers, one is a DRV8711 and the other is a TMC2660.
motor_driver_control.alpha.enable true # alpha (X) is a TMC26X
motor_driver_control.alpha.axis X # A to set the settings
motor_driver_control.alpha.chip TMC2660 # chip name
motor_driver_control.alpha.current 1500 # current in milliamps
motor_driver_control.alpha.max_current 2800 # max current in milliamps
motor_driver_control.alpha.microsteps 64 # microsteps
motor_driver_control.alpha.alarm true # set to true means the error bits are checked
motor_driver_control.alpha.halt_on_alarm false # if set to true means ON_HALT is entered on any error bits being set
motor_driver_control.alpha.spi_channel 1 # SPI channel 1 is sdcard channel
motor_driver_control.alpha.spi_cs_pin 0.10 # SPI CS pin
#motor_driver_control.alpha.spi_frequency 100000 # SPI frequency
motor_driver_control.beta.enable true # beta (Y) is a DRV8711
motor_driver_control.beta.axis Y # Y to set the settings
motor_driver_control.beta.chip DRV8711 # chip name
motor_driver_control.beta.current 4000 # current in milliamps
motor_driver_control.beta.max_current 4000 # max current in milliamps
motor_driver_control.beta.microsteps 64 # microsteps
motor_driver_control.beta.alarm true # set to true means the error bits are checked
motor_driver_control.beta.halt_on_alarm false # if set to true means ON_HALT is entered on any error bits being set
motor_driver_control.beta.spi_channel 1 # SPI channel 1 is sdcard channel
motor_driver_control.beta.spi_cs_pin 0.19! # SPI CS pin DRV8711 requires inverted CS
#motor_driver_control.beta.spi_frequency 100000 # SPI frequency
# V2 configuration for TMC2660 drivers
# Settings are organized into separate sections
[actuator]
alpha.microsteps = 64
beta.microsteps = 64
[current control]
alpha.current = 1.5 # Current in amps (1500mA = 1.5A)
beta.current = 4.0 # Current in amps (4000mA = 4.0A)
common.check_driver_errors = true # Enable alarm checking
common.halt_on_driver_alarm = false # Don't halt on alarm
[tmc2660]
# Alpha motor (X axis) TMC2660 configuration
alpha.step_interpolation = false
alpha.standstill_current = 0
# Beta motor (Y axis) TMC2660 configuration
beta.step_interpolation = false
beta.standstill_current = 0
# Note: V2 does not support DRV8711 directly
# For DRV8711, you would need custom board support
NOTE: The step and dir must be driven via the step and dir pins and cannot be driven over the SPI interface.
They are configured as normal, for example…
alpha_step_pin 2.0 # Pin for alpha stepper step signal
alpha_dir_pin 0.5 # Pin for alpha stepper direction
[motor]
alpha.step_pin = 2.0 # Pin for alpha stepper step signal
alpha.dir_pin = 0.5 # Pin for alpha stepper direction
Many settings can be made on the fly with M codes, many of these are specific to certain chips:
M909.1 Xnnn set microstepping and also change steps/mm accordingly
M911.1 Pn (or X0) will dump the registers and status of the selected motor. R0 will request format in processing machine-readable format
M911.2 Pn (or Y0) Rxxx Vyyy sets Register xxx to value yyy for motor nnn, xxx == 255 writes the registers, xxx == 0 shows what registers are mapped to what
X0) will set the options based on the parameters passed as below…
M911.3 Onnn Qnnn set StallGuard Threshold O=stall_guard_threshold, Q=stall_guard_filter_enabledM911.3 Hnnn Innn Jnnn Knnn Lnnn set CoolStep Configuration H=lower_SG_threshold, I=SG_hysteresis, J=current_decrement_step_size, K=current_increment_step_size, L=lower_current_limitM911.3 S0 Unnn Vnnn Wnnn Xnnn Ynnn set ConstantOffTimeChopper U=constant_off_time, V=blank_time, W=fast_decay_time_setting, X=sine_wave_offset, Y=use_current_comparatorM911.3 S1 Unnn Vnnn Wnnn Xnnn Ynnn set SpreadCycleChopper U=constant_off_time, V=blank_time, W=hysteresis_start, X=hysteresis_end, Y=hysteresis_decrementM911.3 S2 Zn set RandomOffTime Z=on |
off Z1 is on Z0 is off |
M911.3 S3 Zn set DoubleEdge Z=on |
off Z1 is on Z0 is off |
M911.3 S4 Zn set StepInterpolation Z=on |
off Z1 is on Z0 is off |
M911.3 S5 Zn set CoolStepEnabled Z=on |
off Z1 is on Z0 is off |
M911.3 S6 Zn set StealthChopEnabled Z=on |
off Z1 is on Z0 is off |
M911.3 S7 Unnn Vnnn Wnnn Xnnn Ynnn Znnn set StealthChop U=freewheel, V=symmetric, W=autoscale, X=freq, Y=grad, Z=amplM911.3 S8 Zn set StealthChopThreshold Z=StealthChopThresholdM911.3 S9 Zn set CoolstepThreshold Z=CoolStepThresholdM911.3 S10 Unnn Vnnn Wnnn set ConstantOffTimeThreshold U=threshold, V=vhighchm, W=vhighfsM911.3 S11 Znnn set sense resistor value Z=sense resistor value in milliohmM911.3 S12 Znnn set hold current value Z=holding current as a percentage of run current(0-100)M911.3 S13 Znnn set hold delay value Z=holding delay valueM911.3 S14 Znnn set power down delay value Z=power down delay valueM911.3 S15 Unnn Vnnn Wnnn Xnnn set GeneralConfiguration U=i_scale_analog, V=internal_rsense, W=shaft, X=small_hysteresisM911.3 S16 Un Vn Wn Xn set Diag0options U=error, V=otpw, W=stall, X=pushpullM911.3 S17 Un Vn Wn Xn set Diag1options U=stall, V=index, W=onstate, X=pushpullThese are saved with