Skip to content

Commit 9eb78a7

Browse files
committed
🔧 Assert TMC slave addresses, minor pins cleanup
1 parent 4f2b727 commit 9eb78a7

17 files changed

+351
-222
lines changed

Marlin/src/pins/gd32f1/pins_SOVOL_V131.h

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

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

Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h

+24-17
Original file line numberDiff line numberDiff line change
@@ -569,33 +569,40 @@
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-
#ifndef X_SLAVE_ADDRESS
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
581+
#ifdef X_SLAVE_ADDRESS
582+
static_assert(X_SLAVE_ADDRESS == 0b00, "X_SLAVE_ADDRESS must be 0b00 for BOARD_BRICOLEMON_LITE_V1_0.");
583+
#else
576584
#define X_SLAVE_ADDRESS 0b00
577585
#endif
578-
#ifndef Y_SLAVE_ADDRESS
586+
#ifdef Y_SLAVE_ADDRESS
587+
static_assert(Y_SLAVE_ADDRESS == 0b01, "Y_SLAVE_ADDRESS must be 0b01 for BOARD_BRICOLEMON_LITE_V1_0.");
588+
#else
579589
#define Y_SLAVE_ADDRESS 0b01
580590
#endif
581-
#ifndef Z_SLAVE_ADDRESS
591+
#ifdef Z_SLAVE_ADDRESS
592+
static_assert(Z_SLAVE_ADDRESS == 0b10, "Z_SLAVE_ADDRESS must be 0b10 for BOARD_BRICOLEMON_LITE_V1_0.");
593+
#else
582594
#define Z_SLAVE_ADDRESS 0b10
583595
#endif
584-
#ifndef E0_SLAVE_ADDRESS
596+
#ifdef E0_SLAVE_ADDRESS
597+
static_assert(E0_SLAVE_ADDRESS == 0b11, "E0_SLAVE_ADDRESS must be 0b11 for BOARD_BRICOLEMON_LITE_V1_0.");
598+
#else
585599
#define E0_SLAVE_ADDRESS 0b11
586600
#endif
587601

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
602+
// Reduce baud rate to improve software serial reliability
603+
#ifndef TMC_BAUD_RATE
604+
#define TMC_BAUD_RATE 19200 // 250000
605+
#endif
599606

600607
//
601608
// Software serial

Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h

+30-21
Original file line numberDiff line numberDiff line change
@@ -620,40 +620,49 @@
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-
#ifndef X_SLAVE_ADDRESS
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
636+
#ifdef X_SLAVE_ADDRESS
637+
static_assert(X_SLAVE_ADDRESS == 0b00, "X_SLAVE_ADDRESS must be 0b00 for BOARD_BRICOLEMON_V1_0.");
638+
#else
629639
#define X_SLAVE_ADDRESS 0b00
630640
#endif
631-
#ifndef Y_SLAVE_ADDRESS
641+
#ifdef Y_SLAVE_ADDRESS
642+
static_assert(Y_SLAVE_ADDRESS == 0b01, "Y_SLAVE_ADDRESS must be 0b01 for BOARD_BRICOLEMON_V1_0.");
643+
#else
632644
#define Y_SLAVE_ADDRESS 0b01
633645
#endif
634-
#ifndef Z_SLAVE_ADDRESS
646+
#ifdef Z_SLAVE_ADDRESS
647+
static_assert(Z_SLAVE_ADDRESS == 0b10, "Z_SLAVE_ADDRESS must be 0b10 for BOARD_BRICOLEMON_V1_0.");
648+
#else
635649
#define Z_SLAVE_ADDRESS 0b10
636650
#endif
637-
#ifndef E0_SLAVE_ADDRESS
651+
#ifdef E0_SLAVE_ADDRESS
652+
static_assert(E0_SLAVE_ADDRESS == 0b11, "E0_SLAVE_ADDRESS must be 0b11 for BOARD_BRICOLEMON_V1_0.");
653+
#else
638654
#define E0_SLAVE_ADDRESS 0b11
639655
#endif
640-
#ifndef E1_SLAVE_ADDRESS
656+
#ifdef E1_SLAVE_ADDRESS
657+
static_assert(E1_SLAVE_ADDRESS == 0b00, "E0_SLAVE_ADDRESS must be 0b00 for BOARD_BRICOLEMON_V1_0.");
658+
#else
641659
#define E1_SLAVE_ADDRESS 0b00
642660
#endif
643661

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
662+
// Reduce baud rate to improve software serial reliability
663+
#ifndef TMC_BAUD_RATE
664+
#define TMC_BAUD_RATE 19200 // 250000
665+
#endif
657666

658667
//
659668
// Software serial

Marlin/src/pins/samd/pins_MINITRONICS20.h

