Skip to content

Commit

Permalink
🔧 Assert TMC slave addresses, minor pins cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thisiskeithb committed Mar 8, 2024
1 parent 4f2b727 commit 9eb78a7
Show file tree
Hide file tree
Showing 17 changed files with 351 additions and 222 deletions.
22 changes: 22 additions & 0 deletions Marlin/src/pins/gd32f1/pins_SOVOL_V131.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,28 @@
#define E0_SERIAL_TX_PIN PC14
#define E0_SERIAL_RX_PIN PC14

// Default TMC slave addresses
#ifdef X_SLAVE_ADDRESS
static_assert(X_SLAVE_ADDRESS == 3, "X_SLAVE_ADDRESS must be 3 for BOARD_SOVOL_V131.");
#else
#define X_SLAVE_ADDRESS 3
#endif
#ifdef Y_SLAVE_ADDRESS
static_assert(Y_SLAVE_ADDRESS == 3, "Y_SLAVE_ADDRESS must be 3 for BOARD_SOVOL_V131.");
#else
#define Y_SLAVE_ADDRESS 3
#endif
#ifdef Z_SLAVE_ADDRESS
static_assert(Z_SLAVE_ADDRESS == 3, "Z_SLAVE_ADDRESS must be 3 for BOARD_SOVOL_V131.");
#else
#define Z_SLAVE_ADDRESS 3
#endif
#ifdef E0_SLAVE_ADDRESS
static_assert(E0_SLAVE_ADDRESS == 3, "E0_SLAVE_ADDRESS must be 3 for BOARD_SOVOL_V131.");
#else
#define E0_SLAVE_ADDRESS 3
#endif

// Reduce baud rate to improve software serial reliability
#ifndef TMC_BAUD_RATE
#define TMC_BAUD_RATE 19200
Expand Down
41 changes: 24 additions & 17 deletions Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h
Original file line number Diff line number Diff line change
Expand Up @@ -569,33 +569,40 @@

#if HAS_TMC_UART
/**
* Address for the UART Configuration of the TMC2209. Override in Configuration files.
* To test TMC2209 Steppers enable TMC_DEBUG in Configuration_adv.h and test the M122 command with voltage on the steppers.
* TMC2208/TMC2209 stepper drivers
* It seems to work perfectly fine on Software Serial, if an advanced user wants to test, you could use the SAMD51 Serial1 and Serial 2. Be careful with the Sercom configurations.
*/
#ifndef X_SLAVE_ADDRESS
//#define X_HARDWARE_SERIAL Serial1
//#define Y_HARDWARE_SERIAL Serial1
//#define Z_HARDWARE_SERIAL Serial1
//#define E0_HARDWARE_SERIAL Serial1

// Default TMC slave addresses
#ifdef X_SLAVE_ADDRESS
static_assert(X_SLAVE_ADDRESS == 0b00, "X_SLAVE_ADDRESS must be 0b00 for BOARD_BRICOLEMON_LITE_V1_0.");
#else
#define X_SLAVE_ADDRESS 0b00
#endif
#ifndef Y_SLAVE_ADDRESS
#ifdef Y_SLAVE_ADDRESS
static_assert(Y_SLAVE_ADDRESS == 0b01, "Y_SLAVE_ADDRESS must be 0b01 for BOARD_BRICOLEMON_LITE_V1_0.");
#else
#define Y_SLAVE_ADDRESS 0b01
#endif
#ifndef Z_SLAVE_ADDRESS
#ifdef Z_SLAVE_ADDRESS
static_assert(Z_SLAVE_ADDRESS == 0b10, "Z_SLAVE_ADDRESS must be 0b10 for BOARD_BRICOLEMON_LITE_V1_0.");
#else
#define Z_SLAVE_ADDRESS 0b10
#endif
#ifndef E0_SLAVE_ADDRESS
#ifdef E0_SLAVE_ADDRESS
static_assert(E0_SLAVE_ADDRESS == 0b11, "E0_SLAVE_ADDRESS must be 0b11 for BOARD_BRICOLEMON_LITE_V1_0.");
#else
#define E0_SLAVE_ADDRESS 0b11
#endif

