TIM4 runs at 96MHz, not 48MHz

This commit is contained in:
Alexander Heldt committed 2025-01-01 12:42:46 +01:00
1 parent 8f3285072b
commit a1c43ad21c
5 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -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;