Skip to content

Commit

Permalink
Remove factor 4 in lmsDelay set in setup() if lmsDelay not provided i…
Browse files Browse the repository at this point in the history
…n pysmurf cfg file. Adjusted cfg file schema to reflect expansion of lmsDelay reg from 5 to 6 bits.
  • Loading branch information
swh76 committed Mar 28, 2024
1 parent e8db801 commit 8f56c64
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
12 changes: 6 additions & 6 deletions python/pysmurf/client/base/smurf_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,12 @@ def validate_config(loaded_config):
## TODO remove lmsDelay
# lmsDelay is deprected use bandDelayUs instead

# Matches system latency for LMS feedback (9.6 MHz
# ticks, use multiples of 52). For dspv3 to adjust to
# match refPhaseDelay*4 (ignore refPhaseDelayFine for
# this). If not provided and lmsDelay=None, sets to
# lmsDelay = 4 x refPhaseDelay.
Optional('lmsDelay', default=None) : And(int, lambda n: 0 <= n < 2**5),
# Matches system latency for LMS feedback (2.4 MHz
# ticks). For production SMuRF firmware, should set
# equal to refPhaseDelay. (ignore refPhaseDelayFine
# for this). If not provided and lmsDelay=None, sets
# to lmsDelay = refPhaseDelay.
Optional('lmsDelay', default=None) : And(int, lambda n: 0 <= n < 2**6),

# Adjust trigRstDly such that the ramp resets at the flux ramp
# glitch. 2.4 MHz ticks.
Expand Down
27 changes: 22 additions & 5 deletions python/pysmurf/client/base/smurf_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,13 +542,30 @@ def setup(self, write_log=True, payload_size=2048, force_configure=False, **kwar
self._ref_phase_delay_fine[band],
write_log=write_log, **kwargs)

# in DSPv3, lmsDelay should be 4*refPhaseDelay (says
# Mitch). If none provided in cfg, enforce that
# constraint. If provided in cfg, override with provided
# value.
# The lmsDelay register matches the system latency
# for LMS feedback. The readout has both actuator
# and sensor delay, so this delay is needed to
# compensate the feedback.
#
# actuator being the delay from DSP -> synthesis
# filter bank -> JESD -> DAC -> RF tracked freq
# out
#
# sensor delay being RF in resonator -> ADC input
# -> JESD -> filter bank -> demod (edited)
#
# The delay is needed because we are playing out a
# FM waveform on the RF DACs and it takes ~us to
# get the results.
#
# In production SMuRF firmware, lmsDelay should be
# set equal to refPhaseDelay, and both are
# integers that count 2.4 MHz ticks. If none
# provided in cfg, enforce that constraint. If
# provided in cfg, override with provided value.
if self._lms_delay[band] is None:
self.set_lms_delay(
band, int(4*self._ref_phase_delay[band]),
band, int(self._ref_phase_delay[band]),
write_log=write_log, **kwargs)
else:
self.set_lms_delay(
Expand Down

0 comments on commit 8f56c64

Please sign in to comment.