/**
* TMC2208/TMC2209 stepper drivers
* It seems to work perfectly fine on Software Serial, if an advanced user wants to test, you could use the SAMD51 Serial1 and Serial 2. Be careful with the Sercom configurations.
*/
//#define X_HARDWARE_SERIAL Serial1
//#define Y_HARDWARE_SERIAL Serial1
//#define Z_HARDWARE_SERIAL Serial1
//#define E0_HARDWARE_SERIAL Serial1

// This is the stable default value after testing, but, higher UART rates could be configured, remeber to test the Steppers with the M122 command to check if everything works.
#define TMC_BAUD_RATE 250000
// Reduce baud rate to improve software serial reliability
#ifndef TMC_BAUD_RATE
#define TMC_BAUD_RATE 19200 // 250000
#endif

//
// Software serial
Expand Down
51 changes: 30 additions & 21 deletions Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h
Original file line number Diff line number Diff line change
Expand Up @@ -620,40 +620,49 @@
#endif

#if HAS_TMC_UART

/**
* Address for the UART Configuration of the TMC2209. Override in Configuration files.
* To test TMC2209 Steppers enable TMC_DEBUG in Configuration_adv.h and test the M122 command with voltage on the steppers.
* TMC2208/TMC2209 stepper drivers
* It seems to work perfectly fine on Software Serial, if an advanced user wants to test, you could use the SAMD51 Serial1 and Serial 2. Be careful with the Sercom configurations.
* Steppers 1,2,3,4 (X,Y,Z,E0) are on the Serial1, Sercom (RX = 0, TX = 1), extra stepper 5 (E1 or any axis you want) is on Serial2, Sercom (RX = 17, TX = 16)
*/
#ifndef X_SLAVE_ADDRESS

//#define X_HARDWARE_SERIAL Serial1
//#define Y_HARDWARE_SERIAL Serial1
//#define Z_HARDWARE_SERIAL Serial1
//#define E0_HARDWARE_SERIAL Serial1
//#define E1_HARDWARE_SERIAL Serial2

// Default TMC slave addresses
#ifdef X_SLAVE_ADDRESS
static_assert(X_SLAVE_ADDRESS == 0b00, "X_SLAVE_ADDRESS must be 0b00 for BOARD_BRICOLEMON_V1_0.");
#else
#define X_SLAVE_ADDRESS 0b00
#endif
#ifndef Y_SLAVE_ADDRESS
#ifdef Y_SLAVE_ADDRESS
static_assert(Y_SLAVE_ADDRESS == 0b01, "Y_SLAVE_ADDRESS must be 0b01 for BOARD_BRICOLEMON_V1_0.");
#else
#define Y_SLAVE_ADDRESS 0b01
#endif
#ifndef Z_SLAVE_ADDRESS
#ifdef Z_SLAVE_ADDRESS
static_assert(Z_SLAVE_ADDRESS == 0b10, "Z_SLAVE_ADDRESS must be 0b10 for BOARD_BRICOLEMON_V1_0.");
#else
#define Z_SLAVE_ADDRESS 0b10
#endif
#ifndef E0_SLAVE_ADDRESS
#ifdef E0_SLAVE_ADDRESS
static_assert(E0_SLAVE_ADDRESS == 0b11, "E0_SLAVE_ADDRESS must be 0b11 for BOARD_BRICOLEMON_V1_0.");
#else
#define E0_SLAVE_ADDRESS 0b11
#endif
#ifndef E1_SLAVE_ADDRESS
#ifdef E1_SLAVE_ADDRESS
static_assert(E1_SLAVE_ADDRESS == 0b00, "E0_SLAVE_ADDRESS must be 0b00 for BOARD_BRICOLEMON_V1_0.");
#else
#define E1_SLAVE_ADDRESS 0b00
#endif

/**
* TMC2208/TMC2209 stepper drivers
* It seems to work perfectly fine on Software Serial, if an advanced user wants to test, you could use the SAMD51 Serial1 and Serial 2. Be careful with the Sercom configurations.
* Steppers 1,2,3,4 (X,Y,Z,E0) are on the Serial1, Sercom (RX = 0, TX = 1), extra stepper 5 (E1 or any axis you want) is on Serial2, Sercom (RX = 17, TX = 16)
*/

