- Edited
dpn By default, my device_db.py
contains
"sync_delay_seed": "eeprom_urukul0:68",
"io_update_delay": "eeprom_urukul0:68"
and the experiment
print("IO_UPDATE | measured optimal delay:", self.urukul0_ch0.tune_io_update_delay(),
" | actually used:", self.urukul0_ch0.sync_data.io_update_delay)
delay(20*ms)
sync_in_delay, window_size = self.urukul0_ch0.tune_sync_delay()
print("SYNC_IN | measured optimal delay:", sync_in_delay,
"| actually used:", self.urukul0_ch0.sync_data.sync_delay_seed,
"\n measured window size:", window_size)
outputs:
IO_UPDATE | measured optimal delay: 0 | actually used: 0
SYNC_IN | measured optimal delay: 15 | actually used: -1
measured window size: 5
There are some variations over time:
- After power-on,
self.urukul0_ch0.tune_io_update_delay()
returned3
in the first few experiment runs and has been returning0
ever since. self.urukul0_ch0.tune_sync_delay()
has always been returning either2
and5
for the window size.
Variations over time are bad, right?
Also, what does self.urukul0_ch0.sync_data.sync_delay_seed == -1
mean?
Luckily, I can offer some good news: My time calculations were correct and the DDS parameter values are updated with deterministic timing. My phase tracking was still wrong because self.urukul0_ch0.set_cfr1(phase_autoclear=1)
and self.urukul0_ch0.io_update.pulse_mu(8)
clear the phase accumulator a time dt
*before* the new DDS parameter values come into effect. Possible solutions:
- In
PHASE_MODE_ABSOLUTE
andPHASE_MODE_TRACKING
, instead ofself.urukul0_ch0.acc_pow = 0
, I could try to doself.urukul0_ch0.acc_pow = round(ftw * dt)
. I don't know if the requireddt
would be always be constant or if it would be the same for all AD9910 chips. But it seems thatdt = 4*ns
. If that is true, it might mean that the phase accumulator gets cleared when the io_pulse is registered by SYNC_CLK's rising edge, whereas the new DDS parameter values come into effect one SYNC_CLK cycle (4 ns) later. - I could reset the phase accumulator via
self.urukul0_ch0.set_mu(0, 0, 0, PHASE_MODE_ABSOLUTE)
and afterwards use *only*PHASE_MODE_CONTINUOUS
, becausePHASE_MODE_ABSOLUTE
andPHASE_MODE_TRACKING
reset the phase accumulator and thereby screw up the phase tracking.