From 069e178966c4bfe2f95e36454e3c5edb01556ab2 Mon Sep 17 00:00:00 2001 From: Egor Savkin Date: Thu, 2 Feb 2023 10:52:22 +0800 Subject: [PATCH] Change PWM freq to 25kHz Signed-off-by: Egor Savkin --- src/fan_ctrl.rs | 4 ++-- src/pins.rs | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/fan_ctrl.rs b/src/fan_ctrl.rs index 25e13cb..e0e03e6 100644 --- a/src/fan_ctrl.rs +++ b/src/fan_ctrl.rs @@ -18,8 +18,8 @@ const MAX_TEC_I: f64 = 3.0; const MAX_USER_FAN_PWM: f64 = 100.0; const MIN_USER_FAN_PWM: f64 = 1.0; const MAX_FAN_PWM: f64 = 1.0; -// below this value motor circuit assumes there is no signal and runs full speed -const MIN_FAN_PWM: f64 = 0.02; +// below this value motor's autostart feature may fail +const MIN_FAN_PWM: f64 = 0.04; const DEFAULT_K_A: f64 = 1.0; const DEFAULT_K_B: f64 = 0.0; diff --git a/src/pins.rs b/src/pins.rs index 87ff6b3..64b3821 100644 --- a/src/pins.rs +++ b/src/pins.rs @@ -226,11 +226,9 @@ impl Pins { hclk: clocks.hclk(), }; - // Though there is not enough evidence available for concrete fan model, - // it is generally advised to have higher PWM frequencies for brushless motors, - // so that it would produce less audible noise. - // Source: https://www.controleng.com/articles/understanding-the-effect-of-pwm-when-controlling-a-brushless-dc-motor/ - let fan = Timer::new(tim8, &clocks).pwm(gpioc.pc9.into_alternate(), 80u32.khz()); + // According to `SUNON DC Brushless Fan & Blower(255-E)` catalogue p.36-37 + // Model name: MF35101V1-1000U-G99 + let fan = Timer::new(tim8, &clocks).pwm(gpioc.pc9.into_alternate(), 25u32.khz()); (pins, leds, eeprom, eth_pins, usb, fan) }