diff --git a/firmware/Cargo.lock b/firmware/Cargo.lock index c4630c1..e799114 100644 --- a/firmware/Cargo.lock +++ b/firmware/Cargo.lock @@ -43,7 +43,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "tm4c129x" version = "0.4.0" -source = "git+https://github.com/m-labs/dslite2svd#f1b9a75e478c2186bf963ae1f868109fd14def29" +source = "git+https://github.com/m-labs/dslite2svd#43d3964bb9dcebe631b0bdf1c2fdc975cf53c41c" dependencies = [ "cortex-m 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "vcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/firmware/src/main.rs b/firmware/src/main.rs index 16355f3..96291c0 100644 --- a/firmware/src/main.rs +++ b/firmware/src/main.rs @@ -126,6 +126,16 @@ fn main() { let sysctl = tm4c129x::SYSCTL.borrow(cs); let nvic = tm4c129x::NVIC.borrow(cs); + // Set up main oscillator + sysctl.moscctl.write(|w| w.noxtal().bit(false)); + sysctl.moscctl.modify(|_, w| w.pwrdn().bit(false).oscrng().bit(true)); + + // Set up PLL with fVCO=320 MHz + sysctl.pllfreq1.write(|w| w.q().bits(0).n().bits(4)); + sysctl.pllfreq0.write(|w| w.mint().bits(64).pllpwr().bit(true)); + sysctl.rsclkcfg.modify(|_, w| w.pllsrc().mosc().newfreq().bit(true)); + while !sysctl.pllstat.read().lock().bit() {} + // Set up system timer let systick = tm4c129x::SYST.borrow(cs); systick.set_reload(systick.get_ticks_per_10ms());