From a745877cc9e3962dedb3f6b7c5db3382568fadee Mon Sep 17 00:00:00 2001 From: Trung N Tran Date: Thu, 27 Jul 2017 16:05:33 -0700 Subject: n310: gpio bist --- mpm/python/n3xx_bist | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'mpm/python/n3xx_bist') diff --git a/mpm/python/n3xx_bist b/mpm/python/n3xx_bist index a05a08b3c..f529cb70b 100755 --- a/mpm/python/n3xx_bist +++ b/mpm/python/n3xx_bist @@ -469,14 +469,37 @@ class N310BIST(object): - read_patterns: A list of patterns that were read back """ assert 'gpio' in self.tests_to_run + patterns = range(64) if self.args.dry_run: return True, { - 'write_patterns': [0, 1, 2, 4], - 'read_patterns': [0, 1, 2, 4], + 'write_patterns': patterns, + 'read_patterns': patterns, } - # FIXME implement - sys.stderr.write("Test not implemented.\n") - return True, {} + from usrp_mpm.periph_manager import n310 + gpioTCA6424 = n310.TCA6424() + ddr1 = 0x03f + ddr2 = 0xfc0 + half_GPIO_SIZE = 6 + def _runGPIO(ddr, patterns): + gpioTCA6424.set("FPGA-GPIO-EN") + time.sleep(.5) + myGPIO = n310.FP_GPIO(ddr) + for pattern in patterns: + myGPIO.set_all(pattern) + time.sleep(0.1) + rb = myGPIO.get_all() + if pattern != rb: + return False, {'write_patterns': [pattern], + 'read_patterns': [rb]} + return True, {'write_patterns': list(patterns), + 'read_patterns': list(patterns)} + gpioTCA6424.reset("FPGA-GPIO-EN") + time.sleep(.5) + status, data = _runGPIO(ddr1, patterns) + if not status: + return status, data + status, data = _runGPIO(ddr2, patterns) + return status, data def bist_temp(self): """ -- cgit v1.2.3