diff options
Diffstat (limited to 'mpm/python/usrp_mpm/periph_manager')
| -rw-r--r-- | mpm/python/usrp_mpm/periph_manager/x4xx.py | 6 | ||||
| -rw-r--r-- | mpm/python/usrp_mpm/periph_manager/x4xx_rfdc_ctrl.py | 24 | 
2 files changed, 27 insertions, 3 deletions
diff --git a/mpm/python/usrp_mpm/periph_manager/x4xx.py b/mpm/python/usrp_mpm/periph_manager/x4xx.py index 70a087d14..d46c9098e 100644 --- a/mpm/python/usrp_mpm/periph_manager/x4xx.py +++ b/mpm/python/usrp_mpm/periph_manager/x4xx.py @@ -317,6 +317,10 @@ class x4xx(ZynqComponents, PeriphManagerBase):          except Exception as ex:              self.log.warning("Failed to initialize device on boot: %s", str(ex)) +        # Freeze the RFDC calibration by default +        self.rfdc.set_cal_frozen(1, 1, "both") +        self.rfdc.set_cal_frozen(1, 0, "both") +      # The parent class versions of these functions require access to self, but      # these versions don't.      # pylint: disable=no-self-use @@ -880,6 +884,8 @@ class x4xx(ZynqComponents, PeriphManagerBase):              # was changed, to ensure the device transmission/acquisition continues at              # the requested frequency.              self.rfdc.rfdc_restore_nco_freq() +            # Do the same for the calibration freeze state +            self.rfdc.rfdc_restore_cal_freeze()          except RuntimeError as ex:              err = f"Setting clock_source={clock_source},time_source={time_source} " \                    f"failed, falling back to {self._safe_sync_source}. Error: " \ diff --git a/mpm/python/usrp_mpm/periph_manager/x4xx_rfdc_ctrl.py b/mpm/python/usrp_mpm/periph_manager/x4xx_rfdc_ctrl.py index 39cd1dc40..874e4b5db 100644 --- a/mpm/python/usrp_mpm/periph_manager/x4xx_rfdc_ctrl.py +++ b/mpm/python/usrp_mpm/periph_manager/x4xx_rfdc_ctrl.py @@ -68,9 +68,6 @@ class X4xxRfdcCtrl:          self._rfdc_ctrl = lib.rfdc.rfdc_ctrl()          self._rfdc_ctrl.init(RFDC_DEVICE_ID) -        self.set_cal_frozen(1, 0, "both") -        self.set_cal_frozen(1, 1, "both") -          # Stores the last set value of the nco freq for each channel          # Follows the below structure:          #   <slot_id> @@ -87,6 +84,8 @@ class X4xxRfdcCtrl:              },          ] +        self._cal_freeze_cache = {} +      @no_rpc      def unset_cbs(self):          """ @@ -242,6 +241,24 @@ class X4xxRfdcCtrl:                  self.rfdc_set_nco_freq(direction, slot_id, 0, channel_frequencies[0])                  self.rfdc_set_nco_freq(direction, slot_id, 1, channel_frequencies[1]) +    @no_rpc +    def rfdc_restore_cal_freeze(self): +        """ +        Restores the previously set calibration freeze settings +        """ +        for slot_id in [0, 1]: +            for tile_id, block_id, _ in self._find_converters(slot_id, "rx", "both"): +                if (tile_id, block_id) in self._cal_freeze_cache: +                    self._rfdc_ctrl.set_cal_frozen( +                        tile_id, block_id, 0 +                    ) +                    self._rfdc_ctrl.set_cal_frozen( +                        tile_id, +                        block_id, +                        self._cal_freeze_cache[(tile_id, block_id)] +                    ) + +      ###########################################################################      # Public APIs that get exposed as MPM RPC calls      ########################################################################### @@ -280,6 +297,7 @@ class X4xxRfdcCtrl:          <frozen> should be 0 to unfreeze the calibration blocks or 1 to freeze them.          """          for tile_id, block_id, _ in self._find_converters(slot_id, "rx", channel): +            self._cal_freeze_cache[(tile_id, block_id)] = frozen              self._rfdc_ctrl.set_cal_frozen(tile_id, block_id, frozen)      def get_cal_frozen(self, slot_id, channel):  | 
