Quellcode durchsuchen

Silent / Hight Power mode switching - wait for standstill
parameter tunning:
PWM_GRAD, PWM_AMPL TCOOLTHRS (XY)

Robert Pelnar vor 7 Jahren
Ursprung
Commit
40fae26d75
4 geänderte Dateien mit 43 neuen und 6 gelöschten Zeilen
  1. 8 6
      Firmware/Configuration_prusa.h
  2. 30 0
      Firmware/tmc2130.cpp
  3. 1 0
      Firmware/tmc2130.h
  4. 4 0
      Firmware/ultralcd.cpp

+ 8 - 6
Firmware/Configuration_prusa.h

@@ -112,13 +112,13 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
 #define TMC2130_INTPOL_Z    1         // extrapolate 256 for Z axis
 #define TMC2130_INTPOL_E    1         // extrapolate 256 for E axis
 
-#define TMC2130_PWM_GRAD_X  4         // PWMCONF
-#define TMC2130_PWM_AMPL_X  210       // PWMCONF
+#define TMC2130_PWM_GRAD_X  8         // PWMCONF
+#define TMC2130_PWM_AMPL_X  220       // PWMCONF
 #define TMC2130_PWM_AUTO_X  1         // PWMCONF
 #define TMC2130_PWM_FREQ_X  2         // PWMCONF
 
-#define TMC2130_PWM_GRAD_Y  4         // PWMCONF
-#define TMC2130_PWM_AMPL_Y  215       // PWMCONF
+#define TMC2130_PWM_GRAD_Y  8         // PWMCONF
+#define TMC2130_PWM_AMPL_Y  225       // PWMCONF
 #define TMC2130_PWM_AUTO_Y  1         // PWMCONF
 #define TMC2130_PWM_FREQ_Y  2         // PWMCONF
 
@@ -140,8 +140,10 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
 #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_X 450       // TCOOLTHRS - coolstep treshold
-#define TMC2130_TCOOLTHRS_Y 450       // TCOOLTHRS - coolstep treshold
+//#define TMC2130_TCOOLTHRS_X 450       // TCOOLTHRS - coolstep treshold
+//#define TMC2130_TCOOLTHRS_Y 450       // TCOOLTHRS - coolstep treshold
+#define TMC2130_TCOOLTHRS_X 430       // TCOOLTHRS - coolstep treshold
+#define TMC2130_TCOOLTHRS_Y 430       // TCOOLTHRS - coolstep treshold
 #define TMC2130_TCOOLTHRS_Z 500       // TCOOLTHRS - coolstep treshold
 #define TMC2130_TCOOLTHRS_E 500       // TCOOLTHRS - coolstep treshold
 

+ 30 - 0
Firmware/tmc2130.cpp

@@ -429,17 +429,46 @@ void tmc2130_home_restart(uint8_t axis)
 	tmc2130_axis_stalled[axis] = false;
 }
 
+bool tmc2130_wait_standstill_xy(int timeout)
+{
+//	MYSERIAL.println("tmc2130_wait_standstill_xy");
+	bool standstill = false;
+	while (!standstill && (timeout > 0))
+	{
+		uint32_t drv_status_x = 0;
+		uint32_t drv_status_y = 0;
+		tmc2130_rd(tmc2130_cs[X_AXIS], TMC2130_REG_DRV_STATUS, &drv_status_x);
+		tmc2130_rd(tmc2130_cs[Y_AXIS], TMC2130_REG_DRV_STATUS, &drv_status_y);
+/*		MYSERIAL.print(timeout, 10);
+		MYSERIAL.println(' ');
+		MYSERIAL.print(drv_status_x, 16);
+		MYSERIAL.println(' ');
+		MYSERIAL.print(drv_status_y, 16);
+		MYSERIAL.println('#');*/
+		standstill = (drv_status_x & 0x80000000) && (drv_status_y & 0x80000000);
+		tmc2130_check_overtemp();
+		timeout--;
+	}
+	return standstill;
+}
+
+
 void tmc2130_check_overtemp()
 {
 	const static char TMC_OVERTEMP_MSG[] PROGMEM = "TMC DRIVER OVERTEMP ";
 	static uint32_t checktime = 0;
 	if (millis() - checktime > 1000 )
 	{
+//		MYSERIAL.print("DRV_STATUS ");
 		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);
+/*			MYSERIAL.print(i, DEC);
+			MYSERIAL.print(' ');
+			MYSERIAL.print(drv_status, 16);*/
+
 			if (drv_status & ((uint32_t)1 << 26))
 			{ // BIT 26 - over temp prewarning ~120C (+-20C)
 				SERIAL_ERRORRPGM(TMC_OVERTEMP_MSG);
@@ -450,6 +479,7 @@ void tmc2130_check_overtemp()
 			}
 
 		}
+//		MYSERIAL.println('#');
 		checktime = millis();
 		tmc2130_sg_change = true;
 	}

+ 1 - 0
Firmware/tmc2130.h

@@ -52,6 +52,7 @@ extern uint16_t tmc2130_rd_MSCNT(uint8_t cs);
 
 extern void tmc2130_home_pause(uint8_t axis);
 extern void tmc2130_home_resume(uint8_t axis);
+extern bool tmc2130_wait_standstill_xy(int timeout);
 
 
 #endif //TMC2130_H

+ 4 - 0
Firmware/ultralcd.cpp

@@ -2533,6 +2533,10 @@ static void lcd_silent_mode_set() {
   eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu);
 #ifdef TMC2130
   st_synchronize();
+  if (tmc2130_wait_standstill_xy(100))
+	  MYSERIAL.print("standstill OK");
+  else
+	  MYSERIAL.print("standstill NG!");
   cli();
 	tmc2130_mode = SilentModeMenu?TMC2130_MODE_SILENT:TMC2130_MODE_NORMAL;
 	tmc2130_init();