+30-21
Original file line numberDiff line numberDiff line change
@@ -497,40 +497,49 @@
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-
#ifndef X_SLAVE_ADDRESS
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
513+
#ifdef X_SLAVE_ADDRESS
514+
static_assert(X_SLAVE_ADDRESS == 0b00, "X_SLAVE_ADDRESS must be 0b00 for BOARD_ERYONE_ERY32_MINI.");
515+
#else
506516
#define X_SLAVE_ADDRESS 0b00
507517
#endif
508-
#ifndef Y_SLAVE_ADDRESS
518+
#ifdef Y_SLAVE_ADDRESS
519+
static_assert(Y_SLAVE_ADDRESS == 0b01, "Y_SLAVE_ADDRESS must be 0b01 for BOARD_ERYONE_ERY32_MINI.");
520+
#else
509521
#define Y_SLAVE_ADDRESS 0b01
510522
#endif
511-
#ifndef Z_SLAVE_ADDRESS
523+
#ifdef Z_SLAVE_ADDRESS
524+
static_assert(Z_SLAVE_ADDRESS == 0b10, "Z_SLAVE_ADDRESS must be 0b10 for BOARD_ERYONE_ERY32_MINI.");
525+
#else
512526
#define Z_SLAVE_ADDRESS 0b10
513527
#endif
514-
#ifndef E0_SLAVE_ADDRESS
528+
#ifdef E0_SLAVE_ADDRESS
529+
static_assert(E0_SLAVE_ADDRESS == 0b11, "E0_SLAVE_ADDRESS must be 0b11 for BOARD_ERYONE_ERY32_MINI.");
530+
#else
515531
#define E0_SLAVE_ADDRESS 0b11
516532
#endif
517-
#ifndef E1_SLAVE_ADDRESS
533+
#ifdef E1_SLAVE_ADDRESS
534+
static_assert(E1_SLAVE_ADDRESS == 0b00, "E0_SLAVE_ADDRESS must be 0b00 for BOARD_ERYONE_ERY32_MINI.");
535+
#else
518536
#define E1_SLAVE_ADDRESS 0b00
519537
#endif
520538

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
539+
// Reduce baud rate to improve software serial reliability
540+
#ifndef TMC_BAUD_RATE
541+
#define TMC_BAUD_RATE 19200 // 250000
542+
#endif
534543

535544
//
536545
// Software serial

Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h

+18-9
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

@@ -144,17 +145,25 @@
144145
#define E0_HARDWARE_SERIAL MSerial4
145146

146147
// Default TMC slave addresses
147-
#ifndef X_SLAVE_ADDRESS
148-
#define X_SLAVE_ADDRESS 0
148+
#ifdef X_SLAVE_ADDRESS
149+
static_assert(X_SLAVE_ADDRESS == 0, "X_SLAVE_ADDRESS must be 0 for BOARD_BTT_SKR_CR6.");
150+
#else
151+
#define X_SLAVE_ADDRESS 0
149152
#endif
150-
#ifndef Y_SLAVE_ADDRESS
151-
#define Y_SLAVE_ADDRESS 1
153+
#ifdef Y_SLAVE_ADDRESS
154+
static_assert(Y_SLAVE_ADDRESS == 1, "Y_SLAVE_ADDRESS must be 1 for BOARD_BTT_SKR_CR6.");
155+
#else
156+
#define Y_SLAVE_ADDRESS 1
152157
#endif
153-
#ifndef Z_SLAVE_ADDRESS
154-
#define Z_SLAVE_ADDRESS 2
158+
#ifdef Z_SLAVE_ADDRESS
159+
static_assert(Z_SLAVE_ADDRESS == 2, "Z_SLAVE_ADDRESS must be 2 for BOARD_BTT_SKR_CR6.");
160+
#else
161+
#define Z_SLAVE_ADDRESS 2
155162
#endif
156-
#ifndef E0_SLAVE_ADDRESS
157-
#define E0_SLAVE_ADDRESS 3
163+
#ifdef E0_SLAVE_ADDRESS
164+
static_assert(E0_SLAVE_ADDRESS == 3, "E0_SLAVE_ADDRESS must be 3 for BOARD_BTT_SKR_CR6.");
165+
#else
166+
#define E0_SLAVE_ADDRESS 3
158167
#endif
159168
#endif
160169

Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V1_0.h

+17-8
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
@@ -36,16 +37,24 @@
3637
#define E0_HARDWARE_SERIAL MSerial4
3738

