From d7301b8d58cf7ca6ae48f1faf06db24f4fc5528b Mon Sep 17 00:00:00 2001 From: Alex Voinea Date: Thu, 13 Oct 2022 22:29:09 +0200 Subject: [PATCH] Adjust PWM_FREQ to allow lower current regulation With PWM_FREQ=2 (fPWM = 2/512 fclk), the idler parked current was quite high since the setting was not actually respected (scientifically tested using hand). In order to allow lower current regulation in stealthchop, TBL and PWM_FREQ need to be adjusted. The lower both of these values, the better. Since TBL affects both stealthchop and spreadcycle, I chose to only modify PWM_FREQ. This new PWM_FREQ results in half the previous stealthchop PWM frequency and also halves the low current limit (so if previously the minimum achievable current was 300mA, now it would be 150mA). I confirmed that this setting works correctly on a 24V supply. There is no audible noise from stealthChop PWM and the hold current is indeed reduced now (again, scientifically tested using my hand). --- src/config/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/config.h b/src/config/config.h index 2226376..d1a5123 100644 --- a/src/config/config.h +++ b/src/config/config.h @@ -234,7 +234,7 @@ static_assert(tmc2130_PWM_AMPL <= 255, "tmc2130_PWM_AMPL out of range"); static constexpr uint32_t tmc2130_PWM_GRAD = 4; static_assert(tmc2130_PWM_GRAD <= 255, "tmc2130_PWM_GRAD out of range"); -static constexpr uint32_t tmc2130_PWM_FREQ = 2; +static constexpr uint32_t tmc2130_PWM_FREQ = 0; static_assert(tmc2130_PWM_FREQ <= 3, "tmc2130_PWM_GRAD out of range"); static constexpr uint32_t tmc2130_PWM_AUTOSCALE = 1;