Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2967,9 +2967,9 @@
* but you can override or define them here.
*/
//#define TMC_USE_SW_SPI
//#define TMC_SW_MOSI -1
//#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1
//#define TMC_SPI_MOSI -1
//#define TMC_SPI_MISO -1
//#define TMC_SPI_SCK -1

// @section tmc/serial

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/DUE/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
* Usually the hardware SPI pins are only available to the LCD. This makes the DUE hard SPI used at the same time
* as the TMC2130 soft SPI the most common setup.
*/
#define _IS_HW_SPI(P) (defined(TMC_SW_##P) && (TMC_SW_##P == SD_MOSI_PIN || TMC_SW_##P == SD_MISO_PIN || TMC_SW_##P == SD_SCK_PIN))
#define _IS_HW_SPI(P) (defined(TMC_SPI_##P) && (TMC_SPI_##P == SD_MOSI_PIN || TMC_SPI_##P == SD_MISO_PIN || TMC_SPI_##P == SD_SCK_PIN))

#if ENABLED(SDSUPPORT) && HAS_DRIVER(TMC2130)
#if ENABLED(TMC_USE_SW_SPI)
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/LPC1768/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#if USING_HW_SERIAL0
#define IS_TX0(P) (P == P0_02)
#define IS_RX0(P) (P == P0_03)
#if IS_TX0(TMC_SW_MISO) || IS_RX0(TMC_SW_MOSI)
#if IS_TX0(TMC_SPI_MISO) || IS_RX0(TMC_SPI_MOSI)
#error "Serial port pins (0) conflict with Trinamic SPI pins!"
#elif HAS_PRUSA_MMU1 && (IS_TX0(E_MUX1_PIN) || IS_RX0(E_MUX0_PIN))
#error "Serial port pins (0) conflict with Multi-Material-Unit multiplexer pins!"
Expand All @@ -111,7 +111,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#define IS_RX1(P) (P == P0_16)
#define _IS_TX1_1 IS_TX1
#define _IS_RX1_1 IS_RX1
#if IS_TX1(TMC_SW_SCK)
#if IS_TX1(TMC_SPI_SCK)
#error "Serial port pins (1) conflict with other pins!"
#elif HAS_ROTARY_ENCODER
#if IS_TX1(BTN_EN2) || IS_RX1(BTN_EN1)
Expand Down
25 changes: 25 additions & 0 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -3313,6 +3313,31 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS
#endif
#undef INVALID_TMC_SPI

/**
* Map old TMC_SW_* to new TMC_SPI_*
*/
#ifdef TMC_SW_MISO
#warning "TMC_SW_MISO is now TMC_SPI_MISO."
#ifdef TMC_SPI_MISO
#error "TMC_SPI_MISO already defined"
#endif
#define TMC_SPI_MISO TMC_SW_MISO
#endif
#ifdef TMC_SW_MOSI
#warning "TMC_SW_MOSI is now TMC_SPI_MOSI."
#ifdef TMC_SPI_MOSI
#error "TMC_SPI_MOSI is already defined."
#endif
#define TMC_SPI_MOSI TMC_SW_MOSI
#endif
#ifdef TMC_SW_SCK
#warning "TMC_SW_SCK is now TMC_SPI_SCK."
#ifdef TMC_SPI_SCK
#error "TMC_SPI_SCK is already defined."
#endif
#define TMC_SPI_SCK TMC_SW_SCK
#endif

