aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python/n3xx_bist
diff options
context:
space:
mode:
authorTrung Tran <trung.tran@ettus.com>2018-07-18 16:00:57 -0700
committerMartin Braun <martin.braun@ettus.com>2018-07-18 18:57:47 -0700
commitcb54b9b7e37545d2abaeba3840f4cfcdd549dc91 (patch)
tree70444e4e04b4b140f1a9cd518393012803f97dd4 /mpm/python/n3xx_bist
parent60d9850db73a95eca876d8891410a7941971a6f5 (diff)
downloaduhd-cb54b9b7e37545d2abaeba3840f4cfcdd549dc91.tar.gz
uhd-cb54b9b7e37545d2abaeba3840f4cfcdd549dc91.tar.bz2
uhd-cb54b9b7e37545d2abaeba3840f4cfcdd549dc91.zip
n3xx_bist: update sfp loopback test
Load AA image before doing the bist and load HG image after the bist.
Diffstat (limited to 'mpm/python/n3xx_bist')
-rwxr-xr-xmpm/python/n3xx_bist39
1 files changed, 39 insertions, 0 deletions
diff --git a/mpm/python/n3xx_bist b/mpm/python/n3xx_bist
index 9bb650895..62f09a9b2 100755
--- a/mpm/python/n3xx_bist
+++ b/mpm/python/n3xx_bist
@@ -51,6 +51,7 @@ def run_aurora_bist(master, slave=None):
from usrp_mpm import aurora_control
from usrp_mpm.sys_utils.uio import UIO
try:
+ load_fpga_image('AA')
master_au_uio = UIO(label=master, read_only=False)
master_au_uio.open()
master_au_ctrl = aurora_control.AuroraControl(master_au_uio)
@@ -241,6 +242,8 @@ class N3XXBIST(object):
'standard': ["ddr3", "gpsdo", "rtc", "temp", "fan", "tpm"],
'extended': "*",
}
+ # Default FPGA image type
+ DEFAULT_FPGA_TYPE = 'HG'
@staticmethod
def make_arg_parser():
@@ -284,6 +287,8 @@ class N3XXBIST(object):
def __init__(self):
self.args = N3XXBIST.make_arg_parser().parse_args()
self.args.option = expand_options(self.args.option)
+ # If this is true, trigger a reload of the default FPGA image
+ self.reload_fpga_image = False
try:
from usrp_mpm.periph_manager.n3xx import n3xx
default_rev = n3xx.mboard_max_rev
@@ -361,6 +366,8 @@ class N3XXBIST(object):
if self.args.lv_compat:
result = filter_results_for_lv(result)
post_results(result)
+ if self.reload_fpga_image:
+ load_fpga_image(self.DEFAULT_FPGA_TYPE)
return tests_successful
#############################################################################
@@ -611,6 +618,7 @@ class N3XXBIST(object):
if self.args.dry_run:
return True, get_sfp_bist_defaults()
sfp_bist_results = run_aurora_bist(master='misc-auro-regs0')
+ self.reload_fpga_image = True
return aurora_results_to_status(sfp_bist_results)
def bist_sfp1_loopback(self):
@@ -633,6 +641,7 @@ class N3XXBIST(object):
if self.args.dry_run:
return True, get_sfp_bist_defaults()
sfp_bist_results = run_aurora_bist(master='misc-auro-regs1')
+ self.reload_fpga_image = True
return aurora_results_to_status(sfp_bist_results)
def bist_sfp_loopback(self):
@@ -658,6 +667,7 @@ class N3XXBIST(object):
master='misc-auro-regs0',
slave='misc-auro-regs1',
)
+ self.reload_fpga_image = True
return aurora_results_to_status(sfp_bist_results)
def bist_gpio(self):
@@ -780,6 +790,35 @@ def gpio_set_all(gpio_bank, value, gpio_size, ddr_mask):
if ddr_bitstring[gpio_size - 1 - i] == "1":
gpio_bank.set(i, value_bitstring[i % ddr_size])
+def get_product_id():
+ """Return the mboard product ID (n310 or n300):"""
+ cmd = ['eeprom-id']
+ output = subprocess.check_output(
+ cmd,
+ stderr=subprocess.STDOUT,
+ shell=True,
+ ).decode('utf-8')
+ if 'n310' in output:
+ return 'n310'
+ elif 'n300' in output:
+ return 'n300'
+ raise AssertionError("Cannot determine product ID.")
+
+def load_fpga_image(fpga_type):
+ """Load an FPGA image (HG, XG, AA, ...)"""
+ cmd = ['uhd_image_loader', '--args', 'type=n3xx', '--fpga-path']
+ images_folder = '/usr/share/uhd/images/'
+ fpga_file_name = \
+ 'usrp_' + get_product_id() + '_fpga_' + fpga_type.upper() + '.bit'
+ fpga_image = images_folder + fpga_file_name
+ cmd.append(fpga_image)
+ cmd_str = ' '.join(cmd)
+ subprocess.check_output(
+ cmd_str,
+ stderr=subprocess.STDOUT,
+ shell=True
+ )
+
##############################################################################
# main
##############################################################################