diff options
author | Lars Amsel <lars.amsel@ni.com> | 2021-06-04 08:27:50 +0200 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-06-10 12:01:53 -0500 |
commit | 2a575bf9b5a4942f60e979161764b9e942699e1e (patch) | |
tree | 2f0535625c30025559ebd7494a4b9e7122550a73 /mpm/tools | |
parent | e17916220cc955fa219ae37f607626ba88c4afe3 (diff) | |
download | uhd-2a575bf9b5a4942f60e979161764b9e942699e1e.tar.gz uhd-2a575bf9b5a4942f60e979161764b9e942699e1e.tar.bz2 uhd-2a575bf9b5a4942f60e979161764b9e942699e1e.zip |
uhd: Add support for the USRP X410
Co-authored-by: Lars Amsel <lars.amsel@ni.com>
Co-authored-by: Michael Auchter <michael.auchter@ni.com>
Co-authored-by: Martin Braun <martin.braun@ettus.com>
Co-authored-by: Paul Butler <paul.butler@ni.com>
Co-authored-by: Cristina Fuentes <cristina.fuentes-curiel@ni.com>
Co-authored-by: Humberto Jimenez <humberto.jimenez@ni.com>
Co-authored-by: Virendra Kakade <virendra.kakade@ni.com>
Co-authored-by: Lane Kolbly <lane.kolbly@ni.com>
Co-authored-by: Max Köhler <max.koehler@ni.com>
Co-authored-by: Andrew Lynch <andrew.lynch@ni.com>
Co-authored-by: Grant Meyerhoff <grant.meyerhoff@ni.com>
Co-authored-by: Ciro Nishiguchi <ciro.nishiguchi@ni.com>
Co-authored-by: Thomas Vogel <thomas.vogel@ni.com>
Diffstat (limited to 'mpm/tools')
-rwxr-xr-x | mpm/tools/check-filesystem | 29 | ||||
-rw-r--r-- | mpm/tools/program_x4xx_clkaux_lmk05318.py | 90 | ||||
-rw-r--r-- | mpm/tools/tlv_eeprom/eeprom-pids.c | 4 | ||||
-rw-r--r-- | mpm/tools/x4xx_clkaux_lmk05318_regs_revB.txt | 334 |
4 files changed, 454 insertions, 3 deletions
diff --git a/mpm/tools/check-filesystem b/mpm/tools/check-filesystem index 1ceb7b993..37a69b858 100755 --- a/mpm/tools/check-filesystem +++ b/mpm/tools/check-filesystem @@ -9,6 +9,8 @@ import sys import traceback import unittest +from usrp_mpm.mpmlog import get_main_logger +from usrp_mpm.periph_manager.x4xx_periphs import MboardRegsControl from usrp_mpm.sys_utils.filesystem_status import * from usrp_mpm.sys_utils.dtoverlay import list_overlays from usrp_mpm.sys_utils.dtoverlay import list_available_overlays @@ -40,13 +42,16 @@ class SimpleResult(unittest.TextTestResult): % (flavour, self.getDescription(test), err)) class CheckFilesystem(unittest.TestCase): + mboard_regs_control = None + def _assert_filesystem_root_is_not_set(self): if self.args.filesystem_root != '/': raise ValueError("Changing the filesystem root is not possible for this test") def __init__(self, methodName='runTest', args=None): super(CheckFilesystem, self).__init__(methodName) - self.args=args + self.args = args + self.log = get_main_logger() def test_uhd_version(self): uhd_version = get_uhd_version(filesystem_root=self.args.filesystem_root) @@ -56,6 +61,25 @@ class CheckFilesystem(unittest.TestCase): uhd_version = get_uhd_version(filesystem_root=self.args.filesystem_root) self.assertIn(self.args.uhd_githash, uhd_version) + def test_fpga_type(self): + if self.mboard_regs_control is None: + self.mboard_regs_control = MboardRegsControl("mboard-regs", self.log) + fpga_type = self.mboard_regs_control.get_fpga_type() + self.assertEqual(fpga_type, self.args.fpga_type) + + def test_fpga_version(self): + if self.mboard_regs_control is None: + self.mboard_regs_control = MboardRegsControl("mboard-regs", self.log) + compat_number = self.mboard_regs_control.get_compat_number() + fpga_version = "{}.{}".format(*compat_number) + self.assertEqual(fpga_version, self.args.fpga_version) + + def test_fpga_githash(self): + if self.mboard_regs_control is None: + self.mboard_regs_control = MboardRegsControl("mboard-regs", self.log) + fpga_githash = "{:x}.{}".format(*self.mboard_regs_control.get_git_hash()) + self.assertEqual(fpga_githash, self.args.fpga_githash) + def test_mender_artifact(self): mender_artifact = get_mender_artifact(filesystem_root=self.args.filesystem_root) self.assertEqual(mender_artifact, self.args.mender_artifact) @@ -119,6 +143,9 @@ def args_parser(argv): parser = argparse.ArgumentParser() parser.add_argument("--uhd-version", help="Check UHD version") parser.add_argument("--uhd-githash", help="Check UHD githash") + parser.add_argument("--fpga-type", help="Check FPGA type") + parser.add_argument("--fpga-version", help="Check FPGA version") + parser.add_argument("--fpga-githash", help="Check FPGA githash") parser.add_argument("--mender-artifact", help="Check mender artifact") parser.add_argument("--fs-version", help="Check filesystem version string") parser.add_argument("--opkg-status-date", help="Check package management status file date") diff --git a/mpm/tools/program_x4xx_clkaux_lmk05318.py b/mpm/tools/program_x4xx_clkaux_lmk05318.py new file mode 100644 index 000000000..69222a14e --- /dev/null +++ b/mpm/tools/program_x4xx_clkaux_lmk05318.py @@ -0,0 +1,90 @@ +#!/usr/bin/python3 +""" +Script for programming lmk05318 on the clocking aux board +""" +# pylint: disable=no-member + +import time +import argparse +import re +from uhd.utils.mpmtools import MPMClient, MPM_RPC_PORT, InitMode + +DESCRIPTION_TEST = '''reads LMK register file generated by TICS Pro and writes via mpm_shell + the commands on the USRP given by the --host parameter.''' +parser = argparse.ArgumentParser(epilog=DESCRIPTION_TEST, + formatter_class=argparse.RawDescriptionHelpFormatter) +parser.add_argument('reg_file', help='LMK register config file') +parser.add_argument('--host', default="localhost", + help='USRP host to be programmed, usrp-hwd must run there') +parser.add_argument('-p', '--program_to_eeprom', action='store_true', + help='write config to eeprom, be careful, only 100 write-cycles are supported') +parser.add_argument('-v', '--verify_eeprom', action='store_true', + help='read config from eeprom and compares it to given reg_file') + +args = parser.parse_args() + +def parse_reg_file(file): + """ + Parse the register values from the provided register config file + """ + regfile_regex = re.compile(r"^R(\d*)\t(0x[0-9A-F]*)") + reg_dict = {} + for line in open(file, 'r').readlines(): + if regfile_regex.match(line): + [reg_str, reg_val] = line.strip().split('\t') + reg_val = reg_val.split('0x')[1] + reg_addr = reg_val[:4] + reg_data = reg_val[4:] + reg_dict[reg_str] = (hex(int(reg_addr, base=16)), hex(int(reg_data, base=16))) + return reg_dict + +mpm_c = MPMClient(InitMode.Claim, "localhost", MPM_RPC_PORT) + +# read the register file containing the actual values to be programmed +print("read register values from {}".format(args.reg_file)) +prog_regs = parse_reg_file(args.reg_file) + +print("start programming the LMK registers") +mpm_c.clkaux_set_nsync_lmk_power_en(1) +mpm_c.clkaux_set_nsync_tcxo_en(1) +if not mpm_c.clkaux_get_nsync_chip_id_valid(): + raise RuntimeError("chip ID of LMK is not valid, skip programming") +print('EEPROM has been programmed {} times'.format( + mpm_c.clkaux_get_nsync_lmk_eeprom_prog_cycles())) + +# now write the commands to program the LMK +for reg in prog_regs: + mpm_c.poke_clkaux(int(prog_regs[reg][0], 16), int(prog_regs[reg][1], 16)) + val = mpm_c.peek_clkaux(int(prog_regs[reg][0], 16)).lower() + if prog_regs[reg][1] != val: + print("warning, reg values are not as programmed: addr: {}, prog: {}, read: {}" + .format(prog_regs[reg][0], prog_regs[reg][1], val)) + +if args.program_to_eeprom: + print("programming register values into EEPROM") + print('EEPROM has been programmed {} times'.format( + mpm_c.clkaux_get_nsync_lmk_eeprom_prog_cycles())) + mpm_c.clkaux_write_nsync_lmk_cfg_regs_to_eeprom("register_commit") + mpm_c.clkaux_set_nsync_soft_reset(True) + mpm_c.clkaux_set_nsync_soft_reset(False) + mpm_c.clkaux_set_nsync_lmk_power_en(0) + print("programming of LMK done, chip is powered down") + +if args.verify_eeprom: + time.sleep(1) + VERIFY_OK = True + print("start verification of EEPROM, powering chip up") + mpm_c.clkaux_set_nsync_lmk_power_en(1) + mpm_c.clkaux_set_nsync_tcxo_en(1) + if not mpm_c.clkaux_get_nsync_chip_id_valid(): + raise RuntimeError("chip ID of LMK is not valid, skip verifying") + for reg in prog_regs: + val = mpm_c.peek_clkaux(int(prog_regs[reg][0], 16)).lower() + if str(prog_regs[reg][1]) != val: + VERIFY_OK = False + print("warning, reg values are not as programmed: addr: {}, prog: {}, read: {}" + .format(prog_regs[reg][0], prog_regs[reg][1], val)) + if VERIFY_OK: + print("SUCCESS: read back values are equal to programmed values") + else: + print("ERROR: EEPROM verification failed!") diff --git a/mpm/tools/tlv_eeprom/eeprom-pids.c b/mpm/tools/tlv_eeprom/eeprom-pids.c index d181133d7..b7d49f14d 100644 --- a/mpm/tools/tlv_eeprom/eeprom-pids.c +++ b/mpm/tools/tlv_eeprom/eeprom-pids.c @@ -8,10 +8,10 @@ #include <stddef.h> static struct pid_info pid_list[] = { - { 0x0410, "titanium", "X410 Motherboard", 0 }, + { 0x0410, "x410", "X410 Motherboard", 0 }, { 0x4000, NULL, "Power Aux Board", 0 }, { 0x4001, NULL, "Debug RF DB", 0 }, - { 0x4002, "zbx", "Zirconium RF DB", 0}, + { 0x4002, "zbx", "ZBX RF DB", 0}, { 0x4003, NULL, "HDMI SE DIO Aux Board", 0}, { 0x4004, NULL, "Clocking Aux Board with GPSDO", 0}, { 0x4005, NULL, "Clocking Aux Board (no GPSDO)", 0}, diff --git a/mpm/tools/x4xx_clkaux_lmk05318_regs_revB.txt b/mpm/tools/x4xx_clkaux_lmk05318_regs_revB.txt new file mode 100644 index 000000000..7a9a741d1 --- /dev/null +++ b/mpm/tools/x4xx_clkaux_lmk05318_regs_revB.txt @@ -0,0 +1,334 @@ +R0 0x000010 +R1 0x00010B +R2 0x000235 +R3 0x000311 +R4 0x000408 +R5 0x000516 +R6 0x000608 +R7 0x000700 +R8 0x000802 +R10 0x000AC8 +R11 0x000B00 +R12 0x000C3B +R13 0x000D08 +R14 0x000E00 +R15 0x000F00 +R16 0x001000 +R17 0x00111D +R18 0x0012FF +R19 0x001300 +R20 0x001400 +R21 0x001500 +R22 0x001600 +R23 0x001755 +R24 0x001855 +R25 0x001900 +R26 0x001A00 +R27 0x001B00 +R28 0x001C01 +R29 0x001D11 +R30 0x001E40 +R32 0x002044 +R35 0x002300 +R36 0x002403 +R37 0x002500 +R38 0x002600 +R39 0x002702 +R40 0x002800 +R41 0x002900 +R42 0x002A11 +R43 0x002B9B +R44 0x002C00 +R45 0x002D00 +R46 0x002E33 +R47 0x002F83 +R48 0x003050 +R49 0x003147 +R50 0x003218 +R51 0x003318 +R52 0x003400 +R53 0x0035F9 +R54 0x003618 +R55 0x003700 +R56 0x0038F9 +R57 0x003910 +R58 0x003A63 +R59 0x003B00 +R60 0x003C0F +R61 0x003D00 +R62 0x003E0F +R63 0x003F3B +R64 0x004095 +R65 0x004102 +R66 0x0042F8 +R67 0x0043FF +R68 0x004428 +R69 0x004500 +R70 0x004600 +R71 0x004700 +R72 0x00483F +R73 0x004900 +R74 0x004A00 +R75 0x004B00 +R76 0x004C00 +R77 0x004D0F +R78 0x004E00 +R79 0x004F11 +R80 0x005080 +R81 0x00510A +R82 0x005200 +R83 0x005305 +R84 0x0054DC +R85 0x005500 +R86 0x005600 +R87 0x00571E +R88 0x005884 +R89 0x005980 +R90 0x005A00 +R91 0x005B14 +R92 0x005C00 +R93 0x005D05 +R94 0x005EDC +R95 0x005F00 +R96 0x006000 +R97 0x00611E +R98 0x006284 +R99 0x006380 +R100 0x006429 +R101 0x006503 +R102 0x006611 +R103 0x00670F +R104 0x006818 +R105 0x006905 +R106 0x006A00 +R107 0x006B64 +R108 0x006C00 +R109 0x006D7D +R110 0x006E00 +R111 0x006F00 +R112 0x007000 +R113 0x007100 +R114 0x007200 +R115 0x007303 +R116 0x007401 +R117 0x007500 +R118 0x007600 +R119 0x007700 +R120 0x007800 +R121 0x007900 +R122 0x007A00 +R123 0x007B28 +R124 0x007C09 +R125 0x007DE5 +R126 0x007E35 +R127 0x007F2E +R128 0x008000 +R129 0x008106 +R130 0x008200 +R131 0x008301 +R132 0x008401 +R133 0x008577 +R134 0x008601 +R135 0x008713 +R136 0x008800 +R137 0x008900 +R138 0x008A00 +R139 0x008B03 +R140 0x008C02 +R141 0x008D00 +R142 0x008E01 +R143 0x008F01 +R144 0x009077 +R145 0x009101 +R146 0x009281 +R147 0x009320 +R149 0x00950D +R150 0x009600 +R151 0x009701 +R152 0x00980D +R153 0x009929 +R154 0x009A24 +R155 0x009B8B +R156 0x009C01 +R157 0x009D00 +R158 0x009E00 +R159 0x009F00 +R160 0x00A000 +R161 0x00A100 +R162 0x00A200 +R164 0x00A400 +R165 0x00A500 +R167 0x00A702 +R178 0x00B200 +R180 0x00B400 +R181 0x00B500 +R182 0x00B600 +R183 0x00B700 +R184 0x00B800 +R185 0x00B905 +R186 0x00BA01 +R187 0x00BB00 +R188 0x00BC00 +R189 0x00BD00 +R190 0x00BE01 +R191 0x00BF00 +R192 0x00C050 +R193 0x00C101 +R194 0x00C201 +R195 0x00C300 +R196 0x00C400 +R197 0x00C50D +R198 0x00C600 +R199 0x00C700 +R200 0x00C880 +R201 0x00C900 +R202 0x00CA00 +R203 0x00CB00 +R204 0x00CC07 +R205 0x00CD00 +R206 0x00CE00 +R207 0x00CF7A +R208 0x00D000 +R209 0x00D104 +R210 0x00D200 +R211 0x00D305 +R212 0x00D400 +R213 0x00D504 +R214 0x00D600 +R215 0x00D705 +R216 0x00D80F +R217 0x00D900 +R218 0x00DA01 +R219 0x00DB2C +R220 0x00DC00 +R221 0x00DD00 +R222 0x00DE03 +R223 0x00DF0D +R224 0x00E040 +R225 0x00E100 +R226 0x00E200 +R227 0x00E318 +R228 0x00E46A +R229 0x00E500 +R230 0x00E603 +R231 0x00E70D +R232 0x00E840 +R233 0x00E90A +R234 0x00EA07 +R235 0x00EB00 +R236 0x00EC00 +R237 0x00ED00 +R238 0x00EE00 +R239 0x00EF00 +R240 0x00F000 +R241 0x00F100 +R242 0x00F202 +R243 0x00F300 +R244 0x00F400 +R249 0x00F912 +R250 0x00FA00 +R251 0x00FB33 +R252 0x00FC29 +R253 0x00FD00 +R254 0x00FE00 +R255 0x00FF00 +R256 0x010006 +R257 0x010100 +R258 0x010200 +R259 0x01037D +R260 0x010402 +R261 0x010580 +R262 0x010600 +R263 0x010700 +R264 0x010800 +R265 0x0109F4 +R266 0x010A24 +R267 0x010BA0 +R268 0x010C0C +R269 0x010D00 +R270 0x010E03 +R271 0x010F7A +R272 0x01101F +R273 0x01111F +R274 0x01121F +R275 0x011313 +R276 0x011410 +R277 0x011513 +R278 0x011604 +R279 0x011708 +R280 0x011804 +R281 0x011902 +R282 0x011A07 +R283 0x011B02 +R284 0x011C1E +R285 0x011D1E +R286 0x011E02 +R287 0x011F6C +R288 0x012003 +R289 0x0121E7 +R290 0x012203 +R291 0x012325 +R292 0x012409 +R293 0x012501 +R294 0x012600 +R295 0x01272C +R296 0x012800 +R297 0x012906 +R298 0x012A00 +R299 0x012B01 +R300 0x012C00 +R301 0x012D17 +R302 0x012E1B +R303 0x012F00 +R304 0x013000 +R305 0x013100 +R306 0x013200 +R307 0x01331E +R308 0x013484 +R309 0x013580 +R310 0x013600 +R311 0x013700 +R312 0x013800 +R313 0x013900 +R314 0x013A00 +R315 0x013B00 +R316 0x013C00 +R317 0x013D00 +R318 0x013E00 +R319 0x013F03 +R320 0x014000 +R321 0x01410A +R322 0x014200 +R323 0x014300 +R324 0x014400 +R325 0x01459A +R326 0x014600 +R327 0x014703 +R328 0x01480F +R329 0x014949 +R330 0x014A00 +R331 0x014B14 +R332 0x014C00 +R333 0x014D00 +R334 0x014E00 +R335 0x014F9A +R336 0x015000 +R337 0x015103 +R338 0x01520F +R339 0x015349 +R340 0x015400 +R341 0x015500 +R342 0x015600 +R343 0x015700 +R344 0x015800 +R345 0x015900 +R346 0x015A02 +R347 0x015B00 +R348 0x015C00 +R349 0x015D00 +R350 0x015E00 +R351 0x015FB7 +R352 0x016000 +R357 0x016528 +R367 0x016F00 +R411 0x019B08 |