Skip to content

Commit 4f160dc

Browse files
committed
timer: trigger update event to load the registers
otherwise another IRQ is happening around 1.2 ms (rtic app on F411) after start and then IRQs with correct timing are generated
1 parent 385cb97 commit 4f160dc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/timer.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,11 @@ macro_rules! hal {
263263
let arr = u16(ticks / u32(psc + 1)).unwrap();
264264
self.tim.arr.write(|w| unsafe { w.bits(u32(arr)) });
265265

266+
// Trigger update event to load the registers
267+
self.tim.cr1.modify(|_, w| w.urs().set_bit());
268+
self.tim.egr.write(|w| w.ug().set_bit());
269+
self.tim.cr1.modify(|_, w| w.urs().clear_bit());
270+
266271
// start counter
267272
self.tim.cr1.modify(|_, w| w.cen().set_bit());
268273
}

0 commit comments

Comments
 (0)