diff options
author | Trung Tran <trung.tran@ettus.com> | 2017-11-13 08:32:13 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:05:06 -0800 |
commit | 9ea0d6da9e3756af91c7d1e99ee35e56bf2270d6 (patch) | |
tree | b24c75a58aaf1217aefa9798ddf241b10031db8e /mpm/python/usrp_mpm/dboard_manager/magnesium.py | |
parent | fa765de7db4ab0933578e986c967d6e8eea60170 (diff) | |
download | uhd-9ea0d6da9e3756af91c7d1e99ee35e56bf2270d6.tar.gz uhd-9ea0d6da9e3756af91c7d1e99ee35e56bf2270d6.tar.bz2 uhd-9ea0d6da9e3756af91c7d1e99ee35e56bf2270d6.zip |
mg: enable init and track calibration API
Currently, AD9371 turned on most of the calibration and hard coding the turning
on process during bringup time.
This change enables users to pass in a mask field for init ARM calibration and
tracking arm calibration at the time creating USRP device reference.
This mask field can be passed through device arguments of:
1/ init_cals : for init ARM calibration masks. This is defined in AD9371 UG-992
table 65. Default to 0x4DFF
2/ tracking_cals : for tracking calibration masks. This is defined in AD9371
UG-992 table 66. Default to 0xC3
Example of pasing in init calibration and tracking calibration mask
usrp_application --args "init_cals=0x4f, tracking_cals=0xC3"
NOTE: UHD currently expect user to input the correct init_cals and
tracking_cals. There's no mechanism to check if init mask and tracking mask are
valid. For example if the init mask field not mask 0x4f, the AD9371 will failed
to setup.
Diffstat (limited to 'mpm/python/usrp_mpm/dboard_manager/magnesium.py')
-rw-r--r-- | mpm/python/usrp_mpm/dboard_manager/magnesium.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/mpm/python/usrp_mpm/dboard_manager/magnesium.py b/mpm/python/usrp_mpm/dboard_manager/magnesium.py index 217517a56..d69b8ad23 100644 --- a/mpm/python/usrp_mpm/dboard_manager/magnesium.py +++ b/mpm/python/usrp_mpm/dboard_manager/magnesium.py @@ -508,7 +508,7 @@ class Magnesium(DboardManagerBase): _sync_db_clock(self.clock_synchronizer) # Clocks and PPS are now fully active! - self.init_jesd(self.radio_regs) + self.init_jesd(self.radio_regs, args) self.mykonos.start_radio() return True @@ -526,7 +526,24 @@ class Magnesium(DboardManagerBase): self.cpld.poke16(addr, data) return self.cpld.peek16(addr) - def init_jesd(self, uio): + def init_rf_cal(self, args): + " Setup RF CAL " + self.log.info("Setting up RF CAL...") + try: + self._init_cals_mask = int(args.get('init_cals', str(self.mykonos.DEFAULT_INIT_CALS_MASKS)), 0) + self._tracking_cals_mask = int(args.get('tracking_cals', str(self.mykonos.DEFAULT_TRACKING_CALS_MASKS)), 0) + self._init_cals_timeout = int(args.get('init_cals_timeout', str(self.mykonos.DEFAULT_INIT_CALS_TIMEOUT)), 0) + except ValueError as ex: + self.log.warning("init() args missing or error using default value seeing following exception print out.") + self.log.warning("{}".format(ex)) + self._init_cals_mask = self.mykonos.DEFAULT_INIT_CALS_MASKS + self._tracking_cals_mask = self.mykonos.DEFAULT_TRACKING_CALS_MASKS + self._init_cals_timeout = self.mykonos.DEFAULT_INIT_CALS_TIMEOUT + self.log.debug("args[init_cals]=0x{:02X}".format(self._init_cals_mask)) + self.log.debug("args[tracking_cals]=0x{:02X}".format(self._tracking_cals_mask)) + self.mykonos.setup_cal(self._init_cals_mask, self._tracking_cals_mask, self._init_cals_timeout) + + def init_jesd(self, uio, args): """ Bring up the JESD link between Mykonos and the N310. """ @@ -546,6 +563,8 @@ class Magnesium(DboardManagerBase): time.sleep(0.001) self.jesdcore.send_sysref_pulse() self.mykonos.finish_initialization() + # TODO:can we call this after JESD? + self.init_rf_cal(args) self.log.trace("Starting JESD204b Link Initialization...") # Generally, enable the source before the sink. Start with the DAC side. |