2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 11:18:27 +08:00

urukul: make RF switch TTL optional

This commit is contained in:
Sebastien Bourdeauducq 2022-03-26 17:23:13 +08:00
parent 317c257778
commit 72a6ff6e9c
3 changed files with 10 additions and 8 deletions

View File

@ -158,7 +158,7 @@ class AD9910:
ftw_per_hz: KernelInvariant[float]
sysclk_per_mu: KernelInvariant[int32]
sysclk: KernelInvariant[float]
sw: KernelInvariant[TTLOut]
sw: KernelInvariant[Option[TTLOut]]
sync_data: KernelInvariant[SyncDataUser]
phase_mode: Kernel[int32]
@ -175,8 +175,9 @@ class AD9910:
assert 3 <= chip_select <= 7
self.chip_select = chip_select
if sw_device:
self.sw = dmgr.get(sw_device)
# NAC3TODO: support no sw
self.sw = Some(dmgr.get(sw_device))
else:
self.sw = none
clk = self.cpld.refclk / [4, 1, 2, 4][self.cpld.clk_div]
self.pll_en = pll_en
self.pll_n = pll_n

View File

@ -1,6 +1,6 @@
from numpy import int32, int64
from artiq.language.core import KernelInvariant, nac3, kernel, portable
from artiq.language.core import *
from artiq.language.units import ms, us, ns
from artiq.coredevice.ad9912_reg import *
@ -35,7 +35,7 @@ class AD9912:
chip_select: KernelInvariant[int32]
pll_n: KernelInvariant[int32]
ftw_per_hz: KernelInvariant[float]
sw: KernelInvariant[TTLOut]
sw: KernelInvariant[Option[TTLOut]]
def __init__(self, dmgr, chip_select, cpld_device, sw_device=None,
pll_n=10):
@ -45,8 +45,9 @@ class AD9912:
assert 4 <= chip_select <= 7
self.chip_select = chip_select
if sw_device:
self.sw = dmgr.get(sw_device)
# NAC3TODO: support no sw
self.sw = Some(dmgr.get(sw_device))
else:
self.sw = none
self.pll_n = pll_n
sysclk = self.cpld.refclk / [1, 1, 2, 4][self.cpld.clk_div] * pll_n
assert sysclk <= 1e9

View File

@ -67,7 +67,7 @@ class NAC3Devices(EnvExperiment):
self.core.break_realtime()
self.urukul0_cpld.init()
self.urukul0_ch0.init()
self.urukul0_ch0.sw.on()
self.urukul0_ch0.sw.unwrap().on()
for i in range(10):
self.urukul0_ch0.set((10. + float(i))*MHz)
self.urukul0_ch0.set_att(6.)