Skip to content

Commit 731b94d

Browse files
committed
Fix mono_timer not counting up without debugger connected
1 parent 1b32169 commit 731b94d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/time.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
//! ```
2929
3030
use core::ops;
31-
use cortex_m::peripheral::DWT;
31+
use cortex_m::peripheral::{DWT, DCB};
3232

3333
use crate::rcc::Clocks;
3434

@@ -234,7 +234,8 @@ pub struct MonoTimer {
234234

235235
impl MonoTimer {
236236
/// Creates a new `Monotonic` timer
237-
pub fn new(mut dwt: DWT, clocks: Clocks) -> Self {
237+
pub fn new(mut dwt: DWT, mut dcb: DCB, clocks: Clocks) -> Self {
238+
dcb.enable_trace();
238239
dwt.enable_cycle_counter();
239240

240241
// now the CYCCNT counter can't be stopped or reset

0 commit comments

Comments
 (0)