New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TMC2208 and TMC2209 support (includes improvements) #1447
Draft
V1pr
wants to merge
63
commits into
Smoothieware:edge
Choose a base branch
from
V1pr:TMC2208-tpwmthrs-support
base: edge
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
9eda179
Basic UART communication with TMC2208 stepper motor driver
tiagojbalmeida c8db7dd
Define and document all registers
tiagojbalmeida 595ad5b
Move SoftSerial and Modbus to libs folder
tiagojbalmeida f8fc5b1
Use Software UART libs to communicate with TMC2208 driver
tiagojbalmeida 2c2de51
Import functions to configure driver via UART
tiagojbalmeida 3070a61
Add StealthChop and StealthChop threshold functions
tiagojbalmeida 0b1cb9a
Add TMC2208 config file
tiagojbalmeida 33b5b48
Update velocity threshold
tiagojbalmeida 72d0ab1
Move print information about successfull configured motor drivers
tiagojbalmeida 0772b83
Add TMC2208 stepper motor driver support
tiagojbalmeida bb66641
Move Modbus lib back to spindle module
tiagojbalmeida 51d0aa1
Put SPI and UART pins in an union to save memory
tiagojbalmeida f0fd91b
Delete UART object after initial driver configuration
tiagojbalmeida c1fc3e2
Put SPI and UART objects inside union to save memory
tiagojbalmeida 2d140d4
Fix SPI/UART union structure
tiagojbalmeida d96e1ad
Remove driver setup condition
tiagojbalmeida 1491367
Disable stealthChop threshold as default
tiagojbalmeida de542f6
Set general configuration register
tiagojbalmeida d10e6d3
set slaveconf register
tiagojbalmeida bfa686a
set HOLD parameters
tiagojbalmeida 17624c6
Add tpowerdown register
tiagojbalmeida 31af12e
Fix mode parameter name
tiagojbalmeida 59f85fa
Added `motor_driver_control.timeout`.
LastDragon-ru 07484e0
Added `motor_driver_control.driver.tpwmthrs`.
LastDragon-ru 4cb6964
Fixed `motor_driver_control.driver.microsteps` description.
LastDragon-ru 86a09a8
Write only mode support.
LastDragon-ru 13a555b
Config description and small fixes
LastDragon-ru 5254bc9
Optimized chip configuration (reduced number of writes)
LastDragon-ru 6d97219
More settings:
LastDragon-ru a939716
Forced `setStepInterpolation(1)`
LastDragon-ru 93e122a
Stealthchop settings support.
LastDragon-ru 73db435
Removed tx/rx `port_number` shifting.
LastDragon-ru 663b88b
created parent class for drivers, making the main code cleaner. Tuned…
V1pr 53fc1ed
TMC22X still with debug messages (but fewer), compiles ok.
V1pr 8968475
changed current for set_current from uint32_t to uint16_t (65535 mA s…
V1pr 7a1785c
fixed missing type conversions. Compiles ok.
V1pr 62f1126
M122 debugging (for TMC22X now)
V1pr 7cdd4f4
debug msg fine tune
V1pr 38b247e
added/finished TMC2209 support; renamed helper namespace to Stepstick…
V1pr e456e4d
renamed TMC22X to TMC220X to be more informative
V1pr c25d12b
added TMC2209 registers descriptors
V1pr f8cdb42
more coolconf settings, set_options handles coolconf for TMC220X
V1pr 4b11eef
added credits, typo fix and example tmc2209 config
V1pr 2d54262
removed timeout for driver init
V1pr 183f909
motorcontrol default OFF
V1pr d79fc30
removed unneded motorcontrol.enable check
V1pr 3ffb868
fixed typo for SEIMIN
V1pr 53cb671
added TMC21X support from beeverycreative fork (modified function nam…
V1pr 7d52f17
added missing config snippet
V1pr 7cfa483
dirname fix
c449b8b
dirname fix 2
e8306f6
dirname fix 3
c8f1cf7
initialize connection_method and max current for TMC2130
mvadu 873a364
Merge pull request #2 from mvadu/fix_2130
V1pr 13750d7
Fix set_current signature
mvadu 34a152e
Fix current calculation
mvadu d6b49ab
Fix current calculation
mvadu 974f952
Merge pull request #3 from mvadu/fix_2130
V1pr 5efdbe7
reverted current calculations to use PEAK + added notes about it
7e82903
Fix typo in default nc compared with NC
mvadu c6c0183
Implement Jim's 8b5afad
mvadu 958a964
Check if RX pin is Interrupt Enabled
mvadu 53f3f57
Merge pull request #4 from mvadu/fix_2209
V1pr File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## Motor driver configuration | ||
motor_driver_control.driver.enable true # Enable motor driver module | ||
motor_driver_control.driver.axis X # Axis designator on which the motor driver is set | ||
motor_driver_control.driver.chip TMC2130 # Motor driver chip type | ||
motor_driver_control.driver.spi_channel 0 # Set corresponding pins of the selected spi channel | ||
motor_driver_control.driver.spi_cs_pin 0.16 # Set chip select pin | ||
#motor_driver_control.driver.current 1000 # Motor currents in mA - PEAK current, multiply with 0.707 to get RMS current | ||
#motor_driver_control.driver.sense_resistor 50 # Sensing resistor value as a reference in milliOhms | ||
#motor_driver_control.driver.microsteps 16 # Set microstepping value per step pulse. It can be 1, 2, 4, 8, 16, 32, 64, 128 or 256 microsteps | ||
#motor_driver_control.driver.chopper_mode 2 # 0 = stealthChop ; 1 = spreadCycle ; 2 = traditional constant off-time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
## Motor driver configuration | ||
motor_driver_control.enable true # Enable module | ||
motor_driver_control.alpha.enable true # Enable motor driver module | ||
motor_driver_control.alpha.axis X # Axis designator on which the motor driver is set | ||
motor_driver_control.alpha.chip TMC2208 # Motor driver chip type | ||
motor_driver_control.alpha.sw_uart_tx_pin 0.27 # Transmitting line from the board to the alpha. Required. | ||
motor_driver_control.alpha.sw_uart_rx_pin 0.28 # Receiving line to the board; NC if not connected (default). | ||
#motor_driver_control.alpha.sw_uart_baudrate 9600 # Software UART baudrate. Value higher than 50k is not recommended | ||
#motor_driver_control.alpha.current 1000 # Motor currents in mA - PEAK current, multiply with 0.707 to get RMS current | ||
#motor_driver_control.alpha.sense_resistor 50 # Sensing resistor value as a reference in milliOhms | ||
#motor_driver_control.alpha.microsteps 16 # The actual microstep resolution (MRES) that will be extrapolated to 256 microsteps. | ||
# It can be 1, 2, 4, 8, 16, 32, 64, 128 or 256 microsteps | ||
#motor_driver_control.alpha.chopper_mode 0 # 0 = spreadCycle ; 1 = stealthChop | ||
|
||
# Stealthchop | ||
# ! Please see datasheet for more details | ||
motor_driver_control.alpha.stealthchop_tpwmthrs 0 # The upper velocity for stealthChop voltage PWM mode. When the velocity exceeds this value, the | ||
# driver switches to spreadCycle. Default 0 (disabled). | ||
# | ||
# If enabled you probably should also tune SpreadCycle | ||
motor_driver_control.alpha.stealthchop_pwm_lim 12 # PWM_LIM | ||
motor_driver_control.alpha.stealthchop_pwm_reg 1 # PWM_REG | ||
motor_driver_control.alpha.stealthchop_freewheel 0 # freewheel | ||
motor_driver_control.alpha.stealthchop_pwm_autograd 1 # PWM_AUTOGRAD | ||
motor_driver_control.alpha.stealthchop_pwm_autoscale 1 # PWM_AUTOSCALE | ||
motor_driver_control.alpha.stealthchop_pwm_freq 1 # PWM_FREQ | ||
motor_driver_control.alpha.stealthchop_pwm_grad 0 # PWM_GRAD | ||
motor_driver_control.alpha.stealthchop_pwm_ofs 36 # PWM_OFS | ||
|
||
# SpreadCycle | ||
# ! Please see datasheet for more details | ||
#motor_driver_control.alpha.spreadcycle_toff 5 # TOFF (2 - 15) | ||
#motor_driver_control.alpha.spreadcycle_tbl 32 # TBL (16/24/32/48) | ||
#motor_driver_control.alpha.spreadcycle_hstrt 4 # HSTART (1 - 8) | ||
#motor_driver_control.alpha.spreadcycle_hend 0 # HEND (-3 - 12) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
## Motor driver configuration | ||
motor_driver_control.enable true # Enable module | ||
motor_driver_control.beta.enable true # Enable motor driver module | ||
motor_driver_control.beta.axis Y # Axis designator on which the motor driver is set | ||
motor_driver_control.beta.chip TMC2209 # Motor driver chip type | ||
motor_driver_control.beta.sw_uart_tx_pin 4.28 # Transmitting line from the board to the alpha. Required. | ||
motor_driver_control.beta.sw_uart_rx_pin 2.11 # Receiving line to the board; NC if not connected (default). | ||
motor_driver_control.beta.sw_uart_baudrate 19200 # Software UART baudrate. Value higher than 50k is not recommended | ||
motor_driver_control.beta.current 2000 # Motor currents in mA - PEAK current, multiply with 0.707 to get RMS current | ||
motor_driver_control.beta.sense_resistor 50 # Sensing resistor value as a reference in milliOhms | ||
motor_driver_control.beta.microsteps 256 # The actual microstep resolution (MRES) that will be extrapolated to 256 microsteps. | ||
# It can be 1, 2, 4, 8, 16, 32, 64, 128 or 256 microsteps | ||
#motor_driver_control.beta.chopper_mode 0 # 0 = spreadCycle ; 1 = stealthChop | ||
|
||
# Stealthchop | ||
# ! Please see datasheet for more details | ||
motor_driver_control.beta.stealthchop_tpwmthrs 0 # The upper velocity for stealthChop voltage PWM mode. When the velocity exceeds this value, the | ||
# driver switches to spreadCycle. Default 0 (disabled). | ||
# | ||
# If enabled you probably should also tune SpreadCycle | ||
motor_driver_control.beta.stealthchop_pwm_lim 12 # PWM_LIM | ||
motor_driver_control.beta.stealthchop_pwm_reg 1 # PWM_REG | ||
motor_driver_control.beta.stealthchop_freewheel 0 # freewheel | ||
motor_driver_control.beta.stealthchop_pwm_autograd 1 # PWM_AUTOGRAD | ||
motor_driver_control.beta.stealthchop_pwm_autoscale 1 # PWM_AUTOSCALE | ||
motor_driver_control.beta.stealthchop_pwm_freq 1 # PWM_FREQ | ||
motor_driver_control.beta.stealthchop_pwm_grad 0 # PWM_GRAD | ||
motor_driver_control.beta.stealthchop_pwm_ofs 36 # PWM_OFS | ||
|
||
# SpreadCycle | ||
# ! Please see datasheet for more details | ||
#motor_driver_control.beta.spreadcycle_toff 5 # TOFF (2 - 15) | ||
#motor_driver_control.beta.spreadcycle_tbl 32 # TBL (16/24/32/48) | ||
#motor_driver_control.beta.spreadcycle_hstrt 4 # HSTART (1 - 8) | ||
#motor_driver_control.beta.spreadcycle_hend 0 # HEND (-3 - 12) | ||
|
||
# Stallguard & Coolconf | ||
#motor_driver_control.beta.stallguard_tcoolthrs 0 # Lower coolstep velocity treshold | ||
#motor_driver_control.beta.stallguard_thrs 0 # SG_RESULT <= SGTHRS*2 | ||
|
||
#motor_driver_control.beta.coolconf_seimin 0 # 0 = 1/2 current setting (IRUN) - use with IRUN >= 10! | ||
# 1 = 1/4 current setting (IRUN) - use with IRUN >= 20! | ||
#motor_driver_control.beta.coolconf_sedn 0 # 0/2/8/32 | ||
#motor_driver_control.beta.coolconf_semax 0 # 0-15 | ||
#motor_driver_control.beta.coolconf_seup 0 # 1,2,4,8 - current increment steps per measured SG value | ||
#motor_driver_control.beta.coolconf_semin 0 # 0: CoolStep off, 1-15 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having some sane suggested values here would be gerat.