forked from M-Labs/artiq
1
0
Fork 0

satman: program Si5324 BWSEL depending on frequency

This commit is contained in:
Sebastien Bourdeauducq 2017-02-18 14:12:01 +08:00
parent 0bfce37fae
commit 59e79673f7
2 changed files with 9 additions and 5 deletions

View File

@ -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> {
@ -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)
}
@ -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

View File

@ -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 {