From 0d4eccc1a5f5a48d27c00c4011ea92e181eceb59 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 9 Dec 2019 17:23:09 +0800 Subject: [PATCH] wrpll: improve debug output --- artiq/firmware/libboard_artiq/wrpll.rs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/artiq/firmware/libboard_artiq/wrpll.rs b/artiq/firmware/libboard_artiq/wrpll.rs index 22072f403..1a528afeb 100644 --- a/artiq/firmware/libboard_artiq/wrpll.rs +++ b/artiq/firmware/libboard_artiq/wrpll.rs @@ -272,6 +272,14 @@ fn get_helper_frequency() -> u32 { unsafe { csr::wrpll::helper_frequency_counter_read() } } +fn get_ddmtd_main_tag() -> u16 { + unsafe { + csr::wrpll::ddmtd_main_arm_write(1); + while csr::wrpll::ddmtd_main_arm_read() != 0 {} + csr::wrpll::ddmtd_main_tag_read() + } +} + pub fn init() { info!("initializing..."); @@ -286,23 +294,19 @@ pub fn init() { .expect("cannot initialize main Si549"); si549::program(i2c::Dcxo::Helper, h_hsdiv, h_lsdiv, h_fbdiv) .expect("cannot initialize helper Si549"); - // Si549 Settling Time for Large Frequency Change. // Datasheet said 10ms but it lied. clock::spin_us(50_000); + unsafe { csr::wrpll::helper_reset_write(0); } clock::spin_us(1); info!("helper clock frequency: {}MHz", get_helper_frequency()/10000); - - info!("DDMTD test:"); - for _ in 0..20 { - unsafe { - csr::wrpll::ddmtd_main_arm_write(1); - while csr::wrpll::ddmtd_main_arm_read() != 0 {} - info!("{}", csr::wrpll::ddmtd_main_tag_read()); - } + let mut tags = [0; 10]; + for i in 0..tags.len() { + tags[i] = get_ddmtd_main_tag(); } + info!("DDMTD main tags: {:?}", tags); } pub fn select_recovered_clock(rc: bool) {