1
0
Fork 0

retry RTIO PLL lock

This commit is contained in:
Sebastien Bourdeauducq 2020-07-25 11:15:33 +08:00
parent 0ce45b145e
commit 26874030fc
1 changed files with 15 additions and 16 deletions

View File

@ -112,22 +112,21 @@ fn init_rtio(timer: &mut GlobalTimer, cfg: &config::Config) {
0 0
}; };
loop {
unsafe { unsafe {
pl::csr::rtio_crg::pll_reset_write(1); pl::csr::rtio_crg::pll_reset_write(1);
pl::csr::rtio_crg::clock_sel_write(clock_sel); pl::csr::rtio_crg::clock_sel_write(clock_sel);
}
timer.delay_ms(2);
unsafe {
pl::csr::rtio_crg::pll_reset_write(0); pl::csr::rtio_crg::pll_reset_write(0);
} }
timer.delay_ms(1);
timer.delay_ms(2);
let locked = unsafe { pl::csr::rtio_crg::pll_locked_read() != 0 }; let locked = unsafe { pl::csr::rtio_crg::pll_locked_read() != 0 };
if !locked { if locked {
panic!("RTIO PLL failed to lock"); info!("RTIO PLL locked");
break;
} else {
warn!("RTIO PLL failed to lock, retrying...");
timer.delay_ms(500);
}
} }
unsafe { unsafe {