Skip to content
Permalink
Browse files

kasli_tester: calibrate Urukul synchronization and write to EEPROM

  • Loading branch information...
sbourdeauducq committed Mar 13, 2019
1 parent 346299e commit e504262b67e6f3774f15ad9443d83a05789ef793
Showing with 25 additions and 0 deletions.
  1. +25 −0 artiq/examples/kasli_basic/repository/kasli_tester.py
@@ -184,6 +184,14 @@ def init_urukul(self, cpld):
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 @@ def test_urukuls(self):
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):

0 comments on commit e504262

Please sign in to comment.
You can’t perform that action at this time.