From 33a15a65134aef7b1c2a60c76251b206649fd514 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 14 Dec 2020 18:11:35 +0800 Subject: [PATCH] satman: backport JESD204 STPL fix from 73271600 --- artiq/firmware/satman/jdcg.rs | 19 +++++++++++++++---- artiq/firmware/satman/main.rs | 3 +++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/artiq/firmware/satman/jdcg.rs b/artiq/firmware/satman/jdcg.rs index 0893b7546..afa665ada 100644 --- a/artiq/firmware/satman/jdcg.rs +++ b/artiq/firmware/satman/jdcg.rs @@ -104,10 +104,6 @@ pub mod jdac { basic_request(dacno, jdac_requests::PRBS, 0)?; jesd::prbs(dacno, false); - jesd::stpl(dacno, true); - basic_request(dacno, jdac_requests::STPL, 0)?; - jesd::stpl(dacno, false); - basic_request(dacno, jdac_requests::INIT, 0)?; clock::spin_us(5000); @@ -129,4 +125,19 @@ pub mod jdac { } } } + + pub fn stpl() -> Result<(), &'static str> { + for dacno in 0..csr::JDCG.len() { + let dacno = dacno as u8; + + info!("Running STPL test on DAC-{}...", dacno); + + jesd::stpl(dacno, true); + basic_request(dacno, jdac_requests::STPL, 0)?; + jesd::stpl(dacno, false); + + info!(" ...done STPL test"); + } + Ok(()) + } } diff --git a/artiq/firmware/satman/main.rs b/artiq/firmware/satman/main.rs index 40ab0f4a1..80278b32f 100644 --- a/artiq/firmware/satman/main.rs +++ b/artiq/firmware/satman/main.rs @@ -526,6 +526,9 @@ pub extern fn main() -> i32 { let rep0_is_up = repeaters[0].is_up(); if rep0_is_up && !rep0_was_up { jdcg::jdac::init(); + if let Err(e) = jdcg::jdac::stpl() { + error!("STPL test failed: {}", e); + } } rep0_was_up = rep0_is_up; }