//#define X_HARDWARE_SERIAL Serial1
//#define Y_HARDWARE_SERIAL Serial1
//#define Z_HARDWARE_SERIAL Serial1
//#define E0_HARDWARE_SERIAL Serial1
//#define E1_HARDWARE_SERIAL Serial2

#define TMC_BAUD_RATE 250000
// Reduce baud rate to improve software serial reliability
#ifndef TMC_BAUD_RATE
#define TMC_BAUD_RATE 19200 // 250000
#endif

//
// Software serial
Expand Down
51 changes: 30 additions & 21 deletions Marlin/src/pins/samd/pins_MINITRONICS20.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,40 +497,49 @@
#define SD_DETECT_PIN 22

#if HAS_TMC_UART

/**
* TMC2209 UART Address. Override in Configuration files.
* To test TMC2209 Steppers enable TMC_DEBUG and test M122 with voltage on the steppers.
* TMC2208/TMC2209 stepper drivers
* Seems to work fine with Software Serial. If you want to test, use SAMD51 Serial1 and Serial2. Be careful with the Sercom configurations.
* Steppers 1,2,3,4 (X,Y,Z,E0) are on Serial1, Sercom (RX=0, TX=1), extra stepper 5 (E1 or any axis you want) is on Serial2, Sercom (RX=17, TX=16)
*/
#ifndef X_SLAVE_ADDRESS

//#define X_HARDWARE_SERIAL Serial1
//#define Y_HARDWARE_SERIAL Serial1
//#define Z_HARDWARE_SERIAL Serial1
//#define E0_HARDWARE_SERIAL Serial1
//#define E1_HARDWARE_SERIAL Serial2

// Default TMC slave addresses
#ifdef X_SLAVE_ADDRESS
static_assert(X_SLAVE_ADDRESS == 0b00, "X_SLAVE_ADDRESS must be 0b00 for BOARD_ERYONE_ERY32_MINI.");
#else
#define X_SLAVE_ADDRESS 0b00
#endif
#ifndef Y_SLAVE_ADDRESS
#ifdef Y_SLAVE_ADDRESS
static_assert(Y_SLAVE_ADDRESS == 0b01, "Y_SLAVE_ADDRESS must be 0b01 for BOARD_ERYONE_ERY32_MINI.");
#else
#define Y_SLAVE_ADDRESS 0b01
#endif
#ifndef Z_SLAVE_ADDRESS
#ifdef Z_SLAVE_ADDRESS
static_assert(Z_SLAVE_ADDRESS == 0b10, "Z_SLAVE_ADDRESS must be 0b10 for BOARD_ERYONE_ERY32_MINI.");
#else
#define Z_SLAVE_ADDRESS 0b10
#endif
#ifndef E0_SLAVE_ADDRESS
#ifdef E0_SLAVE_ADDRESS
static_assert(E0_SLAVE_ADDRESS == 0b11, "E0_SLAVE_ADDRESS must be 0b11 for BOARD_ERYONE_ERY32_MINI.");
#else
#define E0_SLAVE_ADDRESS 0b11
#endif
#ifndef E1_SLAVE_ADDRESS
#ifdef E1_SLAVE_ADDRESS
static_assert(E1_SLAVE_ADDRESS == 0b00, "E0_SLAVE_ADDRESS must be 0b00 for BOARD_ERYONE_ERY32_MINI.");
#else
#define E1_SLAVE_ADDRESS 0b00
#endif

/**
* TMC2208/TMC2209 stepper drivers
* Seems to work fine with Software Serial. If you want to test, use SAMD51 Serial1 and Serial2. Be careful with the Sercom configurations.
* Steppers 1,2,3,4 (X,Y,Z,E0) are on Serial1, Sercom (RX=0, TX=1), extra stepper 5 (E1 or any axis you want) is on Serial2, Sercom (RX=17, TX=16)
*/

//#define X_HARDWARE_SERIAL Serial1
//#define Y_HARDWARE_SERIAL Serial1
//#define Z_HARDWARE_SERIAL Serial1
//#define E0_HARDWARE_SERIAL Serial1
//#define E1_HARDWARE_SERIAL Serial2

