mirror of https://github.com/m-labs/artiq.git
Shuttler: Patch ddb entries in the example code
This commit is contained in:
parent
a61bbf5618
commit
eedac7cf71
|
@ -57,13 +57,13 @@ class Shuttler(EnvExperiment):
|
|||
self.setattr_device("core")
|
||||
self.setattr_device("core_dma")
|
||||
self.setattr_device("scheduler")
|
||||
self.leds = [ self.get_device("efc_led{}".format(i)) for i in range(2) ]
|
||||
self.setattr_device("pdq_config")
|
||||
self.setattr_device("pdq_trigger")
|
||||
self.pdq_volt = [ self.get_device("pdq{}_volt".format(i)) for i in range(16) ]
|
||||
self.pdq_dds = [ self.get_device("pdq{}_dds".format(i)) for i in range(16) ]
|
||||
self.setattr_device("afe_relay")
|
||||
self.setattr_device("afe_adc")
|
||||
self.efc0_leds = [ self.get_device("efc0_led{}".format(i)) for i in range(2) ]
|
||||
self.setattr_device("shuttler0_config")
|
||||
self.setattr_device("shuttler0_trigger")
|
||||
self.shuttler0_volt = [ self.get_device("shuttler0_volt{}".format(i)) for i in range(16) ]
|
||||
self.shuttler0_dds = [ self.get_device("shuttler0_dds{}".format(i)) for i in range(16) ]
|
||||
self.setattr_device("shuttler0_relay")
|
||||
self.setattr_device("shuttler0_adc")
|
||||
|
||||
|
||||
@kernel
|
||||
|
@ -102,13 +102,13 @@ class Shuttler(EnvExperiment):
|
|||
|
||||
@kernel
|
||||
def pdq_channel_reset(self, ch):
|
||||
self.pdq_volt[ch].set_waveform(
|
||||
self.shuttler0_volt[ch].set_waveform(
|
||||
a0=0,
|
||||
a1=0,
|
||||
a2=0,
|
||||
a3=0,
|
||||
)
|
||||
self.pdq_dds[ch].set_waveform(
|
||||
self.shuttler0_dds[ch].set_waveform(
|
||||
b0=0,
|
||||
b1=0,
|
||||
b2=0,
|
||||
|
@ -117,7 +117,7 @@ class Shuttler(EnvExperiment):
|
|||
c1=0,
|
||||
c2=0,
|
||||
)
|
||||
self.pdq_trigger.trigger(1 << ch)
|
||||
self.shuttler0_trigger.trigger(1 << ch)
|
||||
|
||||
@kernel
|
||||
def example_waveform(self):
|
||||
|
@ -158,14 +158,14 @@ class Shuttler(EnvExperiment):
|
|||
# Reset OUT0 and OUT1
|
||||
|
||||
## Step 1 ##
|
||||
self.afe_relay.enable(0b11)
|
||||
self.shuttler0_relay.enable(0b11)
|
||||
|
||||
## Step 2 ##
|
||||
start_f_MHz = 0.01
|
||||
end_f_MHz = 0.05
|
||||
duration_us = 500
|
||||
# OUT0 and OUT1 have their frequency and phase aligned at 500us
|
||||
self.pdq_dds[0].set_waveform(
|
||||
self.shuttler0_dds[0].set_waveform(
|
||||
b0=pdq_dds_amp_mu(1.0),
|
||||
b1=0,
|
||||
b2=0,
|
||||
|
@ -174,7 +174,7 @@ class Shuttler(EnvExperiment):
|
|||
c1=pdq_freq_mu(start_f_MHz),
|
||||
c2=pdq_freq_sweep(start_f_MHz, end_f_MHz, duration_us),
|
||||
)
|
||||
self.pdq_dds[1].set_waveform(
|
||||
self.shuttler0_dds[1].set_waveform(
|
||||
b0=pdq_dds_amp_mu(1.0),
|
||||
b1=0,
|
||||
b2=0,
|
||||
|
@ -183,12 +183,12 @@ class Shuttler(EnvExperiment):
|
|||
c1=pdq_freq_mu(end_f_MHz),
|
||||
c2=0,
|
||||
)
|
||||
self.pdq_trigger.trigger(0b11)
|
||||
self.shuttler0_trigger.trigger(0b11)
|
||||
delay(500*us)
|
||||
|
||||
## Step 3 ##
|
||||
# OUT0 and OUT1 has 180 degree phase difference
|
||||
self.pdq_dds[0].set_waveform(
|
||||
self.shuttler0_dds[0].set_waveform(
|
||||
b0=pdq_dds_amp_mu(1.0),
|
||||
b1=0,
|
||||
b2=0,
|
||||
|
@ -199,12 +199,12 @@ class Shuttler(EnvExperiment):
|
|||
)
|
||||
# Phase and Output Setting of OUT1 is retained
|
||||
# if the channel is not triggered or config is not cleared
|
||||
self.pdq_trigger.trigger(0b1)
|
||||
self.shuttler0_trigger.trigger(0b1)
|
||||
delay(500*us)
|
||||
|
||||
## Step 4 ##
|
||||
# b(0) = 0, b(250) = 8.545, b(500) = 0
|
||||
self.pdq_dds[0].set_waveform(
|
||||
self.shuttler0_dds[0].set_waveform(
|
||||
b0=0,
|
||||
b1=pdq_dds_damp_mu(0.06835937),
|
||||
b2=pdq_dds_ddamp_mu(-0.0001367187),
|
||||
|
@ -213,7 +213,7 @@ class Shuttler(EnvExperiment):
|
|||
c1=pdq_freq_mu(end_f_MHz),
|
||||
c2=0,
|
||||
)
|
||||
self.pdq_dds[1].set_waveform(
|
||||
self.shuttler0_dds[1].set_waveform(
|
||||
b0=0,
|
||||
b1=pdq_dds_damp_mu(0.06835937),
|
||||
b2=pdq_dds_ddamp_mu(-0.0001367187),
|
||||
|
@ -222,17 +222,17 @@ class Shuttler(EnvExperiment):
|
|||
c1=0,
|
||||
c2=0,
|
||||
)
|
||||
self.pdq_trigger.trigger(0b11)
|
||||
self.shuttler0_trigger.trigger(0b11)
|
||||
delay(500*us)
|
||||
|
||||
## Step 5 ##
|
||||
self.pdq_volt[0].set_waveform(
|
||||
self.shuttler0_volt[0].set_waveform(
|
||||
a0=pdq_volt_amp_mu(-5.0),
|
||||
a1=int32(pdq_volt_damp_mu(0.01)),
|
||||
a2=0,
|
||||
a3=0,
|
||||
)
|
||||
self.pdq_dds[0].set_waveform(
|
||||
self.shuttler0_dds[0].set_waveform(
|
||||
b0=pdq_dds_amp_mu(1.0),
|
||||
b1=0,
|
||||
b2=0,
|
||||
|
@ -241,13 +241,13 @@ class Shuttler(EnvExperiment):
|
|||
c1=pdq_freq_mu(end_f_MHz),
|
||||
c2=0,
|
||||
)
|
||||
self.pdq_volt[1].set_waveform(
|
||||
self.shuttler0_volt[1].set_waveform(
|
||||
a0=pdq_volt_amp_mu(-5.0),
|
||||
a1=int32(pdq_volt_damp_mu(0.01)),
|
||||
a2=0,
|
||||
a3=0,
|
||||
)
|
||||
self.pdq_dds[1].set_waveform(
|
||||
self.shuttler0_dds[1].set_waveform(
|
||||
b0=0,
|
||||
b1=0,
|
||||
b2=0,
|
||||
|
@ -256,17 +256,17 @@ class Shuttler(EnvExperiment):
|
|||
c1=0,
|
||||
c2=0,
|
||||
)
|
||||
self.pdq_trigger.trigger(0b11)
|
||||
self.shuttler0_trigger.trigger(0b11)
|
||||
delay(1000*us)
|
||||
|
||||
## Step 6 ##
|
||||
self.pdq_volt[0].set_waveform(
|
||||
self.shuttler0_volt[0].set_waveform(
|
||||
a0=pdq_volt_amp_mu(-2.5),
|
||||
a1=int32(pdq_volt_damp_mu(0.01)),
|
||||
a2=0,
|
||||
a3=0,
|
||||
)
|
||||
self.pdq_dds[0].set_waveform(
|
||||
self.shuttler0_dds[0].set_waveform(
|
||||
b0=0,
|
||||
b1=pdq_dds_damp_mu(0.06835937),
|
||||
b2=pdq_dds_ddamp_mu(-0.0001367187),
|
||||
|
@ -275,18 +275,18 @@ class Shuttler(EnvExperiment):
|
|||
c1=pdq_freq_mu(start_f_MHz),
|
||||
c2=pdq_freq_sweep(start_f_MHz, end_f_MHz, duration_us),
|
||||
)
|
||||
self.pdq_trigger.trigger(0b1)
|
||||
self.shuttler0_trigger.trigger(0b1)
|
||||
self.pdq_channel_reset(1)
|
||||
delay(500*us)
|
||||
|
||||
## Step 7 ##
|
||||
self.pdq_volt[0].set_waveform(
|
||||
self.shuttler0_volt[0].set_waveform(
|
||||
a0=pdq_volt_amp_mu(2.5),
|
||||
a1=int32(pdq_volt_damp_mu(-0.01)),
|
||||
a2=0,
|
||||
a3=0,
|
||||
)
|
||||
self.pdq_dds[0].set_waveform(
|
||||
self.shuttler0_dds[0].set_waveform(
|
||||
b0=0,
|
||||
b1=pdq_dds_damp_mu(-0.06835937),
|
||||
b2=pdq_dds_ddamp_mu(0.0001367187),
|
||||
|
@ -295,11 +295,11 @@ class Shuttler(EnvExperiment):
|
|||
c1=pdq_freq_mu(end_f_MHz),
|
||||
c2=pdq_freq_sweep(end_f_MHz, start_f_MHz, duration_us),
|
||||
)
|
||||
self.pdq_trigger.trigger(0b1)
|
||||
self.shuttler0_trigger.trigger(0b1)
|
||||
delay(500*us)
|
||||
|
||||
## Step 8 ##
|
||||
self.afe_relay.enable(0)
|
||||
self.shuttler0_relay.enable(0)
|
||||
self.pdq_channel_reset(0)
|
||||
self.pdq_channel_reset(1)
|
||||
|
||||
|
@ -307,24 +307,24 @@ class Shuttler(EnvExperiment):
|
|||
def led(self):
|
||||
for i in range(2):
|
||||
for j in range(3):
|
||||
self.leds[i].pulse(.1*s)
|
||||
self.efc0_leds[i].pulse(.1*s)
|
||||
delay(.1*s)
|
||||
|
||||
@kernel
|
||||
def relay_init(self):
|
||||
self.afe_relay.init()
|
||||
self.afe_relay.enable(0x0000)
|
||||
self.shuttler0_relay.init()
|
||||
self.shuttler0_relay.enable(0x0000)
|
||||
|
||||
@kernel
|
||||
def adc_init(self):
|
||||
delay_mu(int64(self.core.ref_multiplier))
|
||||
self.afe_adc.power_up()
|
||||
self.shuttler0_adc.power_up()
|
||||
|
||||
delay_mu(int64(self.core.ref_multiplier))
|
||||
assert self.afe_adc.read_id() >> 4 == 0x038d
|
||||
assert self.shuttler0_adc.read_id() >> 4 == 0x038d
|
||||
|
||||
delay_mu(int64(self.core.ref_multiplier))
|
||||
# The actual output voltage is limited by the hardware, the calculated calibration gain and offset.
|
||||
# For example, if the system has a calibration gain of 1.06, then the max output voltage = 10 / 1.06 = 9.43V.
|
||||
# Setting a value larger than 9.43V will result in overflow.
|
||||
self.afe_adc.calibrate(self.pdq_volt, self.pdq_trigger, self.pdq_config)
|
||||
self.shuttler0_adc.calibrate(self.shuttler0_volt, self.shuttler0_trigger, self.shuttler0_config)
|
||||
|
|
Loading…
Reference in New Issue