Hi everyone, Is there an efficient way to implement a linear frequency ramp with Mirny (avoid slow for-loop).
I'm trying to generate a linear frequency ramp using Mirny, but I'm running into performance issues. It takes around 2–3 ms to set the frequency ('self.mirny0_ch0.set_frequency(freq)'), which becomes a bottleneck when trying to ramp over many steps quickly.
Here’s the code I currently use:
self.core.break_realtime()
self.mirny0_cpld.init()
self.mirny0_ch0.init()
self.mirny0_ch0.set_frequency(self.frequency0)
self.mirny0_ch0.set_att(self.attenuation0)
self.mirny0_ch0.sw.on()
delay(5*s)
# Set new values
start_freq = self.frequency0 # Starting frequency
num_steps = 30 # Number of steps in 100 ms
step = 0.1e6 / num_steps # 100 kHz
for i in range(num_steps):
freq = start_freq + i * step
self.mirny0_ch0.set_frequency(freq)
delay(1*us)
This loop takes a long time just to set the frequency, and I'd like to know:
Is there a built-in function or a more efficient way to generate a frequency ramp with Mirny, rather than relying on this for-loop?
Any suggestions or pointers would be appreciated!
Thanks in advance!