Skip to content

Commit

Permalink
satman: program Si5324 BWSEL depending on frequency
Browse files Browse the repository at this point in the history
  • Loading branch information
sbourdeauducq committed Feb 18, 2017
1 parent 0bfce37 commit 59e7967
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions artiq/firmware/libboard/si5324.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ pub struct FrequencySettings {
pub n2_hs: u8,
pub n2_ls: u32,
pub n31: u32,
pub n32: u32
pub n32: u32,
pub bwsel: u8
}

fn map_frequency_settings(settings: &FrequencySettings) -> Result<FrequencySettings> {
Expand Down Expand Up @@ -85,7 +86,8 @@ fn map_frequency_settings(settings: &FrequencySettings) -> Result<FrequencySetti
},
n2_ls: settings.n2_ls - 1,
n31: settings.n31 - 1,
n32: settings.n32 - 1
n32: settings.n32 - 1,
bwsel: settings.bwsel
};
Ok(r)
}
Expand Down Expand Up @@ -146,7 +148,7 @@ pub fn setup(settings: &FrequencySettings) -> Result<()> {
}

write(0, read(0)? | 0x40)?; // FREE_RUN=1
write(2, (read(2)? & 0x0f) | (4 << 4))?; // BWSEL=4
write(2, (read(2)? & 0x0f) | (s.bwsel << 4))?;
write(21, read(21)? & 0xfe); // CKSEL_PIN=0
write(3, (read(3)? & 0x3f) | (0b01 << 6) | 0x10)?; // CKSEL_REG=b01 SQ_ICAL=1
write(4, (read(4)? & 0x3f) | (0b00 << 6))?; // AUTOSEL_REG=b00
Expand Down
6 changes: 4 additions & 2 deletions artiq/firmware/satman/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const SI5324_SETTINGS: board::si5324::FrequencySettings
n2_hs : 10,
n2_ls : 20112,
n31 : 2514,
n32 : 4597
n32 : 4597,
bwsel : 4
};

#[cfg(rtio_frequency = "150.0")]
Expand All @@ -29,7 +30,8 @@ const SI5324_SETTINGS: board::si5324::FrequencySettings
n2_hs : 10,
n2_ls : 33732,
n31 : 9370,
n32 : 7139
n32 : 7139,
bwsel : 3
};

fn drtio_link_is_up() -> bool {
Expand Down

0 comments on commit 59e7967

Please sign in to comment.