From ec8560911fb19de164710dea3abd01217741a103 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 30 Jan 2019 16:56:38 +0800 Subject: [PATCH] siphaser: bugfixes * Fix integer overflow in degree computation * Add some phase slips after the first transition to get out of the jitter zone and avoid intermittent short windows --- artiq/firmware/libboard_artiq/si5324.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/artiq/firmware/libboard_artiq/si5324.rs b/artiq/firmware/libboard_artiq/si5324.rs index 06b72ef74..0e38fa6c0 100644 --- a/artiq/firmware/libboard_artiq/si5324.rs +++ b/artiq/firmware/libboard_artiq/si5324.rs @@ -304,7 +304,7 @@ pub mod siphaser { } } - fn find_edge(target: bool) -> Result { + fn find_edge(target: bool) -> Result { let mut nshifts = 0; let mut previous = has_error(); @@ -323,8 +323,13 @@ pub mod siphaser { } pub fn calibrate_skew() -> Result<()> { + let jitter_margin = 32; let lead = find_edge(false)?; - let width = find_edge(true)?; + for _ in 0..jitter_margin { + phase_shift(1); + } + let width = find_edge(true)? + jitter_margin; + // width is 360 degrees (one full rotation of the phase between s/h limits) minus jitter info!("calibration successful, lead: {}, width: {} ({}deg)", lead, width, width*360/(56*8)); // Apply reverse phase shift for half the width to get into the