forked from M-Labs/artiq
kasli_tester: calibrate Urukul synchronization and write to EEPROM
This commit is contained in:
parent
346299e7f8
commit
e504262b67
@ -184,6 +184,14 @@ class KasliTester(EnvExperiment):
|
||||
self.core.break_realtime()
|
||||
cpld.init()
|
||||
|
||||
@kernel
|
||||
def calibrate_urukul(self, channel):
|
||||
self.core.break_realtime()
|
||||
sync_delay_seed, _ = channel.tune_sync_delay()
|
||||
self.core.break_realtime()
|
||||
io_update_delay = channel.tune_io_update_delay()
|
||||
return sync_delay_seed, io_update_delay
|
||||
|
||||
@kernel
|
||||
def setup_urukul(self, channel, frequency):
|
||||
self.core.break_realtime()
|
||||
@ -214,6 +222,23 @@ class KasliTester(EnvExperiment):
|
||||
self.init_urukul(cpld)
|
||||
print("...done")
|
||||
|
||||
print("Calibrating inter-device synchronization...")
|
||||
for channel_name, channel_dev in self.urukuls:
|
||||
if channel_dev.sync_delay_seed_eeprom is None and channel_dev.io_update_delay_eeprom is None:
|
||||
print("{}\tno synchronization".format(channel_name))
|
||||
elif channel_dev.sync_delay_seed_eeprom is not channel_dev.io_update_delay_eeprom:
|
||||
print("{}\tunsupported EEPROM configuration".format(channel_name))
|
||||
elif channel_dev.sync_delay_seed_offset != channel_dev.io_update_delay_offset:
|
||||
print("{}\tunsupported EEPROM offsets".format(channel_name))
|
||||
else:
|
||||
eeprom = channel_dev.sync_delay_seed_eeprom
|
||||
offset = channel_dev.sync_delay_seed_offset
|
||||
sync_delay_seed, io_update_delay = self.calibrate_urukul(channel_dev)
|
||||
print("{}\t{} {}".format(channel_name, sync_delay_seed, io_update_delay))
|
||||
eeprom_word = (sync_delay_seed << 24) | (io_update_delay << 16)
|
||||
eeprom.write_i32(offset, eeprom_word)
|
||||
print("...done")
|
||||
|
||||
print("Frequencies:")
|
||||
for card_n, channels in enumerate(chunker(self.urukuls, 4)):
|
||||
for channel_n, (channel_name, channel_dev) in enumerate(channels):
|
||||
|
Loading…
Reference in New Issue
Block a user