From 831079f95fa54b88d1ea8d37bc6fc19cd62c3e26 Mon Sep 17 00:00:00 2001 From: mwojcik Date: Thu, 19 Jan 2023 14:22:22 +0800 Subject: [PATCH] rtio_clocking: PLL requires a bit more time to lock --- src/runtime/src/main.rs | 4 ++-- src/runtime/src/rtio_clocking.rs | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/runtime/src/main.rs b/src/runtime/src/main.rs index 956a81d..b83b2a4 100644 --- a/src/runtime/src/main.rs +++ b/src/runtime/src/main.rs @@ -111,6 +111,8 @@ pub fn main_core0() { ram::init_alloc_core0(); gic::InterruptController::gic(mpcore::RegisterBlock::mpcore()).enable_interrupts(); + info!("gateware ident: {}", identifier_read(&mut [0; 64])); + i2c::init(); #[cfg(feature = "target_kasli_soc")] @@ -141,9 +143,7 @@ pub fn main_core0() { }; rtio_clocking::init(&mut timer, &cfg); - init_gateware(); - info!("gateware ident: {}", identifier_read(&mut [0; 64])); task::spawn(report_async_rtio_errors()); diff --git a/src/runtime/src/rtio_clocking.rs b/src/runtime/src/rtio_clocking.rs index 732ee32..4e15347 100644 --- a/src/runtime/src/rtio_clocking.rs +++ b/src/runtime/src/rtio_clocking.rs @@ -72,12 +72,13 @@ fn init_rtio(timer: &mut GlobalTimer, _clk: RtioClock) { unsafe { pl::csr::sys_crg::clock_switch_write(1); } - timer.delay_ms(2); + timer.delay_ms(10); + // if it's not locked, it will hang at the CSR. unsafe { pl::csr::rtio_core::reset_phy_write(1); } - // if it's not locked, it will hang at the CSR. info!("SYS PLL locked"); + } #[cfg(has_drtio)]