Skip to content

Commit f56952c

Browse files
authored
🔧 Assert TMC slave addresses, minor pins cleanup (#26842)
1 parent ca5a7be commit f56952c

17 files changed

+225
-163
lines changed

Marlin/src/pins/gd32f1/pins_SOVOL_V131.h

+18
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,24 @@
6262
#define E0_SERIAL_TX_PIN PC14
6363
#define E0_SERIAL_RX_PIN PC14
6464

65+
// Default TMC slave addresses
66+
#ifndef X_SLAVE_ADDRESS
67+
#define X_SLAVE_ADDRESS 3
68+
#endif
69+
#ifndef Y_SLAVE_ADDRESS
70+
#define Y_SLAVE_ADDRESS 3
71+
#endif
72+
#ifndef Z_SLAVE_ADDRESS
73+
#define Z_SLAVE_ADDRESS 3
74+
#endif
75+
#ifndef E0_SLAVE_ADDRESS
76+
#define E0_SLAVE_ADDRESS 3
77+
#endif
78+
static_assert(X_SLAVE_ADDRESS == 3, "X_SLAVE_ADDRESS must be 3 for BOARD_SOVOL_V131.");
79+
static_assert(Y_SLAVE_ADDRESS == 3, "Y_SLAVE_ADDRESS must be 3 for BOARD_SOVOL_V131.");
80+
static_assert(Z_SLAVE_ADDRESS == 3, "Z_SLAVE_ADDRESS must be 3 for BOARD_SOVOL_V131.");
81+
static_assert(E0_SLAVE_ADDRESS == 3, "E0_SLAVE_ADDRESS must be 3 for BOARD_SOVOL_V131.");
82+
6583
// Reduce baud rate to improve software serial reliability
6684
#ifndef TMC_BAUD_RATE
6785
#define TMC_BAUD_RATE 19200

Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h

+17-14
Original file line numberDiff line numberDiff line change
@@ -569,9 +569,15 @@
569569

570570
#if HAS_TMC_UART
571571
/**
572-
* Address for the UART Configuration of the TMC2209. Override in Configuration files.
573-
* To test TMC2209 Steppers enable TMC_DEBUG in Configuration_adv.h and test the M122 command with voltage on the steppers.
572+
* TMC2208/TMC2209 stepper drivers
573+
* 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.
574574
*/
575+
//#define X_HARDWARE_SERIAL Serial1
576+
//#define Y_HARDWARE_SERIAL Serial1
577+
//#define Z_HARDWARE_SERIAL Serial1
578+
//#define E0_HARDWARE_SERIAL Serial1
579+
580+
// Default TMC slave addresses
575581
#ifndef X_SLAVE_ADDRESS
576582
#define X_SLAVE_ADDRESS 0b00
577583
#endif
@@ -584,18 +590,15 @@
584590
#ifndef E0_SLAVE_ADDRESS
585591
#define E0_SLAVE_ADDRESS 0b11
586592
#endif
587-
588-
/**
589-
* TMC2208/TMC2209 stepper drivers
590-
* 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.
591-
*/
592-
//#define X_HARDWARE_SERIAL Serial1
593-
//#define Y_HARDWARE_SERIAL Serial1
594-
//#define Z_HARDWARE_SERIAL Serial1
595-
//#define E0_HARDWARE_SERIAL Serial1
596-
597-
// 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.
598-
#define TMC_BAUD_RATE 250000
593+
static_assert(X_SLAVE_ADDRESS == 0b00, "X_SLAVE_ADDRESS must be 0b00 for BOARD_BRICOLEMON_LITE_V1_0.");
594+
static_assert(Y_SLAVE_ADDRESS == 0b01, "Y_SLAVE_ADDRESS must be 0b01 for BOARD_BRICOLEMON_LITE_V1_0.");
595+
static_assert(Z_SLAVE_ADDRESS == 0b10, "Z_SLAVE_ADDRESS must be 0b10 for BOARD_BRICOLEMON_LITE_V1_0.");
596+
static_assert(E0_SLAVE_ADDRESS == 0b11, "E0_SLAVE_ADDRESS must be 0b11 for BOARD_BRICOLEMON_LITE_V1_0.");
597+
598+
// Reduce baud rate to improve software serial reliability
599+
#ifndef TMC_BAUD_RATE
600+
#define TMC_BAUD_RATE 19200 // 250000
601+
#endif
599602

600603
//
601604
// Software serial

Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h

+21-17
Original file line numberDiff line numberDiff line change
@@ -620,11 +620,19 @@
620620
#endif
621621

622622
#if HAS_TMC_UART
623-
624623
/**
625-
* Address for the UART Configuration of the TMC2209. Override in Configuration files.
626-
* To test TMC2209 Steppers enable TMC_DEBUG in Configuration_adv.h and test the M122 command with voltage on the steppers.
624+
* TMC2208/TMC2209 stepper drivers
625+
* 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.
626+
* 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)
627627
*/
628+
629+
//#define X_HARDWARE_SERIAL Serial1
630+
//#define Y_HARDWARE_SERIAL Serial1
631+
//#define Z_HARDWARE_SERIAL Serial1
632+
//#define E0_HARDWARE_SERIAL Serial1
633+
//#define E1_HARDWARE_SERIAL Serial2
634+
635+
// Default TMC slave addresses
628636
#ifndef X_SLAVE_ADDRESS
629637
#define X_SLAVE_ADDRESS 0b00
630638
#endif
@@ -640,20 +648,16 @@
640648
#ifndef E1_SLAVE_ADDRESS
641649
#define E1_SLAVE_ADDRESS 0b00
642650
#endif
643-
644-
/**
645-
* TMC2208/TMC2209 stepper drivers
646-
* 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.
647-
* 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)
648-
*/
649-
650-
//#define X_HARDWARE_SERIAL Serial1
651-
//#define Y_HARDWARE_SERIAL Serial1
652-
//#define Z_HARDWARE_SERIAL Serial1
653-
//#define E0_HARDWARE_SERIAL Serial1
654-
//#define E1_HARDWARE_SERIAL Serial2
655-
656-
#define TMC_BAUD_RATE 250000
651+
static_assert(X_SLAVE_ADDRESS == 0b00, "X_SLAVE_ADDRESS must be 0b00 for BOARD_BRICOLEMON_V1_0.");
652+
static_assert(Y_SLAVE_ADDRESS == 0b01, "Y_SLAVE_ADDRESS must be 0b01 for BOARD_BRICOLEMON_V1_0.");
653+
static_assert(Z_SLAVE_ADDRESS == 0b10, "Z_SLAVE_ADDRESS must be 0b10 for BOARD_BRICOLEMON_V1_0.");
654+
static_assert(E0_SLAVE_ADDRESS == 0b11, "E0_SLAVE_ADDRESS must be 0b11 for BOARD_BRICOLEMON_V1_0.");
655+
static_assert(E1_SLAVE_ADDRESS == 0b00, "E1_SLAVE_ADDRESS must be 0b00 for BOARD_BRICOLEMON_V1_0.");
656+
657+
// Reduce baud rate to improve software serial reliability
658+
#ifndef TMC_BAUD_RATE
659+
#define TMC_BAUD_RATE 19200 // 250000
660+
#endif
657661

658662
//
659663
// Software serial

Marlin/src/pins/samd/pins_MINITRONICS20.h

+21-17
Original file line numberDiff line numberDiff line change
@@ -497,11 +497,19 @@
497497
#define SD_DETECT_PIN 22
498498

499499
#if HAS_TMC_UART
500-
501500
/**
502-
* TMC2209 UART Address. Override in Configuration files.
503-
* To test TMC2209 Steppers enable TMC_DEBUG and test M122 with voltage on the steppers.
501+
* TMC2208/TMC2209 stepper drivers
502+
* Seems to work fine with Software Serial. If you want to test, use SAMD51 Serial1 and Serial2. Be careful with the Sercom configurations.
503+
* 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)
504504
*/
505+
506+
//#define X_HARDWARE_SERIAL Serial1
507+
//#define Y_HARDWARE_SERIAL Serial1
508+
//#define Z_HARDWARE_SERIAL Serial1
509+
//#define E0_HARDWARE_SERIAL Serial1
510+
//#define E1_HARDWARE_SERIAL Serial2
511+
512+
// Default TMC slave addresses
505513
#ifndef X_SLAVE_ADDRESS
506514
#define X_SLAVE_ADDRESS 0b00
507515
#endif
@@ -517,20 +525,16 @@
517525
#ifndef E1_SLAVE_ADDRESS
518526
#define E1_SLAVE_ADDRESS 0b00
519527
#endif
520-
521-
/**
522-
* TMC2208/TMC2209 stepper drivers
523-
* Seems to work fine with Software Serial. If you want to test, use SAMD51 Serial1 and Serial2. Be careful with the Sercom configurations.
524-
* 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)
525-
*/
526-
527-
//#define X_HARDWARE_SERIAL Serial1
528-
//#define Y_HARDWARE_SERIAL Serial1
529-
//#define Z_HARDWARE_SERIAL Serial1
530-
//#define E0_HARDWARE_SERIAL Serial1
531-
//#define E1_HARDWARE_SERIAL Serial2
532-
533-
#define TMC_BAUD_RATE 250000
528+
static_assert(X_SLAVE_ADDRESS == 0b00, "X_SLAVE_ADDRESS must be 0b00 for BOARD_MINITRONICS20.");
529+
static_assert(Y_SLAVE_ADDRESS == 0b01, "Y_SLAVE_ADDRESS must be 0b01 for BOARD_MINITRONICS20.");
530+
static_assert(Z_SLAVE_ADDRESS == 0b10, "Z_SLAVE_ADDRESS must be 0b10 for BOARD_MINITRONICS20.");
531+
static_assert(E0_SLAVE_ADDRESS == 0b11, "E0_SLAVE_ADDRESS must be 0b11 for BOARD_MINITRONICS20.");
532+
static_assert(E1_SLAVE_ADDRESS == 0b00, "E1_SLAVE_ADDRESS must be 0b00 for BOARD_MINITRONICS20.");
533+
534+
// Reduce baud rate to improve software serial reliability
535+
#ifndef TMC_BAUD_RATE
536+
#define TMC_BAUD_RATE 19200 // 250000
537+
#endif
534538

535539
//
536540
// Software serial

Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h

+10-5
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
* BigTreeTech SKR CR-6 (STM32F103RET6) board pin assignments
2626
*/
2727

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

3132
#include "env_validate.h"
3233

@@ -145,17 +146,21 @@
145146

146147
// Default TMC slave addresses
147148
#ifndef X_SLAVE_ADDRESS
148-
#define X_SLAVE_ADDRESS 0
149+
#define X_SLAVE_ADDRESS 0
149150
#endif
150151
#ifndef Y_SLAVE_ADDRESS
151-
#define Y_SLAVE_ADDRESS 1
152+
#define Y_SLAVE_ADDRESS 1
152153
#endif
153154
#ifndef Z_SLAVE_ADDRESS
154-
#define Z_SLAVE_ADDRESS 2
155+
#define Z_SLAVE_ADDRESS 2
155156
#endif
156157
#ifndef E0_SLAVE_ADDRESS
157-
#define E0_SLAVE_ADDRESS 3
158+
#define E0_SLAVE_ADDRESS 3
158159
#endif
160+
static_assert(X_SLAVE_ADDRESS == 0, "X_SLAVE_ADDRESS must be 0 for BOARD_BTT_SKR_CR6.");
161+
static_assert(Y_SLAVE_ADDRESS == 1, "Y_SLAVE_ADDRESS must be 1 for BOARD_BTT_SKR_CR6.");
162+
static_assert(Z_SLAVE_ADDRESS == 2, "Z_SLAVE_ADDRESS must be 2 for BOARD_BTT_SKR_CR6.");
163+
static_assert(E0_SLAVE_ADDRESS == 3, "E0_SLAVE_ADDRESS must be 3 for BOARD_BTT_SKR_CR6.");
159164
#endif
160165

161166
//

Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V1_0.h

+9-4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "pins_BTT_SKR_MINI_E3_common.h"
2525

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

2829
/**
2930
* TMC220x stepper drivers
@@ -37,15 +38,19 @@
3738

3839
// Default TMC slave addresses
3940
#ifndef X_SLAVE_ADDRESS
40-
#define X_SLAVE_ADDRESS 0
41+
#define X_SLAVE_ADDRESS 0
4142
#endif
4243
#ifndef Y_SLAVE_ADDRESS
43-
#define Y_SLAVE_ADDRESS 2
44+
#define Y_SLAVE_ADDRESS 2
4445
#endif
4546
#ifndef Z_SLAVE_ADDRESS
46-
#define Z_SLAVE_ADDRESS 1
47+
#define Z_SLAVE_ADDRESS 1
4748
#endif
4849
#ifndef E0_SLAVE_ADDRESS
49-
#define E0_SLAVE_ADDRESS 3
50+
#define E0_SLAVE_ADDRESS 3
5051
#endif
52+
static_assert(X_SLAVE_ADDRESS == 0, "X_SLAVE_ADDRESS must be 0 for BOARD_BTT_SKR_MINI_E3_V1_0.");
53+
static_assert(Y_SLAVE_ADDRESS == 2, "Y_SLAVE_ADDRESS must be 2 for BOARD_BTT_SKR_MINI_E3_V1_0.");
54+
static_assert(Z_SLAVE_ADDRESS == 1, "Z_SLAVE_ADDRESS must be 1 for BOARD_BTT_SKR_MINI_E3_V1_0.");
55+
static_assert(E0_SLAVE_ADDRESS == 3, "E0_SLAVE_ADDRESS must be 3 for BOARD_BTT_SKR_MINI_E3_V1_0.");
5156
#endif

Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h

+8-4
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,21 @@
9595

9696
// Default TMC slave addresses
9797
#ifndef X_SLAVE_ADDRESS
98-
#define X_SLAVE_ADDRESS 0
98+
#define X_SLAVE_ADDRESS 0
9999
#endif
100100
#ifndef Y_SLAVE_ADDRESS
101-
#define Y_SLAVE_ADDRESS 2
101+
#define Y_SLAVE_ADDRESS 2
102102
#endif
103103
#ifndef Z_SLAVE_ADDRESS
104-
#define Z_SLAVE_ADDRESS 1
104+
#define Z_SLAVE_ADDRESS 1
105105
#endif
106106
#ifndef E0_SLAVE_ADDRESS
107-
#define E0_SLAVE_ADDRESS 3
107+
#define E0_SLAVE_ADDRESS 3
108108
#endif
109+
static_assert(X_SLAVE_ADDRESS == 0, "X_SLAVE_ADDRESS must be 0 for BOARD_SKR_MINI_E3_V2_0.");
110+
static_assert(Y_SLAVE_ADDRESS == 2, "Y_SLAVE_ADDRESS must be 2 for BOARD_SKR_MINI_E3_V2_0.");
111+
static_assert(Z_SLAVE_ADDRESS == 1, "Z_SLAVE_ADDRESS must be 1 for BOARD_SKR_MINI_E3_V2_0.");
112+
static_assert(E0_SLAVE_ADDRESS == 3, "E0_SLAVE_ADDRESS must be 3 for BOARD_SKR_MINI_E3_V2_0.");
109113
#endif
110114

111115
// Pins for documentation and sanity checks only.

Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h

+6
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@
135135
#define Y_HARDWARE_SERIAL MSerial4
136136
#define Z_HARDWARE_SERIAL MSerial4
137137
#define E0_HARDWARE_SERIAL MSerial4
138+
139+
// Default TMC slave addresses
138140
#ifndef X_SLAVE_ADDRESS
139141
#define X_SLAVE_ADDRESS 2
140142
#endif
@@ -147,6 +149,10 @@
147149
#ifndef E0_SLAVE_ADDRESS
148150
#define E0_SLAVE_ADDRESS 0
149151
#endif
152+
static_assert(X_SLAVE_ADDRESS == 2, "X_SLAVE_ADDRESS must be 2 for BOARD_ERYONE_ERY32_MINI.");
153+
static_assert(Y_SLAVE_ADDRESS == 3, "Y_SLAVE_ADDRESS must be 3 for BOARD_ERYONE_ERY32_MINI.");
154+
static_assert(Z_SLAVE_ADDRESS == 1, "Z_SLAVE_ADDRESS must be 1 for BOARD_ERYONE_ERY32_MINI.");
155+
static_assert(E0_SLAVE_ADDRESS == 0, "E0_SLAVE_ADDRESS must be 0 for BOARD_ERYONE_ERY32_MINI.");
150156
#endif
151157

152158
//

Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h

+14-12
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
#include "env_validate.h"
2525

2626
#define BOARD_INFO_NAME "FYSETC AIO II"
27-
#define BOARD_WEBSITE_URL "fysetc.com"
27+
#define BOARD_WEBSITE_URL "github.com/FYSETC/FYSETC-AIO_II"
2828

2929
#define BOARD_NO_NATIVE_USB
3030
#define RESET_STEPPERS_ON_MEDIA_INSERT
3131
#define DISABLE_JTAG
3232

33-
#define pins_v2_20190128 // new pins define
33+
#define PINS_V2_20190128 // new pins define
3434

3535
// Ignore temp readings during development.
3636
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
@@ -55,7 +55,7 @@
5555
//
5656
// Filament runout
5757
//
58-
#ifdef pins_v2_20190128
58+
#ifdef PINS_V2_20190128
5959
#define FIL_RUNOUT_PIN PB15
6060
#else
6161
#define FIL_RUNOUT_PIN PB5
@@ -69,7 +69,7 @@
6969
#define X_ENABLE_PIN PA8
7070

7171
#define Y_STEP_PIN PB2
72-
#ifdef pins_v2_20190128
72+
#ifdef PINS_V2_20190128
7373
#define Y_DIR_PIN PB3
7474
#else
7575
#define Y_DIR_PIN PB0
@@ -97,20 +97,22 @@
9797

9898
// Default TMC slave addresses
9999
#ifndef X_SLAVE_ADDRESS
100-
#define X_SLAVE_ADDRESS 0
100+
#define X_SLAVE_ADDRESS 0
101101
#endif
102102
#ifndef Y_SLAVE_ADDRESS
103-
#define Y_SLAVE_ADDRESS 1
103+
#define Y_SLAVE_ADDRESS 1
104104
#endif
105105
#ifndef Z_SLAVE_ADDRESS
106-
#define Z_SLAVE_ADDRESS 2
106+
#define Z_SLAVE_ADDRESS 2
107107
#endif
108108
#ifndef E0_SLAVE_ADDRESS
109-
#define E0_SLAVE_ADDRESS 3
109+
#define E0_SLAVE_ADDRESS 3
110110
#endif
111+
static_assert(X_SLAVE_ADDRESS == 0, "X_SLAVE_ADDRESS must be 0 for BOARD_FYSETC_AIO_II.");
112+
static_assert(Y_SLAVE_ADDRESS == 1, "Y_SLAVE_ADDRESS must be 1 for BOARD_FYSETC_AIO_II.");
113+
static_assert(Z_SLAVE_ADDRESS == 2, "Z_SLAVE_ADDRESS must be 2 for BOARD_FYSETC_AIO_II.");
114+
static_assert(E0_SLAVE_ADDRESS == 3, "E0_SLAVE_ADDRESS must be 3 for BOARD_FYSETC_AIO_II.");
111115

112-
// The 4xTMC2209 module doesn't have a serial multiplexer and
113-
// needs to set *_SLAVE_ADDRESS in Configuration_adv.h for X,Y,Z,E0
114116
#if HAS_DRIVER(TMC2208)
115117
#define TMC_SERIAL_MULTIPLEXER
116118
#define SERIAL_MUL_PIN1 PB13
@@ -162,7 +164,7 @@
162164
#if HAS_MARLINUI_U8GLIB
163165

164166
#define DOGLCD_A0 PA15
165-
#ifdef pins_v2_20190128
167+
#ifdef PINS_V2_20190128
166168
#define DOGLCD_CS PB5
167169
#else
168170
#define DOGLCD_CS PB7
@@ -183,7 +185,7 @@
183185
#define BTN_ENC PC12
184186
#endif
185187

186-
#ifdef pins_v2_20190128
188+
#ifdef PINS_V2_20190128
187189
#define LCD_RESET_PIN PB4
188190
#ifndef RGB_LED_R_PIN
189191
#define RGB_LED_R_PIN PB0

0 commit comments

Comments
 (0)