Ejemplo n.º 1
0
def main():
    global args
    global logger
    global dbbc3

    args = parseCommandLine()

    logger = logging.getLogger("samplerSync")
    logger.setLevel(logging.DEBUG)
    # create file handler
    fh = logging.FileHandler("samplerSync_%s.log" %
                             (datetime.now().strftime("%Y%m%d_%H%M%S")))
    # create console handler
    ch = logging.StreamHandler()
    # create formatter and add it to the handlers
    formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
    fh.setFormatter(formatter)
    ch.setFormatter(formatter)
    # add the handlers to the logger
    logger.addHandler(fh)
    logger.addHandler(ch)

    try:

        logger.debug("=== Trying to connect to %s:%d" %
                     (args.ipaddress, args.port))
        dbbc3 = DBBC3(host=args.ipaddress,
                      port=args.port,
                      mode=args.mode,
                      version=args.ver)

        logger.info("=== Connected to %s:%d" % (args.ipaddress, args.port))
        logger.info("=== Parameters: {}".format(args))

        #useBoards = []
        #if args.boards:
        #    for board in args.boards:
        #        useBoards.append(dbbc3.boardToDigit(board))
        #else:
        #    for board in range(args.num_coreboards):
        #        useBoards.append(dbbc3.boardToDigit(board))

        count = 1
        logger.info("checking if samplers are in sync")
        while (dbbc3.checkphase() == False):
            if (args.verbose):
                logger.debug("Response: %s" % dbbc3.lastResponse)
            logger.info("checkphase: failed. Attempt %d" % count)
            logger.info("resetting samplers")
            dbbc3.adb3l_reseth()
            count += 1

        logger.info("sync OK")
        dbbc3.disconnect()
        logger.info("=== Done")

    except Exception as e:
        print("ERROR: ", e.message)
        traceback.print_exc(file=sys.stdout)

    finally:
        if (dbbc3):
            dbbc3.disconnect()
Ejemplo n.º 2
0
        parser = argparse.ArgumentParser(description="Setup and validate DBBC3 in OCT_D mode")

        parser.add_argument("-p", "--port", default=4000, type=int, help="The port of the control software socket (default: 4000)")
        parser.add_argument("-n", "--num-coreboards",  type=int, help="The number of activated core boards in the DBBC3 (default 8)")
        parser.add_argument("-b", "--boards", dest='boards', type=lambda s: list(map(str, s.split(","))), help="A comma separated list of core boards to be used for setup and validation. Can be specified as 0,1 or A,B,.. (default: use all activated core boards)")
        parser.add_argument("--use-version", dest='ver', default= "", help="The software version of the DBBC3 DDC_V mode to use. Will assume the latest release version if not specified")
        parser.add_argument("--ignore-errors", dest='ignoreErrors',default=False, action='store_true', help="Ignore any errors and continue with the validation")
        parser.add_argument('ipaddress',  help="the IP address of the DBBC3 running the control software")
        parser.add_argument("-m", "--mode", required=False, default="OCT_D", help="The current DBBC3 mode (default: %(default)s)")

        args = parser.parse_args()

        try:

                print ("===Trying to connect to %s:%d" % (args.ipaddress, args.port))
                dbbc3 = DBBC3(host=args.ipaddress, port=args.port, mode=args.mode)
                print ("===Connected")

                ver = dbbc3.version()
                print ("=== DBBC3 is running: mode=%s version=%s(%s)" % (ver['mode'], ver['majorVersion'], ver['minorVersion']))

                #val = DBBC3Validation(dbbc3, ignoreErrors=args.ignoreErrors)
                val = ValidationFactory().create(dbbc3, args.ignoreErrors)
                #val = valFactory.create(dbbc3, args.ignoreErrors)

                print ("=== Disabling calibration loop")
                dbbc3.disableloop()

                useBoards = []
                if args.boards:
                    for board in args.boards:
Ejemplo n.º 3
0
        self.dbbc3.sendCommand("core3hstats=1")

        if not self.dbbc3.lastResponse.startswith("Control loop not running"):
            report.add(Item(Item.INFO, check, "The calibration loop is running", "", Item.OK))
        else:
            report.add(Item(Item.ERROR, check,"The calibration loop is not running", "", Item.FAIL, exit=exitOnError))
        

if __name__ == "__main__":

        try:
                from dbbc3.DBBC3 import DBBC3
                from dbbc3.DBBC3Validation import DBBC3Validation
                import logging

                dbbc3 = DBBC3(host=sys.argv[1], port=4000, mode="DDC_U", timeout=900)

                val = DBBC3Validation(dbbc3, ignoreErrors = True)

                logger = logging.getLogger("test")
                logger.setLevel(logging.DEBUG)
                # create console handler
                ch = logging.StreamHandler()
                # create formatter and add it to the handlers
                scnformatter = logging.Formatter('%(message)s')
                ch.setFormatter(scnformatter)
                #ch.emit = decorate_emit(ch.emit)
                # add the handlers to the logger
                logger.addHandler(ch)

                res = val.validateIFLevel(0)
