2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-28 20:53:35 +08:00

sayma: generate 100MHz from Si5324 on standalone and master targets

* Allow switching between DRTIO satellite and standalone without
  touching the hardware.
* Allow operating standalone and master without an additional RF
  signal generator.
This commit is contained in:
Sebastien Bourdeauducq 2018-06-23 10:35:25 +08:00
parent b6dd9c8bb0
commit 68530fde07
2 changed files with 36 additions and 3 deletions

View File

@ -131,7 +131,7 @@ fn startup() {
fn setup_si5324_as_synthesizer()
{
// 125MHz output, from 100MHz CLKIN2 reference, 586 Hz
#[cfg(all(rtio_frequency = "125.0", si5324_ext_ref))]
#[cfg(all(not(si5324_sayma_ref), rtio_frequency = "125.0", si5324_ext_ref))]
const SI5324_SETTINGS: board_artiq::si5324::FrequencySettings
= board_artiq::si5324::FrequencySettings {
n1_hs : 10,
@ -144,7 +144,7 @@ fn setup_si5324_as_synthesizer()
crystal_ref: false
};
// 125MHz output, from crystal, 7 Hz
#[cfg(all(rtio_frequency = "125.0", not(si5324_ext_ref)))]
#[cfg(all(not(si5324_sayma_ref), rtio_frequency = "125.0", not(si5324_ext_ref)))]
const SI5324_SETTINGS: board_artiq::si5324::FrequencySettings
= board_artiq::si5324::FrequencySettings {
n1_hs : 10,
@ -157,7 +157,7 @@ fn setup_si5324_as_synthesizer()
crystal_ref: true
};
// 150MHz output, from crystal
#[cfg(all(rtio_frequency = "150.0", not(si5324_ext_ref)))]
#[cfg(all(not(si5324_sayma_ref), rtio_frequency = "150.0", not(si5324_ext_ref)))]
const SI5324_SETTINGS: board_artiq::si5324::FrequencySettings
= board_artiq::si5324::FrequencySettings {
n1_hs : 9,
@ -169,6 +169,19 @@ fn setup_si5324_as_synthesizer()
bwsel : 3,
crystal_ref: true
};
// 100MHz output, from crystal (reference for HMC830)
#[cfg(si5324_sayma_ref)]
const SI5324_SETTINGS: board_artiq::si5324::FrequencySettings
= board_artiq::si5324::FrequencySettings {
n1_hs : 9,
nc1_ls : 6,
n2_hs : 10,
n2_ls : 33732,
n31 : 9370,
n32 : 7139,
bwsel : 3,
crystal_ref: true
};
board_artiq::si5324::setup(&SI5324_SETTINGS,
board_artiq::si5324::Input::Ckin2).expect("cannot initialize Si5324");
}

View File

@ -139,6 +139,16 @@ class Standalone(MiniSoC, AMPSoC, RTMCommon):
platform = self.platform
self.submodules.si5324_rst_n = gpio.GPIOOut(platform.request("si5324").rst_n)
self.csr_devices.append("si5324_rst_n")
i2c = self.platform.request("i2c")
self.submodules.i2c = gpio.GPIOTristate([i2c.scl, i2c.sda])
self.csr_devices.append("i2c")
self.config["I2C_BUS_COUNT"] = 1
self.config["HAS_SI5324"] = None
self.config["SI5324_AS_SYNTHESIZER"] = None
self.config["SI5324_SAYMA_REF"] = None
# RTIO
rtio_channels = []
for i in range(4):
@ -233,6 +243,16 @@ class Master(MiniSoC, AMPSoC, RTMCommon):
platform = self.platform
rtio_clk_freq = 150e6
self.submodules.si5324_rst_n = gpio.GPIOOut(platform.request("si5324").rst_n)
self.csr_devices.append("si5324_rst_n")
i2c = self.platform.request("i2c")
self.submodules.i2c = gpio.GPIOTristate([i2c.scl, i2c.sda])
self.csr_devices.append("i2c")
self.config["I2C_BUS_COUNT"] = 1
self.config["HAS_SI5324"] = None
self.config["SI5324_AS_SYNTHESIZER"] = None
self.config["SI5324_SAYMA_REF"] = None
self.comb += [
platform.request("sfp_tx_disable", i).eq(0)
for i in range(2)