creotech-sayma-testsuite/artiq_exp/syncddsttl.py

78 lines
2.6 KiB
Python
Raw Normal View History

# NOTES:
# * Check DRTIO channel list by inspecting Metlino's log.
# * Prepare an artiq_route .CFG to route Sayma#1 and #2 as LINK#1,2 and #3,4.
from artiq.experiment import *
def build_exp(exp):
assert isinstance(exp, EnvExperiment)
exp.setattr_device("core")
# Test with SyncDDS channels
exp.basemods_1 = [exp.get_device("basemod_att"+str(i)) for i in range(2)]
exp.rfsws_1 = [exp.get_device("sawg_sw"+str(i)) for i in range(8)]
exp.basemods_2 = [exp.get_device("basemod_att"+str(i)) for i in range(2, 4)]
exp.rfsws_2 = [exp.get_device("sawg_sw"+str(i)) for i in range(8, 16)]
# Test with 2 TTL channels
exp.ttl_1 = exp.get_device("ttl0")
exp.ttl_2 = exp.get_device("ttl2")
# Bundled DUTs
exp.basemods = exp.basemods_1 + exp.basemods_2
exp.rfsws = exp.rfsws_1 + exp.rfsws_2
exp.ttls = [exp.ttl_1, exp.ttl_2]
class SyncDDSTTL(EnvExperiment):
def build(self):
build_exp(self)
# Option to use RTIO to generate TTL output
self.setattr_argument("gen_ttl_wave", BooleanValue(False))
@kernel
def drtio_is_up(self, drtio_index):
if not self.core.get_rtio_destination_status(drtio_index):
return False
print("DRTIO #", drtio_index, "is ready\n")
return True
@kernel
def run(self):
print("*** Waiting for DRTIO ready...")
drtio_indices = [1, 2, 3, 4]
for i in drtio_indices:
while not self.drtio_is_up(i):
pass
print("*** All DRTIO ready !")
self.core.reset()
with parallel:
with sequential:
for basemod in self.basemods:
basemod.reset()
delay(10*ms)
basemod.set(6.0, 6.0, 6.0, 6.0)
delay(10*ms)
# Printing shows that the BaseMod is being controlled properly.
print(basemod.get_mu())
delay(500*ms)
delay(1*s)
for rfsw in self.rfsws:
rfsw.on()
delay(1*ms)
print("All RF switches are on, att = 6.0dB for each channel.")
if self.gen_ttl_wave:
# All MCX TTLs must be TTLOuts, not TTLInOuts
print("TTLs are now outputting pulses with RTIO.")
while True:
for ttl in self.ttls:
ttl.on()
delay(111*ns)
for ttl in self.ttls:
ttl.off()
delay(4444*ns)
while True:
pass