We are running into a problem where DMA seems to be taking a long time to record (27 ms for 100 points and ~ 260 ms for 1000 points) and seems to only be able to record up to ~ 1000 points before it freezes on self.record(). I am having this problem both with recording urukul and zotino ramps. As we will have many ramps, it does not seem practical to load them all at the beginning of the experiment so we were hoping to be able to record them as we went but if our entire experiment will take ~ 300 ms so waiting 260 ms for a single ramp of many is definitely not doable. What would you recommend doing to achieve fast urukul and zotino ramps given this information?
Below I have provided samples for both my zotino and urukul ramps:
from artiq.experiment import *
import time
class DMA_zotino(EnvExperiment):
def build(self):
self.setattr_device("core")
self.setattr_device("core_dma")
self.setattr_device("zotino0") #This is the Output Channel 1
self.dac=self.zotino0 #Defines outputchannel_1
@kernel
def record(self):
with self.core_dma.record("ramp"):
for i in range(0,1000,1):
delay(1.5*us)
self.dac.set_dac([i/100],[7]) #we are outputting on channel 7
self.dac.set_dac_mu([0],[7])
@kernel
def run(self):
self.core.reset()
self.dac.init()
time1 = self.core.get_rtio_counter_mu()
self.record()
print(self.core.mu_to_seconds(self.core.get_rtio_counter_mu() - time1))
pulses_handle = self.core_dma.get_handle("ramp")
self.core.break_realtime()
for i in range(1000):
self.core_dma.playback_handle(pulses_handle)
and:
from artiq.experiment import *
import time
class DMA_urukul(EnvExperiment):
def build(self):
self.setattr_device("core")
self.setattr_device("core_dma")
self.setattr_device("urukul2_cpld")
self.urukul2_ch2 = self.get_device("urukul2_ch2")
@kernel
def record(self):
number = 100
data = [0]*number
rev_data = [0]*number
freq = self.urukul2_ch2.frequency_to_ftw(200*MHz)
for i in range(number):
data[i] = self.urukul2_ch2.amplitude_to_asf(i/number)
with self.core_dma.record("ramp"):
for i in range(number):
delay(2*us)
self.urukul2_ch2.set_mu(freq,asf = data[i])
for i in range(number):
delay(2*us)
self.urukul2_ch2.set_mu(freq,asf = data[-i])
@kernel
def run(self):
self.core.reset()
self.core.break_realtime()
delay(100*ms)
self.urukul2_cpld.init()
self.urukul2_ch2.init()
self.urukul2_ch2.sw.off()
delay(10*ms)
self.urukul2_ch2.set(50 * MHz, amplitude = 0.777)
delay(10*ms)
self.urukul2_ch2.set_att(5.)
delay(10*ms)
self.urukul2_ch2.sw.on()
delay(10*ms)
print("pre")
timeee = self.core.get_rtio_counter_mu()
self.record()
print(self.core.mu_to_seconds(self.core.get_rtio_counter_mu() - timeee))
pulses_handle = self.core_dma.get_handle("ramp")
self.core.break_realtime() # Accounts for the ~40ms "negative" slack
for i in range(1000):
self.core_dma.playback_handle(pulses_handle)