aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-11-17 12:04:02 -0800
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:05:06 -0800
commitba6e9e801cb45b060c4d33351dd6aed1a7cf08c8 (patch)
tree1d98c93b7bf22a3d4d0b750ff20b0c2472e58dfb
parent2ab5a0f6aa582ee542ab0c8f02835b935985b6b4 (diff)
downloaduhd-ba6e9e801cb45b060c4d33351dd6aed1a7cf08c8.tar.gz
uhd-ba6e9e801cb45b060c4d33351dd6aed1a7cf08c8.tar.bz2
uhd-ba6e9e801cb45b060c4d33351dd6aed1a7cf08c8.zip
mpm: n310: Made n310.__init__() more exception-safe
-rw-r--r--mpm/python/usrp_mpm/periph_manager/n310.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/mpm/python/usrp_mpm/periph_manager/n310.py b/mpm/python/usrp_mpm/periph_manager/n310.py
index ecce1bd77..08f6b8c22 100644
--- a/mpm/python/usrp_mpm/periph_manager/n310.py
+++ b/mpm/python/usrp_mpm/periph_manager/n310.py
@@ -482,7 +482,21 @@ class n310(PeriphManagerBase):
def __init__(self, args):
super(n310, self).__init__(args)
- self.sid_endpoints = {}
+ self._device_initialized = False
+ self._ext_clock_freq = None
+ self._clock_source = None
+ self._time_source = None
+ try:
+ self._init_peripherals(args)
+ self._device_initialized = True
+ except Exception as ex:
+ self.log.error("Failed to initialize motherboard: %s", str(ex))
+
+ def _init_peripherals(self, args):
+ """
+ Turn on all peripherals. This may throw an error on failure, so make
+ sure to catch it.
+ """
# Init peripherals
self.log.trace("Initializing TCA6424 port expander controls...")
self._gpios = TCA6424(int(self.mboard_info['rev']))