Skip to content

Commit beae8c4

Browse files
committed
Fix TIM1 PWM frequency calculation
TIM1 uses PCLK2, but the calculation was based on PCLK1.
1 parent f511312 commit beae8c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/pwm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ macro_rules! advanced_timer {
187187
tim.ccmr2_output().modify(|_, w| unsafe { w.oc4pe().set_bit().oc4m().bits(6) });
188188
}
189189

190-
let clk = clocks.pclk1().0;
190+
let clk = clocks.pclk2().0;
191191
let freq = freq.0;
192192
let ticks = clk / freq;
193193

0 commit comments

Comments
 (0)