/**
* Check existing RX/TX pins against enable TMC UART drivers.
*/
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/stepper/trinamic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ enum StealthIndex : uint8_t {
// AI = Axis Enum Index
// SWHW = SW/SH UART selection
#if ENABLED(TMC_USE_SW_SPI)
#define __TMC_SPI_DEFINE(IC, ST, L, AI) TMCMarlin<IC##Stepper, L, AI> stepper##ST(ST##_CS_PIN, float(ST##_RSENSE), TMC_SW_MOSI, TMC_SW_MISO, TMC_SW_SCK, ST##_CHAIN_POS)
#define __TMC_SPI_DEFINE(IC, ST, L, AI) TMCMarlin<IC##Stepper, L, AI> stepper##ST(ST##_CS_PIN, float(ST##_RSENSE), TMC_SPI_MOSI, TMC_SPI_MISO, TMC_SPI_SCK, ST##_CHAIN_POS)
#else
#define __TMC_SPI_DEFINE(IC, ST, L, AI) TMCMarlin<IC##Stepper, L, AI> stepper##ST(ST##_CS_PIN, float(ST##_RSENSE), ST##_CHAIN_POS)
#endif
Expand Down
18 changes: 8 additions & 10 deletions Marlin/src/pins/linux/pins_RAMPS_LINUX.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,14 @@
/**
* Default pins for TMC software SPI
*/
#if ENABLED(TMC_USE_SW_SPI)
#ifndef TMC_SW_MOSI
#define TMC_SW_MOSI 66
#endif
#ifndef TMC_SW_MISO
#define TMC_SW_MISO 44
#endif
#ifndef TMC_SW_SCK
#define TMC_SW_SCK 64
#endif
#ifndef TMC_SPI_MOSI
#define TMC_SPI_MOSI 66
#endif
#ifndef TMC_SPI_MISO
#define TMC_SPI_MISO 44
#endif
#ifndef TMC_SPI_SCK
#define TMC_SPI_SCK 64
#endif

#if HAS_TMC_UART
Expand Down
18 changes: 8 additions & 10 deletions Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,14 @@
//
// Software SPI pins for TMC2130 stepper drivers
//
#if ENABLED(TMC_USE_SW_SPI)
#ifndef TMC_SW_MOSI
#define TMC_SW_MOSI P0_18 // ETH
#endif
#ifndef TMC_SW_MISO
#define TMC_SW_MISO P0_17 // ETH
#endif
#ifndef TMC_SW_SCK
#define TMC_SW_SCK P0_15 // ETH
#endif
#ifndef TMC_SPI_MOSI
#define TMC_SPI_MOSI P0_18 // ETH
#endif
#ifndef TMC_SPI_MISO
#define TMC_SPI_MISO P0_17 // ETH
#endif
#ifndef TMC_SPI_SCK
#define TMC_SPI_SCK P0_15 // ETH
#endif

//
Expand Down
9 changes: 4 additions & 5 deletions Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_1.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
#define E0_DIR_PIN P2_13
#define E0_ENABLE_PIN P2_12


/** ------ ------
* 1.30 | 1 2 | 2.11 0.17 | 1 2 | 0.15
* 0.18 | 3 4 | 0.16 3.26 | 3 4 | 1.23
Expand Down Expand Up @@ -165,12 +164,12 @@
// When using any TMC SPI-based drivers, software SPI is used
// because pins may be shared with the display or SD card.
#define TMC_USE_SW_SPI
#define TMC_SW_MOSI EXP2_06_PIN
#define TMC_SW_MISO EXP2_01_PIN
#define TMC_SPI_MOSI EXP2_06_PIN
#define TMC_SPI_MISO EXP2_01_PIN
// To minimize pin usage use the same clock pin as the display/SD card reader. (May generate LCD noise.)
#define TMC_SW_SCK EXP2_02_PIN
#define TMC_SPI_SCK EXP2_02_PIN
// If pin 2_06 is unused, it can be used for the clock to avoid the LCD noise.
//#define TMC_SW_SCK P2_06
//#define TMC_SPI_SCK P2_06

#if ENABLED(SOFTWARE_DRIVER_ENABLE)

Expand Down
20 changes: 9 additions & 11 deletions Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,14 @@
//
// Software SPI pins for TMC2130 stepper drivers
//
#if ENABLED(TMC_USE_SW_SPI)
#ifndef TMC_SW_MOSI
#define TMC_SW_MOSI P4_28
#endif
#ifndef TMC_SW_MISO
#define TMC_SW_MISO P0_05
#endif
#ifndef TMC_SW_SCK
#define TMC_SW_SCK P0_04
#endif
#ifndef TMC_SPI_MOSI
#define TMC_SPI_MOSI P4_28
#endif
#ifndef TMC_SPI_MISO
#define TMC_SPI_MISO P0_05
#endif
#ifndef TMC_SPI_SCK
#define TMC_SPI_SCK P0_04
#endif

#if HAS_TMC_UART
Expand Down Expand Up @@ -289,7 +287,7 @@
#define DOGLCD_A0 EXP1_06_PIN
#define DOGLCD_SCK EXP1_04_PIN
#define DOGLCD_MOSI EXP1_01_PIN
#define LCD_BACKLIGHT_PIN -1
#define LCD_BACKLIGHT_PIN -1

#elif ENABLED(CR10_STOCKDISPLAY)

Expand Down
18 changes: 8 additions & 10 deletions Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,14 @@
//
// Software SPI pins for TMC2130 stepper drivers
//
#if ENABLED(TMC_USE_SW_SPI)
#ifndef TMC_SW_MOSI
#define TMC_SW_MOSI P1_17
#endif
#ifndef TMC_SW_MISO
#define TMC_SW_MISO P0_05
#endif
#ifndef TMC_SW_SCK
#define TMC_SW_SCK P0_04
#endif
#ifndef TMC_SPI_MOSI
#define TMC_SPI_MOSI P1_17
#endif
#ifndef TMC_SPI_MISO
#define TMC_SPI_MISO P0_05
#endif
#ifndef TMC_SPI_SCK
#define TMC_SPI_SCK P0_04
#endif

#if HAS_TMC_UART
Expand Down
18 changes: 8 additions & 10 deletions Marlin/src/pins/lpc1768/pins_MKS_SBASE.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,16 +300,14 @@
// Hardware SPI is on EXP2. See if you can make it work:
// https://github.com/makerbase-mks/MKS-SBASE/issues/25
#define TMC_USE_SW_SPI
#if ENABLED(TMC_USE_SW_SPI)
#ifndef TMC_SW_MOSI
#define TMC_SW_MOSI P0_03 // AUX1
#endif
#ifndef TMC_SW_MISO
#define TMC_SW_MISO P0_02 // AUX1
#endif
#ifndef TMC_SW_SCK
#define TMC_SW_SCK P0_26 // TH4
#endif
#ifndef TMC_SPI_MOSI
#define TMC_SPI_MOSI P0_03 // AUX1
#endif
#ifndef TMC_SPI_MISO
#define TMC_SPI_MISO P0_02 // AUX1
#endif
#ifndef TMC_SPI_SCK
#define TMC_SPI_SCK P0_26 // TH4
#endif

#endif
Expand Down
18 changes: 8 additions & 10 deletions Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,14 @@
//
// Software SPI pins for TMC2130 stepper drivers
//
#if ENABLED(TMC_USE_SW_SPI)
#ifndef TMC_SW_MOSI
#define TMC_SW_MOSI P4_28
#endif
#ifndef TMC_SW_MISO
#define TMC_SW_MISO P0_05
#endif
#ifndef TMC_SW_SCK
#define TMC_SW_SCK P0_04
#endif
#ifndef TMC_SPI_MOSI
#define TMC_SPI_MOSI P4_28
#endif
#ifndef TMC_SPI_MISO
#define TMC_SPI_MISO P0_05
#endif
#ifndef TMC_SPI_SCK
#define TMC_SPI_SCK P0_04
#endif

#if HAS_TMC_UART
Expand Down
19 changes: 8 additions & 11 deletions Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,14 @@
//
// Software SPI pins for TMC2130 stepper drivers
//
#if ENABLED(TMC_USE_SW_SPI)
#ifndef TMC_SW_MOSI
#define TMC_SW_MOSI P1_00 // ETH
#endif
#ifndef TMC_SW_MISO
#define TMC_SW_MISO P1_08 // ETH
#endif
#ifndef TMC_SW_SCK
#define TMC_SW_SCK P1_09 // ETH
#endif
#ifndef TMC_SPI_MOSI
#define TMC_SPI_MOSI P1_00 // ETH
#endif
#ifndef TMC_SPI_MISO
#define TMC_SPI_MISO P1_08 // ETH
#endif
#ifndef TMC_SPI_SCK
#define TMC_SPI_SCK P1_09 // ETH
#endif

#if HAS_TMC_UART
Expand All @@ -119,7 +117,6 @@
* If undefined software serial is used according to the pins below
*/


// P2_08 E1-Step
// P2_13 E1-Dir

Expand Down
18 changes: 8 additions & 10 deletions Marlin/src/pins/lpc1769/pins_COHESION3D_MINI.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,14 @@
//
// Default pins for TMC software SPI
//
#if ENABLED(TMC_USE_SW_SPI)
#ifndef TMC_SW_MOSI
#define TMC_SW_MOSI P1_16 // Ethernet Expansion - Pin 5
#endif
#ifndef TMC_SW_MISO
#define TMC_SW_MISO P1_17 // Ethernet Expansion - Pin 6
#endif
#ifndef TMC_SW_SCK
#define TMC_SW_SCK P1_08 // Ethernet Expansion - Pin 7
#endif
#ifndef TMC_SPI_MOSI
#define TMC_SPI_MOSI P1_16 // Ethernet Expansion - Pin 5
#endif
#ifndef TMC_SPI_MISO
#define TMC_SPI_MISO P1_17 // Ethernet Expansion - Pin 6
#endif
#ifndef TMC_SPI_SCK
#define TMC_SPI_SCK P1_08 // Ethernet Expansion - Pin 7
#endif

//
Expand Down
18 changes: 8 additions & 10 deletions Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,14 @@
//
// Default pins for TMC software SPI
//
#if ENABLED(TMC_USE_SW_SPI)
#ifndef TMC_SW_MOSI
#define TMC_SW_MOSI P1_16 // Ethernet Expansion - Pin 5
#endif
#ifndef TMC_SW_MISO
#define TMC_SW_MISO P1_17 // Ethernet Expansion - Pin 6
#endif
#ifndef TMC_SW_SCK
#define TMC_SW_SCK P1_08 // Ethernet Expansion - Pin 7
#endif
#ifndef TMC_SPI_MOSI
#define TMC_SPI_MOSI P1_16 // Ethernet Expansion - Pin 5
#endif
#ifndef TMC_SPI_MISO
#define TMC_SPI_MISO P1_17 // Ethernet Expansion - Pin 6
#endif
#ifndef TMC_SPI_SCK
#define TMC_SPI_SCK P1_08 // Ethernet Expansion - Pin 7
#endif

//
Expand Down
18 changes: 8 additions & 10 deletions Marlin/src/pins/lpc1769/pins_FLY_CDY.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,14 @@
//
// Software SPI pins for TMC2130 stepper drivers
//
#if ENABLED(TMC_USE_SW_SPI)
#ifndef TMC_SW_MOSI
#define TMC_SW_MOSI P0_20
#endif
#ifndef TMC_SW_MISO
#define TMC_SW_MISO P0_19
#endif
#ifndef TMC_SW_SCK
#define TMC_SW_SCK P0_21
#endif
#ifndef TMC_SPI_MOSI
#define TMC_SPI_MOSI P0_20
#endif
#ifndef TMC_SPI_MISO
#define TMC_SPI_MISO P0_19
#endif
#ifndef TMC_SPI_SCK
#define TMC_SPI_SCK P0_21
#endif

#if HAS_TMC_UART
Expand Down
Loading