We have been trying to using the DDS to generate some outputs, but have been finding some weirdness with the outputs. It seems that the outputs when observed on the scope has two different periods, we seem to have resolved this by increasing the delay between each cycle, but don't understand why

What are the DDS frequency and oscilloscope sample rate?

DDS was at 200MHz and 85MHz for the two channels, oscilloscope sample rate should be 60MHz.

You're probably just seeing some aliasing which changes appearance with the phase drift between oscilloscope and DDS clocks. Use a faster oscilloscope.

6 days later

I talked to the guys who were doing the physics experiments, and they said it was noticeable via the time tagger hardware, so probably not just a phase drift?

Just check it with a correctly set up oscilloscope. It's not difficult or expensive and would give clearer information about what (if anything) is happening.

And please post code to reproduce the issue.

20 days later

Here is a snippet of the original code without the build() and prepare() functions:

@kernel                                                      # noqa F405
    def run_doppler_cooling(self):
        self.core.break_realtime()
   
        with parallel:                                           # noqa F405
            with sequential:
                self.ddses[0].sw.on()
                self.ddses[1].sw.on()
                self.ddses[0].set(frequency=200.0*MHz, amplitude=0.67) # noqa F405
                self.ddses[1].set(frequency=85.0*MHz, amplitude=0.39) # noqa F405
                delay(0.2*ms)
                self.ddses[0].sw.off()
                self.ddses[1].sw.off()

    def run_397_photon_generation(self):
        self.core.break_realtime()
        with sequential:                                         # noqa F405
            self.ddses[0].sw.on()
            self.ddses[0].set(frequency=200.0*MHz, amplitude=0.67) # noqa F405
            delay(5*us)                                          # noqa F405
            self.ddses[0].sw.off()
            delay(1*us)                                          # noqa F405
   
    def run_866_photon_generation(self):
        self.core.break_realtime()
        with sequential:                                         # noqa F405
            self.ddses[1].sw.on()
            self.ddses[1].set(frequency=85.0*MHz, amplitude=0.39) # noqa F405
            delay(5*us)                                          # noqa F405
            self.ddses[1].sw.off()
            delay(0.5*us)                                        # noqa F405
    
    @kernel                                                      # noqa F405
    def run(self):
        self.core.reset()
        self.init_dds()
        # Delay just in case
        delay(5*ms)                                              # noqa F405

        while True:
            self.core.break_realtime()
            with parallel:                                       # noqa F405
                self.run_doppler_cooling()
            for i in range(250):
                self.core.break_realtime()
                self.run_397_photon_generation()
                with parallel:
                    self.run_trigger(n=5, unit=us)
                    self.run_866_photon_generation()
                delay(1*us)                                     # noqa F405

We did hook it up to a scope in addition to the time tagger (the original image is from a scope). Here are some more images.

There's your problem! You are doing break_realtime() all over.

Thanks @rjo, so I guess I don't fully understand break_realtime(), should I just be calling it once outside of the loop? Also how does this lead to the observed behavior?