From 9caef3c1d3eea3ae788e69988b84786ef64b535b Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 15 Dec 2017 16:45:26 +0800 Subject: [PATCH] libboard/si5324: configure I2C mux on Sayma --- artiq/firmware/libboard/si5324.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/artiq/firmware/libboard/si5324.rs b/artiq/firmware/libboard/si5324.rs index 17119b1b9..2f51b3080 100644 --- a/artiq/firmware/libboard/si5324.rs +++ b/artiq/firmware/libboard/si5324.rs @@ -8,10 +8,10 @@ type Result = result::Result; const BUSNO: u8 = 0; const ADDRESS: u8 = 0x68; -#[cfg(soc_platform = "kc705")] -fn pca9548_select(channel: u8) -> Result<()> { +#[cfg(any(soc_platform = "sayma_amc", soc_platform = "kc705"))] +fn pca9548_select(address: u8, channel: u8) -> Result<()> { i2c::start(BUSNO).unwrap(); - if !i2c::write(BUSNO, (0x74 << 1)).unwrap() { + if !i2c::write(BUSNO, (address << 1)).unwrap() { return Err("PCA9548 failed to ack write address") } if !i2c::write(BUSNO, 1 << channel).unwrap() { @@ -161,7 +161,9 @@ pub fn setup(settings: &FrequencySettings) -> Result<()> { clock::spin_us(10_000); #[cfg(soc_platform = "kc705")] - pca9548_select(7)?; + pca9548_select(0x74, 7)?; + #[cfg(soc_platform = "sayma_amc")] + pca9548_select(0x70, 4)?; if ident()? != 0x0182 { return Err("Si5324 does not have expected product number");