From 677bf2c9b5a3e4fba4b0b4e2f5d3c4d1492dd29b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Mon, 10 May 2021 19:23:43 +0200 Subject: [PATCH] Increase PWM Frequency to ~17 kHz to prevent annoying sound --- firmware/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firmware/main.c b/firmware/main.c index 1acd80d..5583453 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -69,8 +69,8 @@ int main(void) TIM14->ARR = 0x00FFu; TIM14->CNT = 0u; TIM14->CCR1 = 0u; - /*! -# Set prescaler to 16 ==> ca. 11 KHz */ - TIM14->PSC = 15u; + /*! -# Set prescaler to 11 ==> ca. 17 KHz */ + TIM14->PSC = 11u - 1u; /*! -# PWM Mode 1 + prefetch */ TIM14->CCMR1 = TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1PE; /*! -# Enable Output compare 1 */