def run_test(args): uuts = [acq400_hapi.RAD3DDS(u) for u in args.uuts] for test in range(0, args.test): for uut in uuts: uut.s0.CONTINUOUS = '0' init_trigger(uut, dx=args.trigger_adc_dx) chirp_off(uut) if args.stop or args.chirps_per_sec == 0: break for uut in uuts: arm_uut(uut) for uut in uuts: init_dual_chirp(args, uut) if args.gps_sync > 1: ttime = time.time() + args.gps_sync for uut in uuts: # d5: PPS trigger is free running, select at on_trigger (aka during the second before uut.s2.trigger_at = "{} {}".format( '--trg=1,d5,rising' if args.trigger_adc_dx == 'd5' else '', ttime) time.sleep(args.gps_sync + 1) if not args.noverify: for uut in uuts: verify_chirp(uut, test)
def run_test(args): global FREQS_MHz global DBG DBG = args.debug uut = acq400_hapi.RAD3DDS(args.uut[0]) uut.s2.RADCELF_init = 1 init_clk(uut) set_upd_clk_fpga(uut, 0, '1') set_upd_clk_fpga(uut, 1, '1') for test in range(0, args.test): for f in FREQS_MHz: fA = f*1000000 fB = next_freq(f)*1000000 write_retry = 0 pass = False while not pass: if write_retry > 3: print("FAIL FAIL FAIL on write retry") break set_freq(uut, uut.ddsA, fA) set_freq(uut, uut.ddsB, fB) pass = verify_freq(uut, test, fA, fB) write_retry += 1
def run_main(): global KP parser = argparse.ArgumentParser("radcelf-tune-pps [fclk]") parser.add_argument('--best', default=True, help="select BEST clock for PPS sync") parser.add_argument('--fine', default=False, help="fine tune, runs forever") parser.add_argument('--Kp', default=0.05, type=float, help="Kp, proportional control constant" ) parser.add_argument('fclk', nargs='*', default=[25000000], type=int, help="required clock frequency") args = parser.parse_args() fclk = args.fclk[0] KP = args.Kp message = "radcelf-tune-pps" if args.best: fbest =acq400_hapi.RAD3DDS.best_clock_pps_sync(fclk) if fbest != args.fclk: m2 = "Selected BEST clock {} => {}".format(fclk, fbest) print(m2) message = "{}\n{}".format(message, m2) fclk = fbest else: fclk = fclk args.fclk = fclk args.uut = acq400_hapi.RAD3DDS("localhost") web_message(message) if not args.fine: init(args) print("Starting Tuning") radcelf_tune(args)
def run_test(args): uut = acq400_hapi.RAD3DDS(args.uut[0]) for test in range(0, args.test): uut.s2.RADCELF_init = 1 init_chirp(uut, 0) init_chirp(uut, 1) verify_chirp(uut, test)
def run_test(args): global FREQS_MHz global DBG DBG = args.debug uut = acq400_hapi.RAD3DDS(args.uut[0]) uut.s2.RADCELF_init = 1 init_clk(uut) set_upd_clk_fpga(uut, 0, '1') set_upd_clk_fpga(uut, 1, '1') for test in range(0, args.test): for f in FREQS_MHz: fA = f * 1000000 fB = next_freq(f) * 1000000 set_freq(uut, uut.ddsA, fA) set_freq(uut, uut.ddsB, fB) verify_freq(uut, test, fA, fB)
def run_test(args): uuts = [acq400_hapi.RAD3DDS(u) for u in args.uuts] for test in range(0, args.test): for uut in uuts: chirp_off(uut) if args.chirps_per_sec == 0: break for uut in uuts: init_dual_chirp(args, uut) if args.gps_sync > 1: ttime = time.time() + args.gps_sync for uut in uuts: uut.s2.trigger_at = ttime time.sleep(args.gps_sync + 1) if not args.noverify: for uut in uuts: verify_chirp(uut, test)
uses error from m1, m10, m100 for proportional control KPROP=0.05 : 0.5 was unstable. Must be some error in my calcs, but this does converge well ''' import sys import acq400_hapi from acq400_hapi import AD9854 import argparse import time from builtins import int TARGET = 25000000.00 KP = 0.05 uut = acq400_hapi.RAD3DDS("localhost") time.sleep(50) def control(prop_err, KPL): ftw1 = uut.ddsC.FTW1 xx = AD9854.ftw2ratio(ftw1) yy = xx - prop_err * KPL ftw1_yy = AD9854.ratio2ftw(yy) print("XX:{} ratio:{} - err:{} * KP:{} => yy:{} YY:{}".format( ftw1, xx, prop_err, KPL, yy, ftw1_yy)) uut.s2.ddsC_upd_clk_fpga = '1' uut.ddsC.FTW1 = ftw1_yy uut.s2.ddsC_upd_clk_fpga = '0'