From 66b8bc580f438e87123eb2f607f3691ceef2c64f Mon Sep 17 00:00:00 2001 From: Paulo Pacheco Date: Sun, 3 Sep 2023 10:53:31 -0300 Subject: [PATCH] feat: add TMC5160 driver to X/Y --- config/hardware/axis/X/TMC/TMC5160.cfg | 15 +++++++++++++++ config/hardware/axis/Y/TMC/TMC5160.cfg | 15 +++++++++++++++ config/mcu_definitions/main/BTT_Octopus_Max.cfg | 3 +++ user_templates/mcu.cfg | 2 ++ .../mcu_defaults/main/BTT_Octopus_Max.cfg | 4 ++++ 5 files changed, 39 insertions(+) create mode 100644 config/hardware/axis/X/TMC/TMC5160.cfg create mode 100644 config/hardware/axis/Y/TMC/TMC5160.cfg diff --git a/config/hardware/axis/X/TMC/TMC5160.cfg b/config/hardware/axis/X/TMC/TMC5160.cfg new file mode 100644 index 000000000..98bb51a57 --- /dev/null +++ b/config/hardware/axis/X/TMC/TMC5160.cfg @@ -0,0 +1,15 @@ +# X TMC5160 definition + +[gcode_macro _USER_VARIABLES] +variable_x_driver: "tmc5160" +gcode: + +[tmc5160 stepper_x] +cs_pin: X_TMCUART +spi_software_sclk_pin: DRIVER_SPI_SCK +spi_software_mosi_pin: DRIVER_SPI_MOSI +spi_software_miso_pin: DRIVER_SPI_MISO +interpolate: True +run_current: 0.8 +sense_resistor: 0.110 +stealthchop_threshold: 0 diff --git a/config/hardware/axis/Y/TMC/TMC5160.cfg b/config/hardware/axis/Y/TMC/TMC5160.cfg new file mode 100644 index 000000000..90598c190 --- /dev/null +++ b/config/hardware/axis/Y/TMC/TMC5160.cfg @@ -0,0 +1,15 @@ +# Y TMC5160 definition + +[gcode_macro _USER_VARIABLES] +variable_y_driver: "tmc5160" +gcode: + +[tmc5160 stepper_y] +cs_pin: Y_TMCUART +spi_software_sclk_pin: DRIVER_SPI_SCK +spi_software_mosi_pin: DRIVER_SPI_MOSI +spi_software_miso_pin: DRIVER_SPI_MISO +interpolate: True +run_current: 0.8 +sense_resistor: 0.110 +stealthchop_threshold: 0 diff --git a/config/mcu_definitions/main/BTT_Octopus_Max.cfg b/config/mcu_definitions/main/BTT_Octopus_Max.cfg index 71a7b2d1e..ddd919bab 100644 --- a/config/mcu_definitions/main/BTT_Octopus_Max.cfg +++ b/config/mcu_definitions/main/BTT_Octopus_Max.cfg @@ -32,6 +32,9 @@ aliases: MCU_NEOPIXEL2=PE9 , MCU_PS_ON=PF13 , MCU_POWER_DET=PF12 , + + MCU_SPI4_MOSI=PE14 , MCU_SPI4_MISO=PE13 , MCU_SPI4_SCK=PE12 , + MCU_FWS0=PC0 , MCU_FWS1=PF10 # EXP1 header diff --git a/user_templates/mcu.cfg b/user_templates/mcu.cfg index 3c6065eb6..94aa22eb9 100644 --- a/user_templates/mcu.cfg +++ b/user_templates/mcu.cfg @@ -23,10 +23,12 @@ # [include config/hardware/axis/X/TMC/TMC2209.cfg] # [include config/hardware/axis/X/TMC/TMC2209_V0specific.cfg] # Should only be used for early LDO V0 kits to mitigate the known VFAs issue # [include config/hardware/axis/X/TMC/TMC2240.cfg] +# [include config/hardware/axis/X/TMC/TMC5160.cfg] ### 2. Y Drivers ------------------------------------------------------------------------- # [include config/hardware/axis/Y/TMC/TMC2209.cfg] # [include config/hardware/axis/Y/TMC/TMC2209_V0specific.cfg] # Should only be used for early LDO V0 kits to mitigate the known VFAs issue # [include config/hardware/axis/Y/TMC/TMC2240.cfg] +# [include config/hardware/axis/Y/TMC/TMC5160.cfg] ### 3. Z Drivers ------------------------------------------------------------------------- # [include config/hardware/axis/Z/TMC/TMC2209_1-Motor.cfg] # [include config/hardware/axis/Z/TMC/TMC2209_3-Motors.cfg] diff --git a/user_templates/mcu_defaults/main/BTT_Octopus_Max.cfg b/user_templates/mcu_defaults/main/BTT_Octopus_Max.cfg index 2c890d285..05052f08c 100644 --- a/user_templates/mcu_defaults/main/BTT_Octopus_Max.cfg +++ b/user_templates/mcu_defaults/main/BTT_Octopus_Max.cfg @@ -26,6 +26,10 @@ aliases: E_STEP=MCU_MOTOR6_STEP , E_DIR=MCU_MOTOR6_DIR , E_ENABLE=MCU_MOTOR6_ENABLE , E_TMCUART=MCU_MOTOR6_UART , + DRIVER_SPI_MOSI=MCU_SPI4_MOSI , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_MISO=MCU_SPI4_MISO , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_SCK=MCU_SPI4_SCK , # Used in case of SPI drivers such as TMC2240 or TMC5160 + X_STOP=MCU_STOP0 , Y_STOP=MCU_STOP1 , Z_STOP=MCU_STOP2 , PROBE_INPUT=MCU_STOP7 , RUNOUT_SENSOR=MCU_FWS0 ,