aboutsummaryrefslogtreecommitdiffstats
path: root/mpm
diff options
context:
space:
mode:
authorSugandha Gupta <sugandha.gupta@ettus.com>2018-07-26 15:37:22 -0700
committerBrent Stapleton <bstapleton@g.hmc.edu>2018-07-31 14:02:02 -0700
commit07ea501abe8310f7f2e192b43c6329cb60505c5d (patch)
tree24ac97b198423fbfd2dd7c9326ad8063c4c4872e /mpm
parent0e0b62baf86e572a362d39211165badb14ebdc66 (diff)
downloaduhd-07ea501abe8310f7f2e192b43c6329cb60505c5d.tar.gz
uhd-07ea501abe8310f7f2e192b43c6329cb60505c5d.tar.bz2
uhd-07ea501abe8310f7f2e192b43c6329cb60505c5d.zip
e320: Fix front panel gpio to support 3.3V
- E320 will support only 3.3 V for the front panel GPIO - Remove other voltage options
Diffstat (limited to 'mpm')
-rwxr-xr-xmpm/python/e320_bist2
-rw-r--r--mpm/python/usrp_mpm/periph_manager/e320.py18
-rw-r--r--mpm/python/usrp_mpm/periph_manager/e320_periphs.py23
3 files changed, 19 insertions, 24 deletions
diff --git a/mpm/python/e320_bist b/mpm/python/e320_bist
index 8ee5b9b91..a91395110 100755
--- a/mpm/python/e320_bist
+++ b/mpm/python/e320_bist
@@ -472,7 +472,6 @@ class E320BIST(object):
}
from usrp_mpm.periph_manager import e320
# Turn on GPS, give some time to acclimatize
- print("Entered gpsdo test")
mb_regs = e320.MboardRegsControl(e320.e320.mboard_regs_label, self.log)
mb_regs.enable_gps(True)
time.sleep(5)
@@ -668,7 +667,6 @@ class E320BIST(object):
from usrp_mpm.periph_manager import e320, e320_periphs
mb_regs = e320_periphs.MboardRegsControl(e320.e320.mboard_regs_label, self.log)
mb_regs.enable_fp_gpio(True)
- mb_regs.set_fp_gpio_voltage(2.5)
mb_regs.set_fp_gpio_master(0xFF)
# Allow some time for the front-panel GPIOs to become usable
time.sleep(1)
diff --git a/mpm/python/usrp_mpm/periph_manager/e320.py b/mpm/python/usrp_mpm/periph_manager/e320.py
index 461527f59..2ed726bc9 100644
--- a/mpm/python/usrp_mpm/periph_manager/e320.py
+++ b/mpm/python/usrp_mpm/periph_manager/e320.py
@@ -31,7 +31,7 @@ E320_DEFAULT_EXT_CLOCK_FREQ = 10e6
E320_DEFAULT_CLOCK_SOURCE = 'internal'
E320_DEFAULT_TIME_SOURCE = 'internal'
E320_DEFAULT_ENABLE_GPS = True
-E320_DEFAULT_FPGPIO_VOLTAGE = 0
+E320_DEFAULT_ENABLE_FPGPIO = True
E320_FPGA_COMPAT = (3, 0)
E320_MONITOR_THREAD_INTERVAL = 1.0 # seconds # TODO Verify this
E320_DBOARD_SLOT_IDX = 0
@@ -264,9 +264,9 @@ class e320(ZynqComponents, PeriphManagerBase):
)
)
self.enable_fp_gpio(
- voltage=args.get(
- 'fp_gpio_voltage',
- E320_DEFAULT_FPGPIO_VOLTAGE
+ enable=args.get(
+ 'enable_fp_gpio',
+ E320_DEFAULT_ENABLE_FPGPIO
)
)
# Init clocking
@@ -560,19 +560,19 @@ class e320(ZynqComponents, PeriphManagerBase):
"""
self.mboard_regs_control.enable_gps(enable)
- def enable_fp_gpio(self, voltage):
+ def enable_fp_gpio(self, enable):
"""
Turn power to the front panel GPIO off or on and set voltage
- to (1.8, 2.5, 3.3V) and setting to 0 turns off GPIO.
+ to 3.3V.
"""
self.log.trace("{} power to front-panel GPIO".format(
- "Enabling" if voltage == 0 else "Disabling"
+ "Enabling" if enable else "Disabling"
))
- self.mboard_regs_control.enable_fp_gpio(voltage)
+ self.mboard_regs_control.enable_fp_gpio(enable)
def set_fp_gpio_voltage(self, value):
"""
- Set Front Panel GPIO voltage (1.8, 2.5 or 3.3 Volts)
+ Set Front Panel GPIO voltage (3.3 Volts)
"""
self.log.trace("Setting front-panel GPIO voltage to {:3.1f} V".format(value))
self.mboard_regs_control.set_fp_gpio_voltage(value)
diff --git a/mpm/python/usrp_mpm/periph_manager/e320_periphs.py b/mpm/python/usrp_mpm/periph_manager/e320_periphs.py
index eab96a483..4a5ee236a 100644
--- a/mpm/python/usrp_mpm/periph_manager/e320_periphs.py
+++ b/mpm/python/usrp_mpm/periph_manager/e320_periphs.py
@@ -8,6 +8,7 @@ E320 peripherals
"""
import datetime
+import math
from usrp_mpm.sys_utils.sysfs_gpio import SysFSGPIO, GPIOBank
from usrp_mpm.sys_utils.uio import UIO
@@ -120,16 +121,11 @@ class MboardRegsControl(object):
major = (compat_number>>16) & 0xff
return (major, minor)
- def enable_fp_gpio(self, value):
+ def enable_fp_gpio(self, enable):
""" Enable front panel GPIO buffers and power supply
- and set voltage 1.8, 2.5 or 3.3 V
- Setting value to 0 would disable gpio
+ and set voltage 3.3 V
"""
- if value == 0:
- enable = False
- else:
- enable = True
- self.set_fp_gpio_voltage(value)
+ self.set_fp_gpio_voltage(3.3)
mask = 0xFFFFFFFF ^ ((0b1 << self.MB_GPIO_CTRL_BUFFER_OE_N) | \
(0b1 << self.MB_GPIO_CTRL_EN_VAR_SUPPLY))
with self.regs:
@@ -147,14 +143,15 @@ class MboardRegsControl(object):
0 1 | 2.5 V
1 0 | 3.3 V
Arguments:
- value : 1.8, 2.5 or 3.3
+ value : 3.3
"""
- assert value in (1.8, 2.5, 3.3)
- if value == 1.8:
+ assert any([math.isclose(value, nn, abs_tol=0.1) for nn in (3.3,)]),\
+ "FP GPIO currently only supports 3.3V"
+ if math.isclose(value, 1.8, abs_tol=0.1):
voltage_reg = 0
- elif value == 2.5:
+ elif math.isclose(value, 2.5, abs_tol=0.1):
voltage_reg = 1
- elif value == 3.3:
+ elif math.isclose(value, 3.3, abs_tol=0.1):
voltage_reg = 2
mask = 0xFFFFFFFF ^ ((0b1 << self.MB_GPIO_CTRL_EN_3V3) | \
(0b1 << self.MB_GPIO_CTRL_EN_2V5))