Ejemplo n.º 4
0
def main():
    global args
    global logger
    global dbbc3
    global resetAdb
    global resetPPS

    args = parseCommandLine()

    logger = logging.getLogger("monitorStability")
    logger.setLevel(logging.DEBUG)
    # create file handler
    fh = logging.FileHandler(
        "stability_%s_%s.log" %
        (args.mode, datetime.now().strftime("%Y%m%d_%H%M%S")))
    # create console handler
    ch = logging.StreamHandler()
    # create formatter and add it to the handlers
    formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
    fh.setFormatter(formatter)
    ch.setFormatter(formatter)
    # add the handlers to the logger
    logger.addHandler(fh)
    logger.addHandler(ch)

    try:

        logger.debug("=== Trying to connect to %s:%d" %
                     (args.ipaddress, args.port))
        dbbc3 = DBBC3(host=args.ipaddress,
                      port=args.port,
                      mode=args.mode,
                      numBoards=args.num_coreboards,
                      version=args.ver)
        #val = DBBC3Validation(dbbc3, ignoreErrors=args.ignore_errors)

        logger.info("=== Connected to %s:%d" % (args.ipaddress, args.port))
        logger.info("=== Description: %s" % (args.description))
        logger.info("=== Parameters: {}".format(args))

        useBoards = []
        if args.boards:
            for board in args.boards:
                useBoards.append(dbbc3.boardToDigit(board))
        else:
            for board in range(args.num_coreboards):
                useBoards.append(dbbc3.boardToDigit(board))

        testPPS = False
        testSamplers = True

        if (args.mode.startswith("DDC")):
            testPPS = True

        # do initial pps synchronization
        if (testPPS):
            dbbc3.pps_sync()

        #enable  calibration loop
        dbbc3.enableloop()

        reloadStart = datetime.now()

        while 1:
            line = ""
            resetPPS = False
            resetAdb = False

            samplerState = []

            # check for firmware reload
            if (args.reloadInterval):
                if ((datetime.now() - reloadStart).total_seconds() >
                        args.reloadInterval):
                    logger.info("reloading firmware (currently disabled)")
                    reloadStart = datetime.now()
                    #dbbc3.reconfigure()

            if (testSamplers):
                testSamplerSync(useBoards)

            if (testPPS):
                testPPSSync(useBoards)

            if (resetAdb):
                if (args.onSamplerError):
                    resetADB3L()
                    resetPPS = True

                resetAdb = False

            if (resetPPS):
                resetPPSSync()
                resetPPS = False

            sleep(args.interval)

        dbbc3.disconnect()
        logger.info("=== Done")

    except Exception as e:
        print("ERROR: ", e.message)
        traceback.print_exc(file=sys.stdout)

    finally:
        if (dbbc3):
            dbbc3.disconnect()
Ejemplo n.º 5
0
        help=
        "Exectute the given command(s). If this option is specified  multiple times the commands will be processed in the order they appear on the command line."
    )
    parser.add_argument(
        'ipaddress',
        help="the IP address of the DBBC3 running the control software")

    args = parser.parse_args()

    #prompt = Prompt(None, [0,1,2,3])
    #prompt.cmdloop()

    try:

        print("===Trying to connect to %s:%d" % (args.ipaddress, args.port))
        dbbc3 = DBBC3(host=args.ipaddress, port=args.port)
        print("===Connected")

        ver = dbbc3.version()
        print("=== DBBC3 is running: mode=%s version=%s(%s)" %
              (ver['mode'], ver['majorVersion'], ver['minorVersion']))

        valFactory = ValidationFactory()
        val = valFactory.create(dbbc3, True)
        #val = DBBC3Validation(dbbc3, ignoreErrors=True)

        # for OCT mode disable the calibration loop to speed up processing
        if (dbbc3.config.mode.startswith("OCT")):
            dbbc3.disableloop()

        useBoards = []
