From a7477673de5ee67b09d04a8c81129ebd5345ebb7 Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Tue, 18 Jul 2017 13:54:01 +0200 Subject: [PATCH] HW SG homing, SWSPI pins for EINY03/04 --- Firmware/Configuration.h | 4 +- Firmware/pins.h | 164 ++++++++++-------- Firmware/swspi.cpp | 3 +- Firmware/swspi.h | 17 -- Firmware/tmc2130.cpp | 99 +++++------ Firmware/tmc2130.h | 2 - .../variants/1_75mm_MK3-EINY03-E3Dv6full.h | 29 ++-- .../variants/1_75mm_MK3-EINY04-E3Dv6full.h | 44 ++--- 8 files changed, 175 insertions(+), 187 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 22f109f8..61f38be8 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -258,8 +258,8 @@ your extruder heater takes 2 minutes to hit the target on heating. // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins. -const bool X_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. -const bool Y_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. +const bool X_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. +const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop. //#define DISABLE_MAX_ENDSTOPS //#define DISABLE_MIN_ENDSTOPS diff --git a/Firmware/pins.h b/Firmware/pins.h index d5b2c36a..c8868ccc 100644 --- a/Firmware/pins.h +++ b/Firmware/pins.h @@ -329,36 +329,45 @@ #define HAVE_TMC2130_DRIVERS #define HAVE_PAT9125_SENSOR +#define SWSPI_MISO 16 //RX2 +#define SWSPI_MOSI 16 //RX2 +#define SWSPI_SCK 17 //TX2 +#define SWSPI_CS 20 //SDA + +#define X_TMC2130_CS 41 +#define X_TMC2130_DIAG 40 #define X_STEP_PIN 37 #define X_DIR_PIN 49 -#define X_MIN_PIN 12 -#define X_MAX_PIN 30 -//#define X_MIN_PIN 64 //TMC2130 SG homing -//#define X_MAX_PIN 64 //TMC2130 SG homing +//#define X_MIN_PIN 12 +//#define X_MAX_PIN 30 +#define X_MIN_PIN X_TMC2130_DIAG +#define X_MAX_PIN X_TMC2130_DIAG #define X_ENABLE_PIN 29 -#define X_MS1_PIN -1 -#define X_MS2_PIN -1 -#define X_TMC2130_CS 41 +#define X_MS1_PIN -1 +#define X_MS2_PIN -1 +#define Y_TMC2130_CS 39 +#define Y_TMC2130_DIAG 69 #define Y_STEP_PIN 36 #define Y_DIR_PIN 48 -#define Y_MIN_PIN 11 -#define Y_MAX_PIN 24 -//#define Y_MIN_PIN 69 //TMC2130 SG homing -//#define Y_MAX_PIN 69 //TMC2130 SG homing +//#define Y_MIN_PIN 11 +//#define Y_MAX_PIN 24 +#define Y_MIN_PIN Y_TMC2130_DIAG +#define Y_MAX_PIN Y_TMC2130_DIAG #define Y_ENABLE_PIN 28 -#define Y_MS1_PIN -1 -#define Y_MS2_PIN -1 -#define Y_TMC2130_CS 39 +#define Y_MS1_PIN -1 +#define Y_MS2_PIN -1 +#define Z_TMC2130_CS 67 +#define Z_TMC2130_DIAG 68 #define Z_STEP_PIN 35 #define Z_DIR_PIN 47 #define Z_MIN_PIN 10 #define Z_MAX_PIN 23 +//#define Z_MAX_PIN Z_TMC2130_DIAG #define Z_ENABLE_PIN 27 -#define Z_MS1_PIN -1 -#define Z_MS2_PIN -1 -#define Z_TMC2130_CS 67 +#define Z_MS1_PIN -1 +#define Z_MS2_PIN -1 #define HEATER_BED_PIN 4 #define TEMP_BED_PIN 2 @@ -370,19 +379,20 @@ #define TEMP_1_PIN 1 #ifdef BARICUDA -#define HEATER_2_PIN 6 +#define HEATER_2_PIN 6 #else -#define HEATER_2_PIN -1 +#define HEATER_2_PIN -1 #endif #define TEMP_2_PIN -1 +#define E0_TMC2130_CS 66 +#define E0_TMC2130_DIAG 65 #define E0_STEP_PIN 34 #define E0_DIR_PIN 43 #define E0_ENABLE_PIN 26 -#define E0_MS1_PIN -1 -#define E0_MS2_PIN -1 -#define E0_TMC2130_CS 66 +#define E0_MS1_PIN -1 +#define E0_MS2_PIN -1 #define MOTOR_CURRENT_PWM_XY_PIN 46 #define MOTOR_CURRENT_PWM_Z_PIN 45 @@ -391,34 +401,34 @@ #define SDSS 53 #define LED_PIN 13 #define FAN_PIN 6 -#define FAN_1_PIN -1 +#define FAN_1_PIN -1 #define PS_ON_PIN -1 #define KILL_PIN -1 // 80 with Smart Controller LCD #define SUICIDE_PIN -1 // PIN that has to be turned on right after start, to keep power flowing. #ifdef ULTRA_LCD -#define KILL_PIN 32 +#define KILL_PIN 32 #ifdef NEWPANEL -#define BEEPER 84 // Beeper on AUX-4 -#define LCD_PINS_RS 82 -#define LCD_PINS_ENABLE 18 -#define LCD_PINS_D4 19 -#define LCD_PINS_D5 70 -#define LCD_PINS_D6 85 -#define LCD_PINS_D7 71 +#define BEEPER 84 // Beeper on AUX-4 +#define LCD_PINS_RS 82 +#define LCD_PINS_ENABLE 18 +#define LCD_PINS_D4 19 +#define LCD_PINS_D5 70 +#define LCD_PINS_D6 85 +#define LCD_PINS_D7 71 //buttons are directly attached using AUX-2 -#define BTN_EN1 72 -#define BTN_EN2 14 -#define BTN_ENC 9 // the click +#define BTN_EN1 72 +#define BTN_EN2 14 +#define BTN_ENC 9 // the click -#define SDCARDDETECT 15 +#define SDCARDDETECT 15 -#define TACH_0 81 -#define TACH_1 80 +#define TACH_0 81 +#define TACH_1 80 #endif //NEWPANEL #endif //ULTRA_LCD @@ -440,36 +450,44 @@ #define HAVE_TMC2130_DRIVERS #define HAVE_PAT9125_SENSOR +#define SWSPI_MISO 21 //SCL +#define SWSPI_MOSI 21 //SCL +#define SWSPI_SCK 62 //PK0 +#define SWSPI_CS 20 //SDA + +#define X_TMC2130_CS 41 +#define X_TMC2130_DIAG 64 // !!! changed from 40 (EINY03) #define X_STEP_PIN 37 #define X_DIR_PIN 49 -#define X_MIN_PIN 12 -#define X_MAX_PIN 30 -//#define X_MIN_PIN 64 //TMC2130 SG homing -//#define X_MAX_PIN 64 //TMC2130 SG homing +//#define X_MIN_PIN 12 +//#define X_MAX_PIN 30 +#define X_MIN_PIN X_TMC2130_DIAG +#define X_MAX_PIN X_TMC2130_DIAG #define X_ENABLE_PIN 29 #define X_MS1_PIN -1 #define X_MS2_PIN -1 -#define X_TMC2130_CS 41 +#define Y_TMC2130_CS 39 +#define Y_TMC2130_DIAG 69 #define Y_STEP_PIN 36 #define Y_DIR_PIN 48 -#define Y_MIN_PIN 11 -#define Y_MAX_PIN 24 -//#define Y_MIN_PIN 69 //TMC2130 SG homing -//#define Y_MAX_PIN 69 //TMC2130 SG homing +//#define Y_MIN_PIN 11 +//#define Y_MAX_PIN 24 +#define Y_MIN_PIN Y_TMC2130_DIAG +#define Y_MAX_PIN Y_TMC2130_DIAG #define Y_ENABLE_PIN 28 -#define Y_MS1_PIN -1 -#define Y_MS2_PIN -1 -#define Y_TMC2130_CS 39 +#define Y_MS1_PIN -1 +#define Y_MS2_PIN -1 +#define Z_TMC2130_CS 67 #define Z_STEP_PIN 35 #define Z_DIR_PIN 47 #define Z_MIN_PIN 10 #define Z_MAX_PIN 23 +//#define Z_MAX_PIN Z_TMC2130_DIAG #define Z_ENABLE_PIN 27 -#define Z_MS1_PIN -1 -#define Z_MS2_PIN -1 -#define Z_TMC2130_CS 67 +#define Z_MS1_PIN -1 +#define Z_MS2_PIN -1 #define HEATER_BED_PIN 4 #define TEMP_BED_PIN 2 @@ -481,19 +499,19 @@ #define TEMP_1_PIN 1 #ifdef BARICUDA -#define HEATER_2_PIN 6 +#define HEATER_2_PIN 6 #else -#define HEATER_2_PIN -1 +#define HEATER_2_PIN -1 #endif #define TEMP_2_PIN -1 +#define E0_TMC2130_CS 66 #define E0_STEP_PIN 34 #define E0_DIR_PIN 43 #define E0_ENABLE_PIN 26 -#define E0_MS1_PIN -1 -#define E0_MS2_PIN -1 -#define E0_TMC2130_CS 66 +#define E0_MS1_PIN -1 +#define E0_MS2_PIN -1 #define MOTOR_CURRENT_PWM_XY_PIN 46 #define MOTOR_CURRENT_PWM_Z_PIN 45 @@ -502,7 +520,7 @@ #define SDSS 77 #define LED_PIN 13 #define FAN_PIN 6 -#define FAN_1_PIN -1 +#define FAN_1_PIN -1 #define PS_ON_PIN -1 #define KILL_PIN -1 // 80 with Smart Controller LCD #define SUICIDE_PIN -1 // PIN that has to be turned on right after start, to keep power flowing. @@ -514,25 +532,25 @@ #ifdef NEWPANEL -#define BEEPER 84 // Beeper on AUX-4 -#define LCD_PINS_RS 82 -//#define LCD_PINS_ENABLE 18 -//#define LCD_PINS_D4 19 -#define LCD_PINS_ENABLE 61 -#define LCD_PINS_D4 59 -#define LCD_PINS_D5 70 -#define LCD_PINS_D6 85 -#define LCD_PINS_D7 71 +#define BEEPER 84 // Beeper on AUX-4 +#define LCD_PINS_RS 82 +//#define LCD_PINS_ENABLE 18 +//#define LCD_PINS_D4 19 +#define LCD_PINS_ENABLE 61 +#define LCD_PINS_D4 59 +#define LCD_PINS_D5 70 +#define LCD_PINS_D6 85 +#define LCD_PINS_D7 71 //buttons are directly attached using AUX-2 -#define BTN_EN1 72 -#define BTN_EN2 14 -#define BTN_ENC 9 // the click +#define BTN_EN1 72 +#define BTN_EN2 14 +#define BTN_ENC 9 // the click -#define SDCARDDETECT 15 +#define SDCARDDETECT 15 -#define TACH_0 79 -#define TACH_1 80 +#define TACH_0 79 +#define TACH_1 80 #endif //NEWPANEL #endif //ULTRA_LCD diff --git a/Firmware/swspi.cpp b/Firmware/swspi.cpp index ca681e90..87678be1 100755 --- a/Firmware/swspi.cpp +++ b/Firmware/swspi.cpp @@ -12,7 +12,8 @@ #endif //SWSPI_RPI #ifdef SWSPI_AVR - #include "Arduino.h" + //#include "Arduino.h" + #include "Marlin.h" #define GPIO_INP(gpio) pinMode(gpio, INPUT) #define GPIO_OUT(gpio) pinMode(gpio, OUTPUT) #define GPIO_SET(gpio) digitalWrite(gpio, HIGH) diff --git a/Firmware/swspi.h b/Firmware/swspi.h index c7423237..ba75d2bb 100755 --- a/Firmware/swspi.h +++ b/Firmware/swspi.h @@ -13,23 +13,6 @@ #endif //SWSPI_RPI #ifdef SWSPI_AVR -//#if MOTHERBOARD == BOARD_EINY_0_3a -#define SWSPI_MISO 16 //RX2 -#define SWSPI_MOSI 16 //RX2 -#define SWSPI_SCK 17 //TX2 -#define SWSPI_CS 20 //SDA -//#endif //(MOTHERBOARD == 299) -/*#if MOTHERBOARD == BOARD_EINY_0_4a -#define SWSPI_MISO 62 //PK0 -#define SWSPI_MOSI 62 //PK0 -#define SWSPI_SCK 21 //SCL -#endif //(MOTHERBOARD == BOARD_EINY_0_3a) -#if (MOTHERBOARD == BOARD_EINY_0_4a) -#define SWSPI_MISO 21 //PK0 -#define SWSPI_MOSI 21 //PK0 -#define SWSPI_SCK 62 //SCL -#define SWSPI_CS 20 //SDA -#endif //(MOTHERBOARD == BOARD_EINY_0_4a)*/ #endif //SWSPI_AVR #define SWSPI_POL 1 //polarity diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp index 33a3e858..a2c93adb 100644 --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -5,6 +5,10 @@ #include "tmc2130.h" #include +#define TMC2130_GCONF_NORMAL 0x00000000 // spreadCycle +#define TMC2130_GCONF_SGSENS 0x00003180 // spreadCycle with stallguard (stall activates DIAG0 and DIAG1 [pushpull]) +#define TMC2130_GCONF_SILENT 0x00000004 // stealthChop + //externals for debuging extern float current_position[4]; extern void st_get_position_xy(long &x, long &y); @@ -12,6 +16,8 @@ extern long st_get_position(uint8_t axis); //chipselect pins uint8_t tmc2130_cs[4] = { X_TMC2130_CS, Y_TMC2130_CS, Z_TMC2130_CS, E0_TMC2130_CS }; +//diag pins +uint8_t tmc2130_diag[4] = { X_TMC2130_DIAG, Y_TMC2130_DIAG, Z_TMC2130_DIAG, E0_TMC2130_DIAG }; //mode uint8_t tmc2130_mode = TMC2130_MODE_NORMAL; //holding currents @@ -20,8 +26,6 @@ uint8_t tmc2130_current_h[4] = TMC2130_CURRENTS_H; uint8_t tmc2130_current_r[4] = TMC2130_CURRENTS_R; //axis stalled flags uint8_t tmc2130_axis_stalled[2] = {0, 0}; -//last homing stalled -uint8_t tmc2130_LastHomingStalled = 0; //pwm_ampl uint8_t tmc2130_pwm_ampl[2] = {TMC2130_PWM_AMPL_XY, TMC2130_PWM_AMPL_XY}; @@ -105,6 +109,10 @@ void tmc2130_init() SET_OUTPUT(Y_TMC2130_CS); SET_OUTPUT(Z_TMC2130_CS); SET_OUTPUT(E0_TMC2130_CS); + SET_INPUT(X_TMC2130_DIAG); + SET_INPUT(Y_TMC2130_DIAG); + SET_INPUT(Z_TMC2130_DIAG); + SET_INPUT(E0_TMC2130_DIAG); SPI.begin(); for (int i = 0; i < 2; i++) // X Y axes { @@ -112,7 +120,7 @@ void tmc2130_init() tmc2130_wr_CHOPCONF(tmc2130_cs[i], 3, 5, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, mres, TMC2130_INTPOL_XY, 0, 0); tmc2130_wr(tmc2130_cs[i], TMC2130_REG_IHOLD_IRUN, 0x000f0000 | ((tmc2130_current_r[i] & 0x1f) << 8) | (tmc2130_current_h[i] & 0x1f)); tmc2130_wr(tmc2130_cs[i], TMC2130_REG_TPOWERDOWN, 0x00000000); - tmc2130_wr(tmc2130_cs[i], TMC2130_REG_GCONF, (tmc2130_mode == TMC2130_MODE_SILENT)?0x00000004:0x00000000); + tmc2130_wr(tmc2130_cs[i], TMC2130_REG_GCONF, (tmc2130_mode == TMC2130_MODE_SILENT)?TMC2130_GCONF_SILENT:TMC2130_GCONF_SGSENS); tmc2130_wr_PWMCONF(tmc2130_cs[i], tmc2130_pwm_ampl[i], tmc2130_pwm_grad[i], tmc2130_pwm_freq[i], tmc2130_pwm_auto[i], 0, 0); tmc2130_wr_TPWMTHRS(tmc2130_cs[i], TMC2130_TPWMTHRS); //tmc2130_wr_THIGH(tmc2130_cs[i], TMC2130_THIGH); @@ -172,64 +180,21 @@ bool tmc2130_update_sg() uint16_t sg = tmc2130_rd_DRV_STATUS(cs) & 0x3ff; if (sg == 0) { - tmc2130_axis_stalled[axis] = true; - tmc2130_LastHomingStalled = true; #ifdef TMC2130_DEBUG MYSERIAL.print("tmc2130_update_sg AXIS STALLED "); MYSERIAL.println((int)axis); #endif //TMC2130_DEBUG } -// else -// tmc2130_axis_stalled[axis] = false; } } -// else -// tmc2130_axis_stalled[axis] = false; } } } return true; -// else -// { -// tmc2130_axis_stalled[X_AXIS] = false; -// tmc2130_axis_stalled[Y_AXIS] = false; -// } #endif } -void tmc2130_check_overtemp() -{ - const static char TMC_OVERTEMP_MSG[] PROGMEM = "TMC DRIVER OVERTEMP "; - uint8_t cs[4] = { X_TMC2130_CS, Y_TMC2130_CS, Z_TMC2130_CS, E0_TMC2130_CS }; - static uint32_t checktime = 0; - //drivers_disabled[0] = 1; //TEST - if( millis() - checktime > 1000 ) - { - //SERIAL_ECHOLNPGM("drv_status:"); - for(int i=0;i<4;i++) - { - uint32_t drv_status = 0; - - skip_debug_msg = true; - - tmc2130_rd(cs[i], TMC2130_REG_DRV_STATUS, &drv_status); - //MYSERIAL.print(drv_status); - //SERIAL_ECHOPGM(" "); - if (drv_status & ((uint32_t)1<<26)) - { // BIT 26 - over temp prewarning ~120C (+-20C) - SERIAL_ERRORRPGM(TMC_OVERTEMP_MSG); - SERIAL_ECHOLN(i); - for(int i=0; i < 4; i++) - tmc2130_wr(tmc2130_cs[i], TMC2130_REG_CHOPCONF, 0x00010000); - kill(TMC_OVERTEMP_MSG); - } - } - //SERIAL_ECHOLNPGM(""); - checktime = millis(); - } -} - void tmc2130_home_enter(uint8_t axes_mask) { #ifdef TMC2130_DEBUG @@ -247,11 +212,11 @@ void tmc2130_home_enter(uint8_t axes_mask) tmc2131_axis_sg_pos[axis] = st_get_position(axis); tmc2130_axis_stalled[axis] = false; //Configuration to spreadCycle - tmc2130_wr(cs, TMC2130_REG_GCONF, 0x00000000); + tmc2130_wr(cs, TMC2130_REG_GCONF, TMC2130_GCONF_NORMAL); tmc2130_wr(cs, TMC2130_REG_COOLCONF, ((axis == X_AXIS)?sg_thrs_x:sg_thrs_y) << 16); tmc2130_wr(cs, TMC2130_REG_TCOOLTHRS, TMC2130_TCOOLTHRS); #ifndef TMC2130_SG_HOMING_SW - tmc2130_wr(cs, TMC2130_REG_GCONF, 0x00000080); //stallguard output to DIAG0 + tmc2130_wr(cs, TMC2130_REG_GCONF, TMC2130_GCONF_SGSENS); //stallguard output DIAG1, DIAG1 = pushpull #endif //TMC2130_SG_HOMING_SW } } @@ -273,9 +238,13 @@ void tmc2130_home_exit() if (sg_homing_axes_mask & mask) { if (tmc2130_mode == TMC2130_MODE_SILENT) - tmc2130_wr(tmc2130_cs[axis], TMC2130_REG_GCONF, 0x00000004); // Configuration back to stealthChop + tmc2130_wr(tmc2130_cs[axis], TMC2130_REG_GCONF, TMC2130_GCONF_SILENT); // Configuration back to stealthChop else - tmc2130_wr(tmc2130_cs[axis], TMC2130_REG_GCONF, 0x00000000); +#ifdef TMC2130_SG_HOMING_SW + tmc2130_wr(tmc2130_cs[axis], TMC2130_REG_GCONF, TMC2130_GCONF_NORMAL); +#else //TMC2130_SG_HOMING_SW + tmc2130_wr(tmc2130_cs[axis], TMC2130_REG_GCONF, TMC2130_GCONF_SGSENS); +#endif //TMC2130_SG_HOMING_SW } tmc2130_axis_stalled[axis] = false; } @@ -290,11 +259,28 @@ void tmc2130_home_restart(uint8_t axis) tmc2130_axis_stalled[axis] = false; } -uint8_t tmc2130_didLastHomingStall() +void tmc2130_check_overtemp() { - uint8_t ret = tmc2130_LastHomingStalled; - tmc2130_LastHomingStalled = false; - return ret; + const static char TMC_OVERTEMP_MSG[] PROGMEM = "TMC DRIVER OVERTEMP "; + static uint32_t checktime = 0; + if (millis() - checktime > 1000 ) + { + for (int i = 0; i < 4; i++) + { + uint32_t drv_status = 0; + skip_debug_msg = true; + tmc2130_rd(tmc2130_cs[i], TMC2130_REG_DRV_STATUS, &drv_status); + if (drv_status & ((uint32_t)1 << 26)) + { // BIT 26 - over temp prewarning ~120C (+-20C) + SERIAL_ERRORRPGM(TMC_OVERTEMP_MSG); + SERIAL_ECHOLN(i); + for (int j = 0; j < 4; j++) + tmc2130_wr(tmc2130_cs[j], TMC2130_REG_CHOPCONF, 0x00010000); + kill(TMC_OVERTEMP_MSG); + } + } + checktime = millis(); + } } void tmc2130_set_current_h(uint8_t axis, uint8_t current) @@ -303,7 +289,6 @@ void tmc2130_set_current_h(uint8_t axis, uint8_t current) MYSERIAL.print((int)axis); MYSERIAL.print(" "); MYSERIAL.println((int)current); -// if (current > 15) current = 15; //current>15 is unsafe tmc2130_current_h[axis] = current; tmc2130_wr(tmc2130_cs[axis], TMC2130_REG_IHOLD_IRUN, 0x000f0000 | ((tmc2130_current_r[axis] & 0x1f) << 8) | (tmc2130_current_h[axis] & 0x1f)); } @@ -314,7 +299,6 @@ void tmc2130_set_current_r(uint8_t axis, uint8_t current) MYSERIAL.print((int)axis); MYSERIAL.print(" "); MYSERIAL.println((int)current); -// if (current > 15) current = 15; //current>15 is unsafe tmc2130_current_r[axis] = current; tmc2130_wr(tmc2130_cs[axis], TMC2130_REG_IHOLD_IRUN, 0x000f0000 | ((tmc2130_current_r[axis] & 0x1f) << 8) | (tmc2130_current_h[axis] & 0x1f)); } @@ -431,7 +415,7 @@ void tmc2130_wr_THIGH(uint8_t cs, uint32_t val32) tmc2130_wr(cs, TMC2130_REG_THIGH, val32); } - +#ifdef TMC2130_DEBUG uint8_t tmc2130_axis_by_cs(uint8_t cs) { switch (cs) @@ -443,6 +427,7 @@ uint8_t tmc2130_axis_by_cs(uint8_t cs) } return -1; } +#endif //TMC2130_DEBUG uint8_t tmc2130_mres(uint16_t microstep_resolution) { diff --git a/Firmware/tmc2130.h b/Firmware/tmc2130.h index 87e85d95..c2901613 100644 --- a/Firmware/tmc2130.h +++ b/Firmware/tmc2130.h @@ -29,8 +29,6 @@ extern void tmc2130_home_enter(uint8_t axes_mask); extern void tmc2130_home_exit(); //restart homing (called from homeaxis befor move) extern void tmc2130_home_restart(uint8_t axis); -// -extern uint8_t tmc2130_didLastHomingStall(); //set holding current for any axis (M911) extern void tmc2130_set_current_h(uint8_t axis, uint8_t current); diff --git a/Firmware/variants/1_75mm_MK3-EINY03-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINY03-E3Dv6full.h index ff434014..129ec848 100644 --- a/Firmware/variants/1_75mm_MK3-EINY03-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINY03-E3Dv6full.h @@ -67,11 +67,10 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o //#define DEFAULT_MAX_FEEDRATE {400, 400, 12, 120} // (mm/sec) #define DEFAULT_MAX_FEEDRATE {500, 500, 12, 120} // (mm/sec) -#define DEFAULT_MAX_ACCELERATION {2000, 2000, 250, 5000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot. - -#define DEFAULT_ACCELERATION 1500 // X, Y, Z and E max acceleration in mm/s^2 for printing moves -#define DEFAULT_RETRACT_ACCELERATION 1500 // X, Y, Z and E max acceleration in mm/s^2 for retracts +#define DEFAULT_MAX_ACCELERATION {1000, 1000, 200, 5000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot. +#define DEFAULT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for printing moves +#define DEFAULT_RETRACT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for retracts #define MANUAL_FEEDRATE {2700, 2700, 1000, 100} // set the speeds for manual moves (mm/min) //#define MAX_SILENT_FEEDRATE 2700 // @@ -83,8 +82,10 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define DEBUG_DISABLE_STARTMSGS //no startup messages #define DEBUG_DISABLE_MINTEMP //mintemp error ignored #define DEBUG_DISABLE_SWLIMITS //sw limits ignored +#define DEBUG_DISABLE_LCD_STATUS_LINE //sw limits ignored #define DEBUG_DISABLE_PREVENT_EXTRUDER //cold extrusion and long extrusion allowed -#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3) +#define DEBUG_DISABLE_PRUSA_STATISTICS //disable prusa_statistics() mesages +//#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3) //#define DEBUG_YSTEP_DUP_PIN 21 //duplicate y-step output to pin 21 (SCL on P3) //#define DEBUG_BLINK_ACTIVE #endif @@ -118,22 +119,22 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define TMC2130_PWM_FREQ_E 2 // PWMCONF */ -//#define TMC2130_PWM_DIV 683 // PWM frequency divider (1024, 683, 512, 410) -#define TMC2130_PWM_DIV 512 // PWM frequency divider (1024, 683, 512, 410) -#define TMC2130_PWM_CLK (2 * TMC2130_FCLK / TMC2130_PWM_DIV) // PWM frequency (23.4kHz, 35.1kHz, 46.9kHz, 58.5kHz for 12MHz fclk) +//#define TMC2130_PWM_DIV 683 // PWM frequency divider (1024, 683, 512, 410) +#define TMC2130_PWM_DIV 512 // PWM frequency divider (1024, 683, 512, 410) +#define TMC2130_PWM_CLK (2 * TMC2130_FCLK / TMC2130_PWM_DIV) // PWM frequency (23.4kHz, 35.1kHz, 46.9kHz, 58.5kHz for 12MHz fclk) -#define TMC2130_TPWMTHRS 0 // TPWMTHRS - Sets the switching speed threshold based on TSTEP from stealthChop to spreadCycle mode -#define TMC2130_THIGH 0 // THIGH - unused +#define TMC2130_TPWMTHRS 0 // TPWMTHRS - Sets the switching speed threshold based on TSTEP from stealthChop to spreadCycle mode +#define TMC2130_THIGH 0 // THIGH - unused #define TMC2130_TCOOLTHRS 239 // TCOOLTHRS - coolstep treshold #define TMC2130_SG_HOMING 1 // stallguard homing -#define TMC2130_SG_HOMING_SW 1 // stallguard "software" homing +//#define TMC2130_SG_HOMING_SW 1 // stallguard "software" homing #define TMC2130_SG_THRS_X 30 // stallguard sensitivity for X axis #define TMC2130_SG_THRS_Y 30 // stallguard sensitivity for Y axis -#define TMC2130_SG_DELTA 128 // stallguard delta [usteps] (minimum usteps before stallguard readed) +#define TMC2130_SG_DELTA 128 // stallguard delta [usteps] (minimum usteps before stallguard readed - SW homing) -//new settings is possible for vsense = 1, running current value > 31 set vsense to zero and shift both currents by 1 bit right +//new settings is possible for vsense = 1, running current value > 31 set vsense to zero and shift both currents by 1 bit right (Z axis only) #define TMC2130_CURRENTS_H {3, 3, 5, 8} // default holding currents for all axes #define TMC2130_CURRENTS_R {13, 13, 20, 20} // default running currents for all axes @@ -464,4 +465,6 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print #endif +#define UVLO_Z_AXIS_SHIFT 2 + #endif //__CONFIGURATION_PRUSA_H diff --git a/Firmware/variants/1_75mm_MK3-EINY04-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINY04-E3Dv6full.h index f16a2a2e..5ba54bdd 100644 --- a/Firmware/variants/1_75mm_MK3-EINY04-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINY04-E3Dv6full.h @@ -33,7 +33,7 @@ // Steps per unit {X,Y,Z,E} //#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,140} -#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,280*4} +#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,280} // Endstop inverting const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. @@ -42,14 +42,14 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o // Home position #define MANUAL_X_HOME_POS 0 -#define MANUAL_Y_HOME_POS -13 +#define MANUAL_Y_HOME_POS -2.2 #define MANUAL_Z_HOME_POS 0.2 // Travel limits after homing #define X_MAX_POS 255 #define X_MIN_POS 0 #define Y_MAX_POS 210 -#define Y_MIN_POS -13 +#define Y_MIN_POS -4 #define Z_MAX_POS 210 #define Z_MIN_POS 0.15 @@ -67,11 +67,10 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o //#define DEFAULT_MAX_FEEDRATE {400, 400, 12, 120} // (mm/sec) #define DEFAULT_MAX_FEEDRATE {500, 500, 12, 120} // (mm/sec) -#define DEFAULT_MAX_ACCELERATION {2000, 2000, 250, 5000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot. - -#define DEFAULT_ACCELERATION 1500 // X, Y, Z and E max acceleration in mm/s^2 for printing moves -#define DEFAULT_RETRACT_ACCELERATION 1500 // X, Y, Z and E max acceleration in mm/s^2 for retracts +#define DEFAULT_MAX_ACCELERATION {1000, 1000, 200, 5000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot. +#define DEFAULT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for printing moves +#define DEFAULT_RETRACT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for retracts #define MANUAL_FEEDRATE {2700, 2700, 1000, 100} // set the speeds for manual moves (mm/min) //#define MAX_SILENT_FEEDRATE 2700 // @@ -83,8 +82,10 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define DEBUG_DISABLE_STARTMSGS //no startup messages #define DEBUG_DISABLE_MINTEMP //mintemp error ignored #define DEBUG_DISABLE_SWLIMITS //sw limits ignored +#define DEBUG_DISABLE_LCD_STATUS_LINE //sw limits ignored #define DEBUG_DISABLE_PREVENT_EXTRUDER //cold extrusion and long extrusion allowed -#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3) +#define DEBUG_DISABLE_PRUSA_STATISTICS //disable prusa_statistics() mesages +//#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3) //#define DEBUG_YSTEP_DUP_PIN 21 //duplicate y-step output to pin 21 (SCL on P3) //#define DEBUG_BLINK_ACTIVE #endif @@ -97,7 +98,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define TMC2130_USTEPS_XY 16 // microstep resolution for XY axes #define TMC2130_USTEPS_Z 16 // microstep resolution for Z axis -#define TMC2130_USTEPS_E 64 // microstep resolution for E axis +#define TMC2130_USTEPS_E 16 // microstep resolution for E axis #define TMC2130_INTPOL_XY 1 // extrapolate 256 for XY axes #define TMC2130_INTPOL_Z 1 // extrapolate 256 for Z axis #define TMC2130_INTPOL_E 1 // extrapolate 256 for E axis @@ -118,28 +119,28 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define TMC2130_PWM_FREQ_E 2 // PWMCONF */ -//#define TMC2130_PWM_DIV 683 // PWM frequency divider (1024, 683, 512, 410) -#define TMC2130_PWM_DIV 512 // PWM frequency divider (1024, 683, 512, 410) -#define TMC2130_PWM_CLK (2 * TMC2130_FCLK / TMC2130_PWM_DIV) // PWM frequency (23.4kHz, 35.1kHz, 46.9kHz, 58.5kHz for 12MHz fclk) +//#define TMC2130_PWM_DIV 683 // PWM frequency divider (1024, 683, 512, 410) +#define TMC2130_PWM_DIV 512 // PWM frequency divider (1024, 683, 512, 410) +#define TMC2130_PWM_CLK (2 * TMC2130_FCLK / TMC2130_PWM_DIV) // PWM frequency (23.4kHz, 35.1kHz, 46.9kHz, 58.5kHz for 12MHz fclk) -#define TMC2130_TPWMTHRS 0 // TPWMTHRS - Sets the switching speed threshold based on TSTEP from stealthChop to spreadCycle mode -#define TMC2130_THIGH 0 // THIGH - unused +#define TMC2130_TPWMTHRS 0 // TPWMTHRS - Sets the switching speed threshold based on TSTEP from stealthChop to spreadCycle mode +#define TMC2130_THIGH 0 // THIGH - unused #define TMC2130_TCOOLTHRS 239 // TCOOLTHRS - coolstep treshold #define TMC2130_SG_HOMING 1 // stallguard homing #define TMC2130_SG_HOMING_SW 1 // stallguard "software" homing -#define TMC2130_SG_THRS_X 40 // stallguard sensitivity for X axis -#define TMC2130_SG_THRS_Y 40 // stallguard sensitivity for Y axis -#define TMC2130_SG_DELTA 128 // stallguard delta [usteps] (minimum usteps before stallguard readed) +#define TMC2130_SG_THRS_X 30 // stallguard sensitivity for X axis +#define TMC2130_SG_THRS_Y 30 // stallguard sensitivity for Y axis +#define TMC2130_SG_DELTA 128 // stallguard delta [usteps] (minimum usteps before stallguard readed - SW homing) -//new settings is possible for vsense = 1, running current value > 31 set vsense to zero and shift both currents by 1 bit right +//new settings is possible for vsense = 1, running current value > 31 set vsense to zero and shift both currents by 1 bit right (Z axis only) #define TMC2130_CURRENTS_H {3, 3, 5, 8} // default holding currents for all axes #define TMC2130_CURRENTS_R {13, 13, 20, 20} // default running currents for all axes //#define TMC2130_DEBUG //#define TMC2130_DEBUG_WR -#define TMC2130_DEBUG_RD +//#define TMC2130_DEBUG_RD /*------------------------------------ @@ -273,7 +274,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o // Mesh definitions #define MESH_MIN_X 35 #define MESH_MAX_X 238 -#define MESH_MIN_Y 8 +#define MESH_MIN_Y 6 #define MESH_MAX_Y 202 // Mesh upsample definition @@ -287,7 +288,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc. #define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right -#define Y_PROBE_OFFSET_FROM_EXTRUDER 8 // Z probe to nozzle Y offset: -front +behind +#define Y_PROBE_OFFSET_FROM_EXTRUDER 9 // Z probe to nozzle Y offset: -front +behind #define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4 // Z probe to nozzle Z offset: -below (always!) #endif @@ -464,7 +465,6 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print #endif - #define UVLO_Z_AXIS_SHIFT 2 #endif //__CONFIGURATION_PRUSA_H