From ad89c42acc77333d18483105b0d6812076b1d75d Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 24 May 2018 10:18:08 +0200 Subject: [PATCH] firmware/serwb: automatically adjust prbs test delay to prbs test cycles, increase prbs test cycles --- artiq/firmware/libboard_artiq/serwb.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/artiq/firmware/libboard_artiq/serwb.rs b/artiq/firmware/libboard_artiq/serwb.rs index 46fd6e97f..919405805 100644 --- a/artiq/firmware/libboard_artiq/serwb.rs +++ b/artiq/firmware/libboard_artiq/serwb.rs @@ -43,16 +43,19 @@ pub fn wait_init() { info!("done."); unsafe { + let prbs_test_cycles : u32 = 1<<22; + let prbs_test_us : u64 = ((prbs_test_cycles as u64)*40)/125; // 40 bits @125MHz linerate + info!("RTM to AMC Link test"); - csr::serwb_phy_amc::control_prbs_cycles_write(1<<20); + csr::serwb_phy_amc::control_prbs_cycles_write(prbs_test_cycles); csr::serwb_phy_amc::control_prbs_start_write(1); - clock::spin_us(1000000); + clock::spin_us(prbs_test_us*110/100); // PRBS test time + 10% info!("{} errors", csr::serwb_phy_amc::control_prbs_errors_read()); info!("AMC to RTM Link test"); - csr::serwb_phy_rtm::control_prbs_cycles_write(1<<20); + csr::serwb_phy_rtm::control_prbs_cycles_write(prbs_test_cycles); csr::serwb_phy_rtm::control_prbs_start_write(1); - clock::spin_us(1000000); + clock::spin_us(prbs_test_us*110/100); // PRBS test time + 10% info!("{} errors", csr::serwb_phy_rtm::control_prbs_errors_read()); }