Skip to content

Commit

Permalink
sayma: add JESD204 PHY done diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
sbourdeauducq committed Jan 20, 2020
1 parent 2ad7d29 commit eb0ce93
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions artiq/firmware/satman/jdcg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ pub mod jesd {
unsafe {
(csr::JDCG[dacno as usize].jesd_control_enable_write)(if en {1} else {0})
}
clock::spin_us(5000);
}

pub fn phy_done(dacno: u8) -> bool {
unsafe {
(csr::JDCG[dacno as usize].jesd_control_phy_done_read)() != 0
}
}

pub fn ready(dacno: u8) -> bool {
Expand Down Expand Up @@ -80,7 +85,11 @@ pub mod jdac {

fn init_one(dacno: u8) -> Result<(), &'static str> {
jesd::enable(dacno, true);
clock::spin_us(10);
clock::spin_us(10_000);
if !jesd::phy_done(dacno) {
error!("JESD core PHY not done");
return Err("JESD core PHY not done");
}
if !jesd::ready(dacno) {
error!("JESD core reported not ready");
return Err("JESD core reported not ready");
Expand Down

0 comments on commit eb0ce93

Please sign in to comment.