From 39c9ef2940b60e599781d79027a895ae44842bf7 Mon Sep 17 00:00:00 2001 From: mwojcik Date: Tue, 14 Feb 2023 11:54:47 +0800 Subject: [PATCH] satman: wait for FCLK, check clk switch --- src/satman/src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/satman/src/main.rs b/src/satman/src/main.rs index c1f70ef..15b2530 100644 --- a/src/satman/src/main.rs +++ b/src/satman/src/main.rs @@ -441,6 +441,7 @@ pub extern fn main_core0() -> i32 { log::set_max_level(log::LevelFilter::Info); init_gateware(); + timer.delay_us(500); // wait for FCLK to reset and PLL to lock info!("ARTIQ satellite manager starting..."); info!("gateware ident {}", identifier_read(&mut [0; 64])); @@ -458,6 +459,13 @@ pub extern fn main_core0() -> i32 { csr::drtio_transceiver::stable_clkin_write(1); } timer.delay_us(20_000); // wait for CPLL/QPLL/MMCM lock + let clk = unsafe { csr::sys_crg::current_clock_read() }; + if clk == 1 { + info!("SYS CLK switched successfully"); + } + else { + error!("SYS CLK did not switch"); + } unsafe { csr::drtio_transceiver::txenable_write(0xffffffffu32 as _);