Ejemplo n.º 6
0
def main():
    global args
    global logger
    global dbbc3
    global resetAdb
    global resetPPS
    global val

    args = parseCommandLine()

    logger = logging.getLogger("monitorStability")
    logger.setLevel(logging.DEBUG)
    # create file handler
    fh = logging.FileHandler("testStabilityOCT_%s.log" %
                             (datetime.now().strftime("%Y%m%d_%H%M%S")))
    # create console handler
    ch = logging.StreamHandler()
    # create formatter and add it to the handlers
    formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
    fh.setFormatter(formatter)
    ch.setFormatter(formatter)
    # add the handlers to the logger
    logger.addHandler(fh)
    logger.addHandler(ch)

    try:

        logger.debug("=== Trying to connect to %s:%d" %
                     (args.ipaddress, args.port))
        dbbc3 = DBBC3(host=args.ipaddress,
                      port=args.port,
                      mode="OCT_D",
                      numBoards=args.num_coreboards,
                      timeout=1200)
    except Exception as e:
        print("ERROR: ", e.message)

    logger.info("=== Connected to %s:%d" % (args.ipaddress, args.port))
    logger.info("=== Description: %s" % (args.description))
    logger.info("=== Parameters: {}".format(args))

    useBoards = []
    if args.boards:
        for board in args.boards:
            useBoards.append(dbbc3.boardToDigit(board))
    else:
        for board in range(args.num_coreboards):
            useBoards.append(dbbc3.boardToDigit(board))

    val = MyValidation(dbbc3, logger, ignoreErrors=True)
    count = 1
    while True:

        try:
            dbbc3.disableloop()
            ver = dbbc3.version()
            logger.info(
                "=== DBBC3 is running: mode=%s version=%s(%s)" %
                (ver['mode'], ver['majorVersion'], ver['minorVersion']))

            logger.info("=== Starting loop %d (errors=%d warnings=%d)" %
                        (count, val.errorCount, val.warnCount))
            #logger.info("=== Checking stability of IF power")
            #for i in range(20):
            #    logger.info("dbbcifa : " + str(dbbc3.dbbcif(0)))
            #    logger.info("dbbcifb : " + str(dbbc3.dbbcif(1)))
            #    logger.info("dbbcifc : " + str(dbbc3.dbbcif(2)))
            #    logger.info("dbbcifd : " + str(dbbc3.dbbcif(3)))
            #    sleep(1)

            for board in useBoards:
                val.validateSynthesizerLock(board)
                val.validateSynthesizerFreq(board)
                val.validateIFLevel(board)
                val.validateSamplerPower(board)
                val.validateSamplerOffsets(board)
                logger.info("=== Sampler delays {}".format(
                    dbbc3.core3h_core3_corr(board)))

            logger.info("=== Checking sampler phase synchronization")
            val.validateSamplerPhases()

            loopFilters = 1
            #loopFilters = 0

            for i in range(loopFilters):
                for board in useBoards:
                    logger.info("=== Loading tap filters for board " +
                                str(board + 1))
                    dbbc3.tap(board + 1, "2000-4000_floating.flt")
                    dbbc3.tap2(board + 1, "0-2000_floating.flt")
    #
                logger.info("=== Setting up calibration loop")
                dbbc3.enablecal()
                logger.info("=== Enabling calibration loop")
                dbbc3.enableloop()

                logger.info(
                    "=== Waiting for 2 minutes to allow adjusting the power levels"
                )
                sleep(120)

                logger.info("=== Disabling calibration loop")
                dbbc3.disableloop()

                logger.info(
                    "=== Now re-checking the bit statistics (should be proper 2-bit)"
                )
                for board in useBoards:
                    val.validateBitStatistics(board)
#
            logger.info("=== Checking stability of IF power")
            for i in range(10):
                logger.info("dbbcifa : " + str(dbbc3.dbbcif(0)))
                logger.info("dbbcifb : " + str(dbbc3.dbbcif(1)))
                logger.info("dbbcifc : " + str(dbbc3.dbbcif(2)))
                logger.info("dbbcifd : " + str(dbbc3.dbbcif(3)))
                sleep(1)


#
            if (not args.skipReload):
                logger.info("=== Reloading firmware")
                dbbc3.reconfigure()

            count += 1
        except Exception as e:

            # make compatible with python 2 and 3
            if hasattr(e, 'message'):
                print(e.message)
            else:
                print(e)
            pass

    sys.exit()
Ejemplo n.º 7
0
    'ipaddress',
    help="the IP address of the DBBC3 running the control software")

args = parser.parse_args()
log = None

try:

    config = DBBC3Config()

    config.numCoreBoards = args.num_coreboards

    config.host = args.ipaddress
    config.port = args.port

    dbbc3 = DBBC3(config, mode="DDC_V", version=args.ver)
    val = DBBC3Validation(dbbc3, ignoreErrors=args.ignore_errors)

    print("===Trying to connect to %s:%d" % (config.host, config.port))
    dbbc3.connect()
    print("===Connected")

    useBoards = []
    if args.boards:
        for board in args.boards:
            useBoards.append(dbbc3.boardToDigit(board))
    else:
        for board in range(args.num_coreboards):
            useBoards.append(dbbc3.boardToDigit(board))

    log = open("dbbc3.ppsdelays", "w")