lriesebos I don't know why I posted this section of code, I had tested it and found an underflow error. I should have clarified that I already tested your original suggestion, please see the code below. I had got an underflow error here and therefore I tried the code I had posted above.
`
@kernel
def run(self):
self.core.reset()
self.record()
for m in self.list_of_active_stages:
self.list_of_pulses_handle[m] = self.core_dma.get_handle(self.list_of_stages[m])
delay(1 *s)
for h in range(self.number_of_repetitions):
for i in self.list_of_active_stages:
self.ttlcounter_0.gate_rising((self.list_t_duration[i]*0.9) * ns)
self.ttlcounter_1.gate_rising((self.list_t_duration[i]*0.9) * ns)
self.ttlcounter_2.gate_rising((self.list_t_duration[i]*0.9) * ns)
self.ttlcounter_3.gate_rising((self.list_t_duration[i]*0.9) * ns)
t0 = now_mu()
self.core_dma.playback_handle(self.list_of_pulses_handle[i])
at_mu(self.list_of_t__1[i])
self.list_of_ttl_rising_edges_0[i] = (self.ttlcounter_0.fetch_count())
self.list_of_ttl_rising_edges_1[i] = (self.ttlcounter_1.fetch_count())
self.list_of_ttl_rising_edges_2[i] = (self.ttlcounter_2.fetch_count())
self.list_of_ttl_rising_edges_3[i] = (self.ttlcounter_3.fetch_count())
delay((self.list_t_duration[i] * ns) - ((self.core.mu_to_seconds((now_mu()-t0)))))
for hh in range(self.number_of_repetitions):
for ii in self.list_of_active_stages:
at_mu(self.list_of_t__1[ii])
self.sampler0.sample(self.list_of_sampler_values[ii])`
Even then i'm not sure this is exactly implementing what you have suggested before. Anyways I will explain what I am clearly trying to do. There are 7 stages in total,
- STAGE 1: time duration: 200ms, running amplitude and frequency modulation and zotino ramping all in parallel. These output signals are first recorded in the DMA and then played back in the run section I have posted above. Within the run section I am sampling the sampler and using the TTL edge counters. Therefore these input lines have to run within the 200ms duration.
- STAGE 2: time duration: 20ms, running amplitude and frequency modulation and zotino ramping all in parallel using DMA and input measurements are the same as stage 1 e.g analog input and TTL edges running now within the time duration of 20ms.
- STAGE 3: time duration: 10ms, running amplitude and frequency modulation all in parallel using DMA (no zotino ramping) and input measurements are the same as stage 1.
- STAGE 4: time duration 1ms, running amplitude and frequency modulation all in parallel using DMA (no zotino ramping) and input measurements are the same as stage 1.
- STAGE 5: time duration 300us, no amplitude or frequency modulation, all the output signals are single tone recorded using DMA but the input measurements are the same as stage 1.
- STAGE 6: time duration 2ms, running amplitude and frequency modulation all in parallel using DMA (no zotino ramping) and input measurements are the same as stage 1.
- STAGE 7: time duration 10ms, running amplitude and frequency modulation all in parallel using DMA (no zotino ramping) and input measurements are the same as stage 1.
I should point out that during each stage I am measuring the time it takes to playback the DMA recording and in the case of any of the ramps e.g AM, FM or Zotino, this time will reach the stage end period and therefore the delay will be a fraction of the stage time duration. Initialisation of the hardware is not an issue as this has been done in preceding scripts. I have measured the slack before and after each sampler function and the issue arises in stage 4 when the stage time duration is 300us and there is not enough delay for that stage to run the next iteration. I would like to change the code to fit the limitations of the sequence rather than the other way around. I can show you my code and walk you through it within 15 minutes through a Zoom/MS meeting. I believe this would save you alot of time as I can run ARTIQ with any modifications you can see the results on the screen share. I have thought about the code modifications but I have not been able to devise a different code architecture which will implement the output and input signals within the specified time frames. To reiterate this runs correctly without the sampler. Removing the DMA playback and running only sampler works as well therefore this issue is with the structure of the code rather than the individual hardware components. As you have probably read I have been stuck on this issue for more than two weeks now, please let me know if you are interested in an online video meeting.