From a8ad4917d331258e163e1786c0325a4b7e7d2e3e Mon Sep 17 00:00:00 2001 From: mattprost Date: Wed, 6 Apr 2022 14:00:06 -0500 Subject: n310: Add frontend bandwidth control Allow users to control the Mykonos frontend bandwidth settings for Rx and Tx. Note that this operation requires the daughterboard to re-initialize, so it may take some time. Values for frontend filter settings were derived using ADI's AD9371 Filter Wizard. This feature requires MPM version 4.1 or later on the device. Co-authored-by: bpadalino Signed-off-by: mattprost --- mpm/python/usrp_mpm/dboard_manager/magnesium.py | 12 ++++++++++++ mpm/python/usrp_mpm/dboard_manager/mg_init.py | 4 ++++ mpm/python/usrp_mpm/rpc_server.py | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) (limited to 'mpm/python/usrp_mpm') diff --git a/mpm/python/usrp_mpm/dboard_manager/magnesium.py b/mpm/python/usrp_mpm/dboard_manager/magnesium.py index c4e2f4131..d5cc525dc 100644 --- a/mpm/python/usrp_mpm/dboard_manager/magnesium.py +++ b/mpm/python/usrp_mpm/dboard_manager/magnesium.py @@ -480,6 +480,18 @@ class Magnesium(BfrfsEEPROM, DboardManagerBase): 'value': str(lock_status).lower(), } + ########################################################################## + # Filter API + ########################################################################## + def set_bandwidth(self, which, bw): + if which.lower()[0:2] in ('tx', 'dx'): + self.log.debug("ad9371 set_tx_bandwidth bw: {}".format(bw)) + self._init_args['tx_bw'] = bw + if which.lower()[0:2] in ('rx', 'dx'): + self.log.debug("ad9371 set_rx_bandwidth bw: {}".format(bw)) + self._init_args['rx_bw'] = bw + self._reinit(self.master_clock_rate) + return bw ########################################################################## # Debug diff --git a/mpm/python/usrp_mpm/dboard_manager/mg_init.py b/mpm/python/usrp_mpm/dboard_manager/mg_init.py index 00a2eab7d..02658abb9 100644 --- a/mpm/python/usrp_mpm/dboard_manager/mg_init.py +++ b/mpm/python/usrp_mpm/dboard_manager/mg_init.py @@ -464,6 +464,10 @@ class MagnesiumInitManager(object): jesdcore.send_sysref_pulse() time.sleep(0.001) # 17us... ish. jesdcore.send_sysref_pulse() + if args.get('tx_bw'): + self.mykonos.set_bw_filter('TX', args.get('tx_bw')) + if args.get('rx_bw'): + self.mykonos.set_bw_filter('RX', args.get('rx_bw')) async_exec(self.mykonos, "finish_initialization") # According to the AD9371 user guide, p.57, the RF cal must come before # the framer/deframer init. We tried otherwise, and failed. So don't diff --git a/mpm/python/usrp_mpm/rpc_server.py b/mpm/python/usrp_mpm/rpc_server.py index 77b4d5a15..78b76ab19 100644 --- a/mpm/python/usrp_mpm/rpc_server.py +++ b/mpm/python/usrp_mpm/rpc_server.py @@ -32,7 +32,7 @@ from usrp_mpm.sys_utils import net TIMEOUT_INTERVAL = 5.0 # Seconds before claim expires (default value) TOKEN_LEN = 16 # Length of the token string # Compatibility number for MPM -MPM_COMPAT_NUM = (4, 0) +MPM_COMPAT_NUM = (4, 1) def no_claim(func): " Decorator for functions that require no token check " -- cgit v1.2.3