Skip to content

Commit

Permalink
Let boards set Default TMC Slave Addresses (MarlinFirmware#20498)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
  • Loading branch information
2 people authored and zillarob committed Feb 25, 2021
1 parent 5edeb6b commit 6755862
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 28 deletions.
32 changes: 16 additions & 16 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2427,22 +2427,22 @@
* Set *_SERIAL_TX_PIN and *_SERIAL_RX_PIN to match for all drivers
* on the same serial port, either here or in your board's pins file.
*/
#define X_SLAVE_ADDRESS 0
#define Y_SLAVE_ADDRESS 0
#define Z_SLAVE_ADDRESS 0
#define X2_SLAVE_ADDRESS 0
#define Y2_SLAVE_ADDRESS 0
#define Z2_SLAVE_ADDRESS 0
#define Z3_SLAVE_ADDRESS 0
#define Z4_SLAVE_ADDRESS 0
#define E0_SLAVE_ADDRESS 0
#define E1_SLAVE_ADDRESS 0
#define E2_SLAVE_ADDRESS 0
#define E3_SLAVE_ADDRESS 0
#define E4_SLAVE_ADDRESS 0
#define E5_SLAVE_ADDRESS 0
#define E6_SLAVE_ADDRESS 0
#define E7_SLAVE_ADDRESS 0
//#define X_SLAVE_ADDRESS 0
//#define Y_SLAVE_ADDRESS 0
//#define Z_SLAVE_ADDRESS 0
//#define X2_SLAVE_ADDRESS 0
//#define Y2_SLAVE_ADDRESS 0
//#define Z2_SLAVE_ADDRESS 0
//#define Z3_SLAVE_ADDRESS 0
//#define Z4_SLAVE_ADDRESS 0
//#define E0_SLAVE_ADDRESS 0
//#define E1_SLAVE_ADDRESS 0
//#define E2_SLAVE_ADDRESS 0
//#define E3_SLAVE_ADDRESS 0
//#define E4_SLAVE_ADDRESS 0
//#define E5_SLAVE_ADDRESS 0
//#define E6_SLAVE_ADDRESS 0
//#define E7_SLAVE_ADDRESS 0

/**
* Software enable
Expand Down
14 changes: 14 additions & 0 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 @@ -34,4 +34,18 @@
#define Y_HARDWARE_SERIAL MSerial4
#define Z_HARDWARE_SERIAL MSerial4
#define E0_HARDWARE_SERIAL MSerial4

// Default TMC slave addresses
#ifndef X_SLAVE_ADDRESS
#define X_SLAVE_ADDRESS 0
#endif
#ifndef Y_SLAVE_ADDRESS
#define Y_SLAVE_ADDRESS 2
#endif
#ifndef Z_SLAVE_ADDRESS
#define Z_SLAVE_ADDRESS 1
#endif
#ifndef E0_SLAVE_ADDRESS
#define E0_SLAVE_ADDRESS 3
#endif
#endif
22 changes: 18 additions & 4 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 @@ -47,13 +47,27 @@
#define CONTROLLER_FAN_PIN FAN1_PIN
#endif

/**
* TMC220x stepper drivers
* Hardware serial communication ports.
*/
#if HAS_TMC_UART
/**
* TMC220x stepper drivers
* Hardware serial communication ports
*/
#define X_HARDWARE_SERIAL MSerial4
#define Y_HARDWARE_SERIAL MSerial4
#define Z_HARDWARE_SERIAL MSerial4
#define E0_HARDWARE_SERIAL MSerial4

// Default TMC slave addresses
#ifndef X_SLAVE_ADDRESS
#define X_SLAVE_ADDRESS 0
#endif
#ifndef Y_SLAVE_ADDRESS
#define Y_SLAVE_ADDRESS 2
#endif
#ifndef Z_SLAVE_ADDRESS
#define Z_SLAVE_ADDRESS 1
#endif
#ifndef E0_SLAVE_ADDRESS
#define E0_SLAVE_ADDRESS 3
#endif
#endif
24 changes: 20 additions & 4 deletions Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,26 @@
#define E0_DIR_PIN PC14
#define E0_ENABLE_PIN PC13

#define X_HARDWARE_SERIAL MSerial2
#define Y_HARDWARE_SERIAL MSerial2
#define Z_HARDWARE_SERIAL MSerial2
#define E0_HARDWARE_SERIAL MSerial2
#if HAS_TMC_UART
#define X_HARDWARE_SERIAL MSerial2
#define Y_HARDWARE_SERIAL MSerial2
#define Z_HARDWARE_SERIAL MSerial2
#define E0_HARDWARE_SERIAL MSerial2

// Default TMC slave addresses
#ifndef X_SLAVE_ADDRESS
#define X_SLAVE_ADDRESS 0
#endif
#ifndef Y_SLAVE_ADDRESS
#define Y_SLAVE_ADDRESS 1
#endif
#ifndef Z_SLAVE_ADDRESS
#define Z_SLAVE_ADDRESS 2
#endif
#ifndef E0_SLAVE_ADDRESS
#define E0_SLAVE_ADDRESS 3
#endif
#endif

//
// Heaters / Fans
Expand Down
4 changes: 0 additions & 4 deletions buildroot/tests/STM32F103RC_btt-tests
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ opt_set X_DRIVER_TYPE TMC2209
opt_set Y_DRIVER_TYPE TMC2209
opt_set Z_DRIVER_TYPE TMC2209
opt_set E0_DRIVER_TYPE TMC2209
opt_set X_SLAVE_ADDRESS 0
opt_set Y_SLAVE_ADDRESS 1
opt_set Z_SLAVE_ADDRESS 2
opt_set E0_SLAVE_ADDRESS 3
opt_enable PINS_DEBUGGING

exec_test $1 $2 "BigTreeTech SKR Mini E3 1.0 - Basic Config with TMC2209 HW Serial"
Expand Down

0 comments on commit 6755862

Please sign in to comment.