From bee1c67416c0f05eda06078bf160edb8b6ce092e Mon Sep 17 00:00:00 2001 From: Alex Voinea Date: Sat, 4 Mar 2023 10:25:49 +0100 Subject: tmc5160: allow changing the globalscaler at runtime Previously, the globalscaler was calculated during the config parsing and set to a fixed value. If the current was changed for any reason after the initialization, only IRUN and IHOLD would be changed. This however caused issues: - If the new current was lower, then the resolution of the possible current values would be low since there are only 32 IRUN/IHOLD steps. - If the new current was higher, it wouldn't actually work since IRUN and IHOLD are capped at 31, so it wouldn't be possible to increase the current without increasing globalscaler. With this commit, the globalscaler is recalculated whenever necessary in order to ensure the correct range of IRUN/IHOLD is used. Signed-off-by: Alex Voinea --- docs/G-Codes.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'docs/G-Codes.md') diff --git a/docs/G-Codes.md b/docs/G-Codes.md index 04efdbf2..7f5c6b08 100644 --- a/docs/G-Codes.md +++ b/docs/G-Codes.md @@ -1226,7 +1226,10 @@ turned off then back on. #### SET_TMC_CURRENT `SET_TMC_CURRENT STEPPER= CURRENT= HOLDCURRENT=`: This will adjust the run and hold currents of the TMC driver. -(HOLDCURRENT is not applicable to tmc2660 drivers.) +`HOLDCURRENT` is not applicable to tmc2660 drivers. +When used on a driver which has the `globalscaler` field (tmc5160 and tmc2240), +if StealthChop2 is used, the stepper must be held at standstill for >130ms so +that the driver executes the AT#1 calibration. #### SET_TMC_FIELD `SET_TMC_FIELD STEPPER= FIELD= VALUE=`: This will -- cgit v1.2.3-70-g09d2