From d65e893d1c7b16a833f093e155a141b6fc1bd207 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 20 Jul 2020 14:19:13 +0800 Subject: [PATCH] more conservative RTIO PLL reset timing --- src/runtime/src/main.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/runtime/src/main.rs b/src/runtime/src/main.rs index 40370946..6865b245 100644 --- a/src/runtime/src/main.rs +++ b/src/runtime/src/main.rs @@ -116,11 +116,20 @@ fn init_rtio(timer: GlobalTimer, cfg: &config::Config) { unsafe { pl::csr::rtio_crg::pll_reset_write(1); pl::csr::rtio_crg::clock_sel_write(clock_sel); + } + + let mut countdown = timer.countdown(); + countdown.start(Milliseconds(2)); + nb::block!(countdown.wait()).unwrap(); + + unsafe { pl::csr::rtio_crg::pll_reset_write(0); } + let mut countdown = timer.countdown(); - countdown.start(Milliseconds(1)); + countdown.start(Milliseconds(2)); nb::block!(countdown.wait()).unwrap(); + let locked = unsafe { pl::csr::rtio_crg::pll_locked_read() != 0 }; if !locked { panic!("RTIO PLL failed to lock");