Hi

I want to optimise this code as much as possible therefore running the setting of attenuation, frequency, amplitude for all the channels in parallel. However it seems that when I place the first two blocks in parallel, the code does not work. Could someone please explain this.

`

@kernel
def run(self):


   self.core.reset()
   
   # self.DDS_ad9910_channel2.cpld.init()
   
   # self.DDS_ad9910_channel2.init()
   
   delay(10 * ms)
   
    with parallel:
        self.DDS_ad9910_channel0.set_att(self._atten0)
        self.DDS_ad9910_channel1.set_att(self._atten1)
        self.DDS_ad9910_channel2.set_att(self._atten2)
        self.DDS_ad9910_channel3.set_att(self._atten3)
        
    with parallel:
        self.DDS_ad9910_channel0.set(self._freq0 * MHz, amplitude = self._amp0)
        self.DDS_ad9910_channel1.set(self._freq1 * MHz, amplitude = self._amp1)
        self.DDS_ad9910_channel2.set(self._freq2 * MHz, amplitude = self._amp2)
        self.DDS_ad9910_channel3.set(self._freq3 * MHz, amplitude = self._amp3)

    with parallel:
        self.DDS_ad9910_channel0.sw.on()
        self.DDS_ad9910_channel1.sw.on()
        self.DDS_ad9910_channel2.sw.on()
        self.DDS_ad9910_channel3.sw.on()
       

    delay(self._t_pulse0 * s)
    self.core.wait_until_mu(now_mu())

`

Please format your post correctly. There's only one SPI bus per Urukul.

    3 years later

    so, what's the right script should be?