Skip to content

Commit

Permalink
eliminate invalid PLL transition
Browse files Browse the repository at this point in the history
this transition was in the reference C code, but in verilog simulation
it turns out it activates the PLL in an invalid mode which can lead
to glitching. Removing this makes both the simulation happy and
presumably the PLL happier as well.
  • Loading branch information
bunnie committed Nov 28, 2024
1 parent 3738db9 commit 6e8bff7
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions loader/src/platform/cramium/cramium.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1415,14 +1415,6 @@ unsafe fn init_clock_asic(freq_hz: u32) -> u32 {

crate::println!("pllq: 0x{:x}, pllmn: 0x{:x}, n_frac: 0x{:x}", pllq, pllmn, n_frac);

daric_cgu.add(sysctrl::SFR_CGUSEL1.offset()).write_volatile(1); // 0: RC, 1: XTAL
daric_cgu.add(sysctrl::SFR_CGUFSCR.offset()).write_volatile(48); // external crystal is 48MHz
daric_cgu.add(sysctrl::SFR_CGUSET.offset()).write_volatile(0x32);

if freq_hz < 1_000_000 {
daric_cgu.add(sysctrl::SFR_IPCOSC.offset()).write_volatile(freq_hz);
daric_cgu.add(sysctrl::SFR_IPCARIPFLOW.offset()).write_volatile(0x32); // commit, must write 32
}
// switch to OSC
daric_cgu.add(sysctrl::SFR_CGUSEL0.offset()).write_volatile(0); // clktop sel, 0:clksys, 1:clkpll0
daric_cgu.add(sysctrl::SFR_CGUSET.offset()).write_volatile(0x32); // commit
Expand Down

0 comments on commit 6e8bff7

Please sign in to comment.