Add HAS_TMC220x
This commit is contained in:
parent
9821ec2afd
commit
1a349c7522
17 changed files with 25 additions and 23 deletions
|
@ -860,7 +860,7 @@ void setup() {
|
||||||
|
|
||||||
setup_killpin();
|
setup_killpin();
|
||||||
|
|
||||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_TMC220x
|
||||||
tmc_serial_begin();
|
tmc_serial_begin();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,8 @@
|
||||||
|| HAS_DRIVER(TMC5130) \
|
|| HAS_DRIVER(TMC5130) \
|
||||||
|| HAS_DRIVER(TMC5160) )
|
|| HAS_DRIVER(TMC5160) )
|
||||||
|
|
||||||
|
#define HAS_TMC220x (HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209))
|
||||||
|
|
||||||
#define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|
#define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|
||||||
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|
||||||
|| AXIS_DRIVER_TYPE(A,TMC2208) \
|
|| AXIS_DRIVER_TYPE(A,TMC2208) \
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
#if ENABLED(TMC_DEBUG)
|
#if ENABLED(TMC_DEBUG)
|
||||||
#if HAS_TMCX1X0 || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_TMCX1X0 || HAS_TMC220x
|
||||||
uint8_t cs_actual;
|
uint8_t cs_actual;
|
||||||
#endif
|
#endif
|
||||||
#if HAS_STALLGUARD
|
#if HAS_STALLGUARD
|
||||||
|
@ -139,7 +139,7 @@
|
||||||
|
|
||||||
#endif // HAS_TMCX1X0
|
#endif // HAS_TMCX1X0
|
||||||
|
|
||||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_TMC220x
|
||||||
|
|
||||||
#if ENABLED(TMC_DEBUG)
|
#if ENABLED(TMC_DEBUG)
|
||||||
static uint32_t get_pwm_scale(TMC2208Stepper &st) { return st.pwm_scale_sum(); }
|
static uint32_t get_pwm_scale(TMC2208Stepper &st) { return st.pwm_scale_sum(); }
|
||||||
|
@ -239,7 +239,7 @@
|
||||||
st.printLabel();
|
st.printLabel();
|
||||||
SERIAL_CHAR(':'); SERIAL_PRINT(pwm_scale, DEC);
|
SERIAL_CHAR(':'); SERIAL_PRINT(pwm_scale, DEC);
|
||||||
#if ENABLED(TMC_DEBUG)
|
#if ENABLED(TMC_DEBUG)
|
||||||
#if HAS_TMCX1X0 || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_TMCX1X0 || HAS_TMC220x
|
||||||
SERIAL_CHAR('/'); SERIAL_PRINT(data.cs_actual, DEC);
|
SERIAL_CHAR('/'); SERIAL_PRINT(data.cs_actual, DEC);
|
||||||
#endif
|
#endif
|
||||||
#if HAS_STALLGUARD
|
#if HAS_STALLGUARD
|
||||||
|
@ -516,7 +516,7 @@
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_TMC220x
|
||||||
static void _tmc_status(TMC2208Stepper &st, const TMC_debug_enum i) {
|
static void _tmc_status(TMC2208Stepper &st, const TMC_debug_enum i) {
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case TMC_PWM_SCALE: SERIAL_PRINT(st.pwm_scale_sum(), DEC); break;
|
case TMC_PWM_SCALE: SERIAL_PRINT(st.pwm_scale_sum(), DEC); break;
|
||||||
|
@ -789,7 +789,7 @@
|
||||||
#endif
|
#endif
|
||||||
TMC_REPORT("CS actual\t", TMC_CS_ACTUAL);
|
TMC_REPORT("CS actual\t", TMC_CS_ACTUAL);
|
||||||
TMC_REPORT("PWM scale", TMC_PWM_SCALE);
|
TMC_REPORT("PWM scale", TMC_PWM_SCALE);
|
||||||
#if HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2224) || HAS_DRIVER(TMC2660) || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2224) || HAS_DRIVER(TMC2660) || HAS_TMC220x
|
||||||
TMC_REPORT("vsense\t", TMC_VSENSE);
|
TMC_REPORT("vsense\t", TMC_VSENSE);
|
||||||
#endif
|
#endif
|
||||||
TMC_REPORT("stealthChop", TMC_STEALTHCHOP);
|
TMC_REPORT("stealthChop", TMC_STEALTHCHOP);
|
||||||
|
@ -821,7 +821,7 @@
|
||||||
DRV_REPORT("s2ga\t", TMC_S2GA);
|
DRV_REPORT("s2ga\t", TMC_S2GA);
|
||||||
DRV_REPORT("otpw\t", TMC_DRV_OTPW);
|
DRV_REPORT("otpw\t", TMC_DRV_OTPW);
|
||||||
DRV_REPORT("ot\t", TMC_OT);
|
DRV_REPORT("ot\t", TMC_OT);
|
||||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_TMC220x
|
||||||
DRV_REPORT("157C\t", TMC_T157);
|
DRV_REPORT("157C\t", TMC_T157);
|
||||||
DRV_REPORT("150C\t", TMC_T150);
|
DRV_REPORT("150C\t", TMC_T150);
|
||||||
DRV_REPORT("143C\t", TMC_T143);
|
DRV_REPORT("143C\t", TMC_T143);
|
||||||
|
@ -845,7 +845,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_TMC220x
|
||||||
static void tmc_get_ic_registers(TMC2208Stepper, const TMC_get_registers_enum) { SERIAL_CHAR('\t'); }
|
static void tmc_get_ic_registers(TMC2208Stepper, const TMC_get_registers_enum) { SERIAL_CHAR('\t'); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -909,7 +909,7 @@
|
||||||
#define HAS_TMCX1X0 (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2160) || HAS_DRIVER(TMC5130) || HAS_DRIVER(TMC5160))
|
#define HAS_TMCX1X0 (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2160) || HAS_DRIVER(TMC5130) || HAS_DRIVER(TMC5160))
|
||||||
#define TMC_HAS_SPI (HAS_TMCX1X0 || HAS_DRIVER(TMC2660))
|
#define TMC_HAS_SPI (HAS_TMCX1X0 || HAS_DRIVER(TMC2660))
|
||||||
#define HAS_STALLGUARD (HAS_TMCX1X0 || HAS_DRIVER(TMC2209) || HAS_DRIVER(TMC2660))
|
#define HAS_STALLGUARD (HAS_TMCX1X0 || HAS_DRIVER(TMC2209) || HAS_DRIVER(TMC2660))
|
||||||
#define HAS_STEALTHCHOP (HAS_TMCX1X0 || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209))
|
#define HAS_STEALTHCHOP (HAS_TMCX1X0 || HAS_TMC220x)
|
||||||
|
|
||||||
#define STEALTHCHOP_ENABLED ANY(STEALTHCHOP_XY, STEALTHCHOP_Z, STEALTHCHOP_E)
|
#define STEALTHCHOP_ENABLED ANY(STEALTHCHOP_XY, STEALTHCHOP_Z, STEALTHCHOP_E)
|
||||||
#define USE_SENSORLESS EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING)
|
#define USE_SENSORLESS EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING)
|
||||||
|
|
|
@ -2015,7 +2015,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||||
/**
|
/**
|
||||||
* TMC2208/2209 software UART and ENDSTOP_INTERRUPTS both use pin change interrupts (PCI)
|
* TMC2208/2209 software UART and ENDSTOP_INTERRUPTS both use pin change interrupts (PCI)
|
||||||
*/
|
*/
|
||||||
#if (HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)) && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && !( \
|
#if HAS_TMC220x && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && !( \
|
||||||
defined(X_HARDWARE_SERIAL ) \
|
defined(X_HARDWARE_SERIAL ) \
|
||||||
|| defined(X2_HARDWARE_SERIAL) \
|
|| defined(X2_HARDWARE_SERIAL) \
|
||||||
|| defined(Y_HARDWARE_SERIAL ) \
|
|| defined(Y_HARDWARE_SERIAL ) \
|
||||||
|
@ -2035,7 +2035,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||||
/**
|
/**
|
||||||
* TMC2208/2209 software UART is only supported on AVR, LPC, STM32F1 and STM32F4
|
* TMC2208/2209 software UART is only supported on AVR, LPC, STM32F1 and STM32F4
|
||||||
*/
|
*/
|
||||||
#if (HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)) && !defined(__AVR__) && !defined(TARGET_LPC1768) && !defined(TARGET_STM32F1) && !defined(TARGET_STM32F4) && !( \
|
#if HAS_TMC220x && !defined(__AVR__) && !defined(TARGET_LPC1768) && !defined(TARGET_STM32F1) && !defined(TARGET_STM32F4) && !( \
|
||||||
defined(X_HARDWARE_SERIAL ) \
|
defined(X_HARDWARE_SERIAL ) \
|
||||||
|| defined(X2_HARDWARE_SERIAL) \
|
|| defined(X2_HARDWARE_SERIAL) \
|
||||||
|| defined(Y_HARDWARE_SERIAL ) \
|
|| defined(Y_HARDWARE_SERIAL ) \
|
||||||
|
|
|
@ -309,7 +309,7 @@
|
||||||
//
|
//
|
||||||
// TMC2208/2209 Driver objects and inits
|
// TMC2208/2209 Driver objects and inits
|
||||||
//
|
//
|
||||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_TMC220x
|
||||||
#if AXIS_HAS_UART(X)
|
#if AXIS_HAS_UART(X)
|
||||||
#ifdef X_HARDWARE_SERIAL
|
#ifdef X_HARDWARE_SERIAL
|
||||||
TMC_UART_DEFINE(HW, X, X);
|
TMC_UART_DEFINE(HW, X, X);
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
|
|
||||||
static constexpr chopper_timing_t chopper_timing = CHOPPER_TIMING;
|
static constexpr chopper_timing_t chopper_timing = CHOPPER_TIMING;
|
||||||
|
|
||||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_TMC220x
|
||||||
void tmc_serial_begin();
|
void tmc_serial_begin();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -109,7 +109,7 @@
|
||||||
#define TMC_SW_SCK PC10
|
#define TMC_SW_SCK PC10
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_TMC220x
|
||||||
/**
|
/**
|
||||||
* TMC2208 stepper drivers
|
* TMC2208 stepper drivers
|
||||||
*
|
*
|
||||||
|
|
|
@ -114,7 +114,7 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_TMC220x
|
||||||
/**
|
/**
|
||||||
* TMC2208/TMC2209 stepper drivers
|
* TMC2208/TMC2209 stepper drivers
|
||||||
*
|
*
|
||||||
|
|
|
@ -117,7 +117,7 @@
|
||||||
// the jumper next to the limit switch socket when using sensorless homing.
|
// the jumper next to the limit switch socket when using sensorless homing.
|
||||||
//
|
//
|
||||||
|
|
||||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_TMC220x
|
||||||
// Software serial
|
// Software serial
|
||||||
// At the moment, F6 rx pins are not pc interrupt pins
|
// At the moment, F6 rx pins are not pc interrupt pins
|
||||||
#define X_SERIAL_RX_PIN -1 // 71
|
#define X_SERIAL_RX_PIN -1 // 71
|
||||||
|
|
|
@ -303,7 +303,7 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MB(MKS_SBASE) && (HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209))
|
#if MB(MKS_SBASE) && HAS_TMC220x
|
||||||
// The shortage of pins becomes apparent.
|
// The shortage of pins becomes apparent.
|
||||||
// Worst case you may have to give up the LCD
|
// Worst case you may have to give up the LCD
|
||||||
// RX pins need to be interrupt capable
|
// RX pins need to be interrupt capable
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
//#define BTN_EN1 P1_23 // EXP2.5
|
//#define BTN_EN1 P1_23 // EXP2.5
|
||||||
//#define BTN_EN2 P1_22 // EXP2.3
|
//#define BTN_EN2 P1_22 // EXP2.3
|
||||||
|
|
||||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_TMC220x
|
||||||
// The shortage of pins becomes apparent.
|
// The shortage of pins becomes apparent.
|
||||||
// In the worst case you may have to give up the LCD.
|
// In the worst case you may have to give up the LCD.
|
||||||
// RX pins must be interrupt-capable.
|
// RX pins must be interrupt-capable.
|
||||||
|
|
|
@ -108,7 +108,7 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_TMC220x
|
||||||
/**
|
/**
|
||||||
* TMC2208 stepper drivers
|
* TMC2208 stepper drivers
|
||||||
*
|
*
|
||||||
|
|
|
@ -296,7 +296,7 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_TMC220x
|
||||||
/**
|
/**
|
||||||
* TMC2208/TMC2209 stepper drivers
|
* TMC2208/TMC2209 stepper drivers
|
||||||
*
|
*
|
||||||
|
|
|
@ -205,7 +205,7 @@
|
||||||
|
|
||||||
#endif // HAS_SPI_LCD
|
#endif // HAS_SPI_LCD
|
||||||
|
|
||||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_TMC220x
|
||||||
/**
|
/**
|
||||||
* TMC2208/TMC2209 stepper drivers
|
* TMC2208/TMC2209 stepper drivers
|
||||||
*
|
*
|
||||||
|
|
|
@ -269,7 +269,7 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_TMC220x
|
||||||
/**
|
/**
|
||||||
* TMC2208/TMC2209 stepper drivers
|
* TMC2208/TMC2209 stepper drivers
|
||||||
*
|
*
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
|
#if HAS_TMC220x
|
||||||
/**
|
/**
|
||||||
* TMC2208/TMC2209 stepper drivers
|
* TMC2208/TMC2209 stepper drivers
|
||||||
*
|
*
|
||||||
|
|
Reference in a new issue