3839
// Default TMC slave addresses
39-
#ifndef X_SLAVE_ADDRESS
40-
#define X_SLAVE_ADDRESS 0
40+
#ifdef X_SLAVE_ADDRESS
41+
static_assert(X_SLAVE_ADDRESS == 0, "X_SLAVE_ADDRESS must be 0 for BOARD_BTT_SKR_MINI_E3_V1_0.");
42+
#else
43+
#define X_SLAVE_ADDRESS 0
4144
#endif
42-
#ifndef Y_SLAVE_ADDRESS
43-
#define Y_SLAVE_ADDRESS 2
45+
#ifdef Y_SLAVE_ADDRESS
46+
static_assert(Y_SLAVE_ADDRESS == 2, "Y_SLAVE_ADDRESS must be 2 for BOARD_BTT_SKR_MINI_E3_V1_0.");
47+
#else
48+
#define Y_SLAVE_ADDRESS 2
4449
#endif
45-
#ifndef Z_SLAVE_ADDRESS
46-
#define Z_SLAVE_ADDRESS 1
50+
#ifdef Z_SLAVE_ADDRESS
51+
static_assert(Z_SLAVE_ADDRESS == 1, "Z_SLAVE_ADDRESS must be 1 for BOARD_BTT_SKR_MINI_E3_V1_0.");
52+
#else
53+
#define Z_SLAVE_ADDRESS 1
4754
#endif
48-
#ifndef E0_SLAVE_ADDRESS
49-
#define E0_SLAVE_ADDRESS 3
55+
#ifdef E0_SLAVE_ADDRESS
56+
static_assert(E0_SLAVE_ADDRESS == 3, "E0_SLAVE_ADDRESS must be 3 for BOARD_BTT_SKR_MINI_E3_V1_0.");
57+
#else
58+
#define E0_SLAVE_ADDRESS 3
5059
#endif
5160
#endif

Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h

+16-8
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,25 @@
9494
#define E0_HARDWARE_SERIAL MSerial4
9595

9696
// Default TMC slave addresses
97-
#ifndef X_SLAVE_ADDRESS
98-
#define X_SLAVE_ADDRESS 0
97+
#ifdef X_SLAVE_ADDRESS
98+
static_assert(X_SLAVE_ADDRESS == 0, "X_SLAVE_ADDRESS must be 0 for BOARD_SKR_MINI_E3_V2_0.");
99+
#else
100+
#define X_SLAVE_ADDRESS 0
99101
#endif
100-
#ifndef Y_SLAVE_ADDRESS
101-
#define Y_SLAVE_ADDRESS 2
102+
#ifdef Y_SLAVE_ADDRESS
103+
static_assert(Y_SLAVE_ADDRESS == 2, "Y_SLAVE_ADDRESS must be 2 for BOARD_SKR_MINI_E3_V2_0.");
104+
#else
105+
#define Y_SLAVE_ADDRESS 2
102106
#endif
103-
#ifndef Z_SLAVE_ADDRESS
104-
#define Z_SLAVE_ADDRESS 1
107+
#ifdef Z_SLAVE_ADDRESS
108+
static_assert(Z_SLAVE_ADDRESS == 1, "Z_SLAVE_ADDRESS must be 1 for BOARD_SKR_MINI_E3_V2_0.");
109+
#else
110+
#define Z_SLAVE_ADDRESS 1
105111
#endif
106-
#ifndef E0_SLAVE_ADDRESS
107-
#define E0_SLAVE_ADDRESS 3
112+
#ifdef E0_SLAVE_ADDRESS
113+
static_assert(E0_SLAVE_ADDRESS == 3, "E0_SLAVE_ADDRESS must be 3 for BOARD_SKR_MINI_E3_V2_0.");
114+
#else
115+
#define E0_SLAVE_ADDRESS 3
108116
#endif
109117
#endif
110118

Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h

+14-4
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,26 @@
135135
#define Y_HARDWARE_SERIAL MSerial4
136136
#define Z_HARDWARE_SERIAL MSerial4
137137
#define E0_HARDWARE_SERIAL MSerial4
138-
#ifndef X_SLAVE_ADDRESS
138+
139+
// Default TMC slave addresses
140+
#ifdef X_SLAVE_ADDRESS
141+
static_assert(X_SLAVE_ADDRESS == 2, "X_SLAVE_ADDRESS must be 2 for BOARD_ERYONE_ERY32_MINI.");
142+
#else
139143
#define X_SLAVE_ADDRESS 2
140144
#endif
141-
#ifndef Y_SLAVE_ADDRESS
145+
#ifdef Y_SLAVE_ADDRESS
146+
static_assert(Y_SLAVE_ADDRESS == 3, "Y_SLAVE_ADDRESS must be 3 for BOARD_ERYONE_ERY32_MINI.");
147+
#else
142148
#define Y_SLAVE_ADDRESS 3
143149
#endif
144-
#ifndef Z_SLAVE_ADDRESS
150+
#ifdef Z_SLAVE_ADDRESS
151+
static_assert(Z_SLAVE_ADDRESS == 1, "Z_SLAVE_ADDRESS must be 1 for BOARD_ERYONE_ERY32_MINI.");
152+
#else
145153
#define Z_SLAVE_ADDRESS 1
146154
#endif
147-
#ifndef E0_SLAVE_ADDRESS
155+
#ifdef E0_SLAVE_ADDRESS
156+
static_assert(E0_SLAVE_ADDRESS == 0, "E0_SLAVE_ADDRESS must be 0 for BOARD_ERYONE_ERY32_MINI.");
157+
#else
148158
#define E0_SLAVE_ADDRESS 0
149159
#endif
150160
#endif

0 commit comments

Comments
 (0)