diff --git a/src/bin/lockin-external.rs b/src/bin/lockin-external.rs index 1d3f11d..0933f17 100644 --- a/src/bin/lockin-external.rs +++ b/src/bin/lockin-external.rs @@ -117,14 +117,14 @@ const APP: () = { let iir_state = c.resources.iir_state; let lockin = c.resources.lockin; - let t = c + let timestamp = c .resources .timestamper .latest_timestamp() .unwrap_or_else(|t| t) // Ignore timer capture overflows. .map(|t| t as i32); let (pll_phase, pll_frequency) = c.resources.pll.update( - t, + timestamp, 22, // frequency settling time (log2 counter cycles), TODO: expose 22, // phase settling time, TODO: expose ); diff --git a/src/hardware/configuration.rs b/src/hardware/configuration.rs index aa0b918..cbe4a1d 100644 --- a/src/hardware/configuration.rs +++ b/src/hardware/configuration.rs @@ -211,12 +211,11 @@ pub fn setup( // Configure the timer to count at the designed tick rate. We will manually set the // period below. timer5.pause(); - timer5.reset_counter(); timer5.set_tick_freq(design_parameters::TIMER_FREQUENCY); - // The timestamp timer must run at exactly a multiple of the sample timer based on the - // batch size. To accomodate this, we manually set the prescaler identical to the sample - // timer, but use a period that is longer. + // The timestamp timer runs at the counter cycle period as the sampling timers. + // To accomodate this, we manually set the prescaler identical to the sample + // timer, but use maximum overflow period. let mut timer = timers::TimestampTimer::new(timer5); timer.set_period_ticks(u32::MAX);