#define TMC_BAUD_RATE 250000
// Reduce baud rate to improve software serial reliability
#ifndef TMC_BAUD_RATE
#define TMC_BAUD_RATE 19200 // 250000
#endif

//
// Software serial
Expand Down
27 changes: 18 additions & 9 deletions Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
* BigTreeTech SKR CR-6 (STM32F103RET6) board pin assignments
*/

#define DEFAULT_MACHINE_NAME "Creality3D"
#define DEFAULT_MACHINE_NAME "Creality CR-6 SE"
#define BOARD_INFO_NAME "BTT SKR CR-6"
#define BOARD_WEBSITE_URL "github.com/bigtreetech/BIGTREETECH-SKR-CR6"

#include "env_validate.h"

Expand Down Expand Up @@ -144,17 +145,25 @@
#define E0_HARDWARE_SERIAL MSerial4

// Default TMC slave addresses
#ifndef X_SLAVE_ADDRESS
#define X_SLAVE_ADDRESS 0
#ifdef X_SLAVE_ADDRESS
static_assert(X_SLAVE_ADDRESS == 0, "X_SLAVE_ADDRESS must be 0 for BOARD_BTT_SKR_CR6.");
#else
#define X_SLAVE_ADDRESS 0
#endif
#ifndef Y_SLAVE_ADDRESS
#define Y_SLAVE_ADDRESS 1
#ifdef Y_SLAVE_ADDRESS
static_assert(Y_SLAVE_ADDRESS == 1, "Y_SLAVE_ADDRESS must be 1 for BOARD_BTT_SKR_CR6.");
#else
#define Y_SLAVE_ADDRESS 1
#endif
#ifndef Z_SLAVE_ADDRESS
#define Z_SLAVE_ADDRESS 2
#ifdef Z_SLAVE_ADDRESS
static_assert(Z_SLAVE_ADDRESS == 2, "Z_SLAVE_ADDRESS must be 2 for BOARD_BTT_SKR_CR6.");
#else
#define Z_SLAVE_ADDRESS 2
#endif
#ifndef E0_SLAVE_ADDRESS
#define E0_SLAVE_ADDRESS 3
#ifdef E0_SLAVE_ADDRESS
static_assert(E0_SLAVE_ADDRESS == 3, "E0_SLAVE_ADDRESS must be 3 for BOARD_BTT_SKR_CR6.");
#else
#define E0_SLAVE_ADDRESS 3
#endif
#endif

Expand Down
25 changes: 17 additions & 8 deletions Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V1_0.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "pins_BTT_SKR_MINI_E3_common.h"

#define BOARD_INFO_NAME "BTT SKR Mini E3 V1.0"
#define BOARD_WEBSITE_URL "github.com/bigtreetech/BIGTREETECH-SKR-mini-E3/tree/master/hardware/BIGTREETECH-SKR-mini-E3%20V1.0"

