sinara_tester: simplify almazny tests

This commit is contained in:
mwojcik 2024-05-30 14:40:07 +08:00 committed by Sébastien Bourdeauducq
parent 20c67aca23
commit f1e1e54940

View File

@ -384,9 +384,21 @@ class SinaraTester(EnvExperiment):
almazny.set_att_mu(ch, atts) almazny.set_att_mu(ch, atts)
@kernel @kernel
def legacy_almazny_set_attenuators(self, almazny, ch, atts): def legacy_almazny_att_test(self, almazny):
self.core.break_realtime() # change attenuation bit by bit over time for all channels
almazny.set_att(ch, atts) att_mu = 0
while not is_enter_pressed():
self.core.break_realtime()
t = now_mu() - self.core.seconds_to_mu(0.5)
while self.core.get_rtio_counter_mu() < t:
pass
for ch in range(4):
almazny.set_att_mu(ch, att_mu)
delay(250*ms)
if att_mu == 0:
att_mu = 1
else:
att_mu = (att_mu << 1) & 0x3F
@kernel @kernel
def legacy_almazny_toggle_output(self, almazny, rf_on): def legacy_almazny_toggle_output(self, almazny, rf_on):
@ -408,32 +420,16 @@ class SinaraTester(EnvExperiment):
frequency = 2000 + card_n * 250 + channel_n * 50 frequency = 2000 + card_n * 250 + channel_n * 50
print("{}\t{}MHz".format(channel_name, frequency*2)) print("{}\t{}MHz".format(channel_name, frequency*2))
self.setup_mirny(channel_dev, frequency) self.setup_mirny(channel_dev, frequency)
print("{} info: {}".format(channel_name, channel_dev.info()))
self.init_legacy_almazny(almazny) self.init_legacy_almazny(almazny)
print("RF ON, all attenuators ON. Press ENTER when done.")
for i in range(4):
self.legacy_almazny_set_attenuators_mu(almazny, i, 63)
input()
print("RF ON, half power attenuators ON. Press ENTER when done.")
for i in range(4):
self.legacy_almazny_set_attenuators(almazny, i, 15.5)
input()
print("RF ON, all attenuators OFF. Press ENTER when done.")
for i in range(4):
self.legacy_almazny_set_attenuators(almazny, i, 0)
input()
print("SR outputs are OFF. Press ENTER when done.") print("SR outputs are OFF. Press ENTER when done.")
self.legacy_almazny_toggle_output(almazny, False) self.legacy_almazny_toggle_output(almazny, False)
input() input()
print("RF ON, all attenuators are ON. Press ENTER when done.") print("RF ON, attenuators are tested. Press ENTER when done.")
for i in range(4):
self.legacy_almazny_set_attenuators(almazny, i, 31.5)
self.legacy_almazny_toggle_output(almazny, True) self.legacy_almazny_toggle_output(almazny, True)
input() self.legacy_almazny_att_test(almazny)
print("RF OFF. Press ENTER when done.")
self.legacy_almazny_toggle_output(almazny, False) self.legacy_almazny_toggle_output(almazny, False)
input()
@kernel
def almazny_led_wave(self, almaznys): def almazny_led_wave(self, almaznys):
while not is_enter_pressed(): while not is_enter_pressed():
self.core.break_realtime() self.core.break_realtime()
@ -441,14 +437,29 @@ class SinaraTester(EnvExperiment):
t = now_mu() - self.core.seconds_to_mu(0.2) t = now_mu() - self.core.seconds_to_mu(0.2)
while self.core.get_rtio_counter_mu() < t: while self.core.get_rtio_counter_mu() < t:
pass pass
for almazny in almaznys: for ch in almaznys:
almazny.set(31.5, False, True) ch.set(31.5, False, True)
delay(100*ms) delay(100*ms)
almazny.set(31.5, False, False) ch.set(31.5, False, False)
def almazny_set_att_all(self, almaznys, att): @kernel
for almazny in almaznys: def almazny_att_test(self, almaznys):
almazny.set(att, False, True) rf_en = 1
led = 1
att_mu = 0
while not is_enter_pressed():
self.core.break_realtime()
t = now_mu() - self.core.seconds_to_mu(0.2)
while self.core.get_rtio_counter_mu() < t:
pass
setting = led << 7 | rf_en << 6 | (att_mu & 0x3F)
for ch in almaznys:
ch.set_mu(setting)
delay(250*ms)
if att_mu == 0:
att_mu = 1
else:
att_mu = (att_mu << 1) & 0x3F
def test_almaznys(self): def test_almaznys(self):
print("*** Testing Almaznys (v1.2+).") print("*** Testing Almaznys (v1.2+).")
@ -463,13 +474,10 @@ class SinaraTester(EnvExperiment):
frequency = 2000 + card_n * 250 + channel_n * 50 frequency = 2000 + card_n * 250 + channel_n * 50
print("{}\t{}MHz".format(channel_name, frequency*2)) print("{}\t{}MHz".format(channel_name, frequency*2))
self.setup_mirny(channel_dev, frequency) self.setup_mirny(channel_dev, frequency)
print("RF On, half power attenuators ON. Press ENTER when done.") print("RF ON, attenuators are tested. Press ENTER when done.")
self.almazny_set_att_all(self.almaznys, 15.5) self.almazny_att_test([ch for _, ch in self.almaznys.items()])
input() print("RF OFF, testing LEDs. Press ENTER when done.")
print("RF On, all attenuators ON. Press ENTER when done.") self.almazny_led_wave([ch for _, ch in self.almaznys.items()])
self.almazny_set_att_all(self.almaznys, 31.5)
print("RF Off, testing LEDs. Press ENTER when done.")
self.almazny_led_wave(self.almaznys)
def test_mirnies(self): def test_mirnies(self):
print("*** Testing Mirny PLLs.") print("*** Testing Mirny PLLs.")