artiq
artiq copied to clipboard
Inconsistent RTIO Underflow for KC705 DMA
Bug Report
One-Line Summary
Unable to measure a consistent slack for preventing DMA RTIO Underflow with KC705.
Issue Details
The measured value seems dependent on whether print
is invoked, whether the DMA is played the first time, and possibly other unknown factors.
Steps to Reproduce
from artiq.experiment import *
class DMAPulses(EnvExperiment):
def build(self):
self.setattr_device("core")
self.setattr_device("core_dma")
self.setattr_device("ttl0")
@kernel
def record(self, t):
with self.core_dma.record("pulse"):
for i in range(10000):
self.ttl0.pulse(t*ns)
delay(t*ns)
@kernel
def run(self):
self.core.reset()
self.record(62)
pulse_handle = self.core_dma.get_handle("pulse")
lower = 0
upper = 10000
while upper - lower > 1:
print('upper: ', upper, ', lower: ', lower)
mid = (upper + lower) // 2;
try:
now = self.core.get_rtio_counter_mu()
at_mu(now + mid)
self.core_dma.playback_handle(pulse_handle)
upper = mid
except:
lower = mid
# tried adding some delay and see if it would be better
x = self.core.get_rtio_counter_mu()
self.core.wait_until_mu(x + 10000)
print('slack: ', self.core.mu_to_seconds(upper)*1000000000)
And tweak some parameters, such as removing the line print('upper: ', upper, ', lower: ', lower)
, changing upper
to 10000, etc.
All of these would yield drastically different numbers, such as 2500, 1250, 1562, 3125.
Expected Behavior
Give approximately the same value. For example, the script gives around 1550 for ZC706 consistently.
Actual (undesired) Behavior
The tweaks would give drastically different values.
Your System (omit irrelevant parts)
- Operating System: NixOS
- ARTIQ version: current master.
- Version of the gateware and runtime loaded in the core device: 6.7530.9b39ble3.beta;nist_clock
- Hardware involved: KC705