From 943415dd2d46c785633c76ba3eedc9dfa125a81c Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Mon, 30 Dec 2024 11:45:04 +0100 Subject: [PATCH] `TIM4` runs at 96MHz, not 48MHz --- src/timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/timer.c b/src/timer.c index 0bec1bd..971b392 100644 --- a/src/timer.c +++ b/src/timer.c @@ -10,8 +10,8 @@ void tim4_init(void) { TIM4->CR2 = 0x0000; // Set prescaler - // f_clk = 48MHz -> /48000 = 1KHz counting frequency = 1ms - TIM4->PSC = (uint16_t) 48000 - 1; + // f_clk = 96MHz -> 96E6/96E3 = 1E3 = 1KHz counting frequency = 1ms + TIM4->PSC = (uint16_t) 96000 - 1; // Set ARR to maximum value to get 1ms between updates TIM4->ARR = (uint16_t) 0xFFFF;