From 59e79673f75bf3024d566874570af06814ee3e29 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 18 Feb 2017 14:12:01 +0800 Subject: [PATCH] satman: program Si5324 BWSEL depending on frequency --- artiq/firmware/libboard/si5324.rs | 8 +++++--- artiq/firmware/satman/lib.rs | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/artiq/firmware/libboard/si5324.rs b/artiq/firmware/libboard/si5324.rs index d5d789a73..b5a983036 100644 --- a/artiq/firmware/libboard/si5324.rs +++ b/artiq/firmware/libboard/si5324.rs @@ -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 { @@ -85,7 +86,8 @@ fn map_frequency_settings(settings: &FrequencySettings) -> Result 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 diff --git a/artiq/firmware/satman/lib.rs b/artiq/firmware/satman/lib.rs index 4a507d3a5..107b366aa 100644 --- a/artiq/firmware/satman/lib.rs +++ b/artiq/firmware/satman/lib.rs @@ -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")] @@ -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 {