/**
* TMC220x stepper drivers
Expand All @@ -36,16 +37,24 @@
#define E0_HARDWARE_SERIAL MSerial4

// Default TMC slave addresses
#ifndef X_SLAVE_ADDRESS
#define X_SLAVE_ADDRESS 0
#ifdef X_SLAVE_ADDRESS
static_assert(X_SLAVE_ADDRESS == 0, "X_SLAVE_ADDRESS must be 0 for BOARD_BTT_SKR_MINI_E3_V1_0.");
#else
#define X_SLAVE_ADDRESS 0
#endif
#ifndef Y_SLAVE_ADDRESS
#define Y_SLAVE_ADDRESS 2
#ifdef Y_SLAVE_ADDRESS
static_assert(Y_SLAVE_ADDRESS == 2, "Y_SLAVE_ADDRESS must be 2 for BOARD_BTT_SKR_MINI_E3_V1_0.");
#else
#define Y_SLAVE_ADDRESS 2
#endif
#ifndef Z_SLAVE_ADDRESS
#define Z_SLAVE_ADDRESS 1
#ifdef Z_SLAVE_ADDRESS
static_assert(Z_SLAVE_ADDRESS == 1, "Z_SLAVE_ADDRESS must be 1 for BOARD_BTT_SKR_MINI_E3_V1_0.");
#else
#define Z_SLAVE_ADDRESS 1
#endif
#ifndef E0_SLAVE_ADDRESS
#define E0_SLAVE_ADDRESS 3
#ifdef E0_SLAVE_ADDRESS
static_assert(E0_SLAVE_ADDRESS == 3, "E0_SLAVE_ADDRESS must be 3 for BOARD_BTT_SKR_MINI_E3_V1_0.");
#else
#define E0_SLAVE_ADDRESS 3
#endif
#endif
24 changes: 16 additions & 8 deletions Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,25 @@
#define E0_HARDWARE_SERIAL MSerial4

// Default TMC slave addresses
#ifndef X_SLAVE_ADDRESS
#define X_SLAVE_ADDRESS 0
#ifdef X_SLAVE_ADDRESS
static_assert(X_SLAVE_ADDRESS == 0, "X_SLAVE_ADDRESS must be 0 for BOARD_SKR_MINI_E3_V2_0.");
#else
#define X_SLAVE_ADDRESS 0
#endif
#ifndef Y_SLAVE_ADDRESS
#define Y_SLAVE_ADDRESS 2
#ifdef Y_SLAVE_ADDRESS
static_assert(Y_SLAVE_ADDRESS == 2, "Y_SLAVE_ADDRESS must be 2 for BOARD_SKR_MINI_E3_V2_0.");
#else
#define Y_SLAVE_ADDRESS 2
#endif
#ifndef Z_SLAVE_ADDRESS
#define Z_SLAVE_ADDRESS 1
#ifdef Z_SLAVE_ADDRESS
static_assert(Z_SLAVE_ADDRESS == 1, "Z_SLAVE_ADDRESS must be 1 for BOARD_SKR_MINI_E3_V2_0.");
#else
#define Z_SLAVE_ADDRESS 1
#endif
#ifndef E0_SLAVE_ADDRESS
#define E0_SLAVE_ADDRESS 3
#ifdef E0_SLAVE_ADDRESS
static_assert(E0_SLAVE_ADDRESS == 3, "E0_SLAVE_ADDRESS must be 3 for BOARD_SKR_MINI_E3_V2_0.");
#else
#define E0_SLAVE_ADDRESS 3
#endif
#endif

Expand Down
18 changes: 14 additions & 4 deletions Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,26 @@
#define Y_HARDWARE_SERIAL MSerial4
#define Z_HARDWARE_SERIAL MSerial4
#define E0_HARDWARE_SERIAL MSerial4
#ifndef X_SLAVE_ADDRESS

// Default TMC slave addresses
#ifdef X_SLAVE_ADDRESS
static_assert(X_SLAVE_ADDRESS == 2, "X_SLAVE_ADDRESS must be 2 for BOARD_ERYONE_ERY32_MINI.");
#else
#define X_SLAVE_ADDRESS 2
#endif
#ifndef Y_SLAVE_ADDRESS
#ifdef Y_SLAVE_ADDRESS
static_assert(Y_SLAVE_ADDRESS == 3, "Y_SLAVE_ADDRESS must be 3 for BOARD_ERYONE_ERY32_MINI.");
#else
#define Y_SLAVE_ADDRESS 3
#endif
#ifndef Z_SLAVE_ADDRESS
#ifdef Z_SLAVE_ADDRESS
static_assert(Z_SLAVE_ADDRESS == 1, "Z_SLAVE_ADDRESS must be 1 for BOARD_ERYONE_ERY32_MINI.");
#else
#define Z_SLAVE_ADDRESS 1
#endif
#ifndef E0_SLAVE_ADDRESS
#ifdef E0_SLAVE_ADDRESS
static_assert(E0_SLAVE_ADDRESS == 0, "E0_SLAVE_ADDRESS must be 0 for BOARD_ERYONE_ERY32_MINI.");
#else
#define E0_SLAVE_ADDRESS 0
#endif
#endif
Expand Down
Loading

0 comments on commit 9eb78a7

Please sign in to comment.