def script(self): #self.TestProcedure.ICD.writePrbFpga(0x1002, 0x12) ##d. Read FPGA address 0x3000 and verify the response is 0x12. val = self.TestProcedure.ICD.readPrbFpga(0x3000) self.verify("FPGA 0x3000", 0x12, val) if val != 0x12: self.verify("ERROR", 0x12, val) #32-42 1 degree steps, 27-17 5 degree steps temperatures = [32,33,34,35,36,37,38,39,40,41,42,27,22,17] stabilization_mins = 10 chamber = watlowF4ipy.WatlowF4_temp_window(3,debug=True) for temperature in temperatures: chamber.set_temperature_and_time(temperature,temperature-0.3, temperature+0.3,stabilization_mins) while chamber.dwelltime_endpoint_reached() == False: #pause before checking the flag again time.sleep(2) # calibrate once on channel 0 self.TestProcedure.ICD.calibrateCc1020() self.DumpCalResult() inv_flag = 0x01 DoCalFlag = 0x01 MaxCalTries = 0x03 ExitDelaySecs = 0x01 # Scan and link on Channel 0, with data inversion active # Initialize the CC1000 Calibration Config Table self.TestProcedure.ICD.writePrbFpga(0x1026, 0x00) devList = self.icdcmd.scan(17, 2) print "type(devList):",type(devList) self.icdcmd.connect((UInt32) (2100146)) time.sleep(1) # Initialize the Cal config table self.initCalConfigTable() self.writeCalConfigTable(0) # Write the test control table self.writeCalControlTable(DoCalFlag, MaxCalTries, ExitDelaySecs) # Load the CCTestPatch firmware image to S-ICD RAM # self.writeCCTestPatch() # Start the test, the test patch will wait 10 seconds to allow for a break link self.icdcmd.writeUint16(Key.INT_VEC_TCMP0, 0x6A08) # break link with the S-ICD wfdeState = WaitForDisconnectedEventState(Key.DONT_CARE, 0x0) try: self.icdcmd.EventWaiter.execState(wfdeState, TimeSpan.FromSeconds(2)) except Exception, ex: print str(ex) time.sleep(20.0) # Loop through all candidate frequencies and calibrate for index in range(0, self.loop_count): test_time = time.clock() print "Loop Index = ", index print "Test time = %.2d:%06.3f"%(test_time/60,test_time%60.0) if index%8 == 0: print "Candidate Frequency = 402.8183MHz, LSI" elif index%8 == 1: print "Candidate Frequency = 403.5108MHz, HSI" elif index%8 == 2: print "Candi4ate Frequency = 402.4942MHz, LSI" elif index%8 == 3: print "Candidate Frequency = 404.6167MHz, HSI" elif index%8 == 4: print "Candidate Frequency = 402.7209MHz, HSI" elif index%8 == 5: print "Candidate Frequency = 402.4049MHz, HSI" elif index%8 == 6: print "Candidate Frequency = 404.5197MHz, LSI" elif index%8 == 7: print "Candidate Frequency = 402.7049MHz, LSI" # get initial frequency values for channel 0 val_2 = 0x35 #self.TestProcedure.ICD.readPrbFpga(0x305E) val_1 = 0xF0 #self.TestProcedure.ICD.readPrbFpga(0x3060) val_0 = 0x21 #self.TestProcedure.ICD.readPrbFpga(0x3062) freq_a_init = val_2*65536 + val_1*256 + val_0 print " PRB FREQ_A = ",freq_a_init val_2 = 0x35 #self.TestProcedure.ICD.readPrbFpga(0x3066) val_1 = 0xFA #self.TestProcedure.ICD.readPrbFpga(0x3068) val_0 = 0xCB #self.TestProcedure.ICD.readPrbFpga(0x306A) freq_b_init = val_2*65536 + val_1*256 + val_0 print " PRB FREQ_B = ",freq_b_init # Scan and link on Channel 0, with data inversion active self.TestProcedure.ICD.writePrbFpga(0x1026, 0x00) devList = self.icdcmd.scan(17, 2) print " type(devList):",type(devList) print " devList ",devList self.TestProcedure.ICD.writePrbFpga(0x3012, inv_flag) val = self.TestProcedure.ICD.readPrbFpga(0x1026) print " Channel Selection = ",val val = self.TestProcedure.ICD.readPrbFpga(0x3012) print " Data inversion = ",val self.icdcmd.connect((UInt32) (2100146)) time.sleep(1) # Read CC1020 AFC register and verify correction logic val_0 = 0 val_1 = 0 for iter in range(0, 10): val_0 = self.TestProcedure.ICD.readCC1020(int(CC1020Register.AFC)) if val_0 > 127: val_0 = val_0 - 256 print " PRB AFC = ",val_0 val_1 = val_1 + val_0 print " PRB Average AFC = ",val_1/10.0 # val_2 = self.TestProcedure.ICD.readCC1020(int(CC1020Register.FREQ_2A)) val_1 = self.TestProcedure.ICD.readCC1020(int(CC1020Register.FREQ_1A)) val_0 = self.TestProcedure.ICD.readCC1020(int(CC1020Register.FREQ_0A)) freq_a = val_2*65536 + val_1*256 + val_0 print " PRB FREQ_A = ",freq_a val_2 = self.TestProcedure.ICD.readCC1020(int(CC1020Register.FREQ_2B)) val_1 = self.TestProcedure.ICD.readCC1020(int(CC1020Register.FREQ_1B)) val_0 = self.TestProcedure.ICD.readCC1020(int(CC1020Register.FREQ_0B)) freq_b = val_2*65536 + val_1*256 + val_0 print " PRB FREQ_B = ",freq_b # compute frequency offset val = (freq_a -1)/2 - (freq_a_init-1)/2 print " PRB AFC_A = ",val val = (freq_b -1)/2 - (freq_b_init-1)/2 print " PRB AFC_B = ",val # set the filter to widest bandwidth to get an unsaturated RSSI val = self.TestProcedure.ICD.readCC1020(int(CC1020Register.FILTER)) print " PRB CC1020 FILTER = ", val self.TestProcedure.ICD.writeCC1020(int(CC1020Register.FILTER), 0x80) time.sleep(0.080) # read RSSI 10 times and compute the average val_0 = 0 val_1 = 0 for iter in range(0, 10): val_0 = self.TestProcedure.ICD.readCC1020(int(CC1020Register.RSSI)) print " PRB RSSI = ",val_0 val_1 = val_1 + val_0 print " PRB Average RSSI = ",val_1/10.0 # restore the filter setting self.TestProcedure.ICD.writeCC1020(int(CC1020Register.FILTER), 0x22) time.sleep(0.080) # Dump the Tx/Rx cal results self.DumpSicdCalResults() # Write the calibration configuration table for a specific frequency self.writeCalConfigTable(index+1) self.icdcmd.ping() # Start the test, the test patch will wait 10 seconds to allow for a break link self.icdcmd.writeUint16(Key.INT_VEC_TCMP0, 0x6A08) # break link with the S-ICD wfdeState = WaitForDisconnectedEventState(Key.DONT_CARE, 0x0) try: self.icdcmd.EventWaiter.execState(wfdeState, TimeSpan.FromSeconds(2)) except Exception, ex: print str(ex) time.sleep(20.0)
def script(self): # Read FPGA address 0x3000 and verify the response is 0x12. val = self.TestProcedure.ICD.readPrbFpga(0x3000) self.verify("FPGA 0x3000", 0x12, val) if val != 0x12: self.verify("ERROR", 0x12, val) sg=sig_gen("GPIB::18",'SIG_GEN') # read the MATCH value from EEPROM and write to the PRB #need to add read here... # write the legacy frequency to PRB channel 0 registers self.TestProcedure.ICD.writePrbFpga(0x3024, 0x35) self.TestProcedure.ICD.writePrbFpga(0x3026, 0xF0) self.TestProcedure.ICD.writePrbFpga(0x3028, 0x21) self.TestProcedure.ICD.writePrbFpga(0x302C, 0x35) self.TestProcedure.ICD.writePrbFpga(0x302E, 0xFA) self.TestProcedure.ICD.writePrbFpga(0x3030, 0xCB) # calibrate once on channel 0 self.TestProcedure.ICD.calibrateCc1020() time.sleep(0.300) val = self.TestProcedure.ICD.readPrbFpga(0x2012) print " PRB badCal = ", val val = self.TestProcedure.ICD.readCC1020(int(CC1020Register.STATUS)) print " PRB STATUS register = ", val self.DumpCalResult() # log the filter setting val = self.TestProcedure.ICD.readCC1020(int(CC1020Register.FILTER)) print " CC1020 FILTER = ", val time.sleep(0.080) #45-5 5 degree steps temperatures = range(45,4,-5) stabilization_mins = 10 chamber = watlowF4ipy.WatlowF4_temp_window(3,debug=True) for temperature in temperatures: chamber.set_temperature_and_time(temperature,temperature-0.3, temperature+0.3,stabilization_mins) while chamber.dwelltime_endpoint_reached() == False: #pause before checking the flag again time.sleep(2) for index in range(0, self.loop_count): test_time = time.clock() print "Loop Index = ", index print "Test time = %.2d:%06.3f"%(test_time/60,test_time%60.0) if index%9 == 0: print "Candidate Frequency = 402.8183MHz, LSI" sg.set_output_frequency(402818300) elif index%9 == 1: print "Candidate Frequency = 403.5108MHz, HSI" sg.set_output_frequency(403510800) elif index%9 == 2: print "Candidate Frequency = 402.4942MHz, LSI" sg.set_output_frequency(402494200) elif index%9 == 3: print "Candidate Frequency = 404.6167MHz, HSI" sg.set_output_frequency(404616700) elif index%9 == 4: print "Candidate Frequency = 402.7209MHz, HSI" sg.set_output_frequency(402720900) elif index%9 == 5: print "Candidate Frequency = 402.4049MHz, HSI" sg.set_output_frequency(402404900) elif index%9 == 6: print "Candidate Frequency = 404.5197MHz, LSI" sg.set_output_frequency(404519700) elif index%9 == 7: print "Candidate Frequency = 402.7049MHz, LSI" sg.set_output_frequency(402704900) else: print "Candidate Frequency = 403.5108MHz, HSI" sg.set_output_frequency(403510800) # write the candidate frequency to CC1020 registers self.writeFreqToCC1020(index) sg.output_on() for pwr in range(0, 13): if pwr == 0: print " RF Generator = -55dBm" sg.set_output_power_dBm(-55) elif pwr == 1: print " RF Generator = -60dBm" sg.set_output_power_dBm(-60) elif pwr == 2: print " RF Generator = -65dBm" sg.set_output_power_dBm(-65) elif pwr == 3: print " RF Generator = -70dBm" sg.set_output_power_dBm(-70) elif pwr == 4: print " RF Generator = -75dBm" sg.set_output_power_dBm(-75) elif pwr == 5: print " RF Generator = -80dBm" sg.set_output_power_dBm(-80) elif pwr == 6: print " RF Generator = -85dBm" sg.set_output_power_dBm(-85) elif pwr == 7: print " RF Generator = -90" sg.set_output_power_dBm(-90) elif pwr == 8: print " RF Generator = -95" sg.set_output_power_dBm(-95) elif pwr == 9: print " RF Generator = -100" sg.set_output_power_dBm(-100) elif pwr == 10: print " RF Generator = -105" sg.set_output_power_dBm(-105) elif pwr == 11: print " RF Generator = -110" sg.set_output_power_dBm(-110) else: print " RF Generator = -115" sg.set_output_power_dBm(-115) time.sleep(5) # place the CC1020 into receive mode self.TestProcedure.ICD.writeCC1020(int(CC1020Register.MAIN), 0x01) time.sleep(0.080) val = self.TestProcedure.ICD.readCC1020(int(CC1020Register.STATUS)) print " PRB STATUS register = ", val # read RSSI 10 times and compute the average val_0 = 0 val_1 = 0 for iter in range(0, 10): val_0 = self.TestProcedure.ICD.readCC1020(int(CC1020Register.RSSI)) print " CC1020 RSSI = ",val_0 val_1 = val_1 + val_0 print " CC1020 Average RSSI = ",val_1/10.0 # place the CC1020 into standby mode self.TestProcedure.ICD.writeCC1020(int(CC1020Register.MAIN), 0x1F) time.sleep(0.080) sg.output_off() self.passed = True
def script(self): #self.TestProcedure.ICD.writePrbFpga(0x1002, 0x12) ##d. Read FPGA address 0x3000 and verify the response is 0x12. val = self.TestProcedure.ICD.readPrbFpga(0x3000) self.verify("FPGA 0x3000", 0x12, val) if val != 0x12: self.verify("ERROR", 0x12, val) #*********instrument setup*************************************** print "Creating instrument..." sa = spec_anal("GPIB::8", 'SPEC_ANAL') #**************************************************************** # temperatures = range(32,44) temperatures = [27, 32, 37, 42] stabilization_mins = 10 chamber = watlowF4ipy.WatlowF4_temp_window(3, debug=True) for temperature in temperatures: chamber.set_temperature_and_time(temperature, temperature - 0.3, temperature + 0.3, stabilization_mins) while chamber.dwelltime_endpoint_reached() == False: #pause before checking the flag again time.sleep(2) # calibrate once on channel 0 self.TestProcedure.ICD.calibrateCc1020() self.DumpCalResult() inv_flag = 0x01 DoCalFlag = 0x01 MaxCalTries = 0x03 ExitDelaySecs = 0x01 # Scan and link on Channel 0, with data inversion active # Initialize the CC1000 Calibration Config Table self.TestProcedure.ICD.writePrbFpga(0x1026, 0x00) devList = self.icdcmd.scan(17, 2) print "type(devList):", type(devList) self.icdcmd.connect((UInt32)(2102003)) # self.icdcmd.connect((UInt32) (2100130)) # self.icdcmd.connect((UInt32) (2149582066)) time.sleep(1) # Initialize the Cal config table self.initCalConfigTable() # Write the test control table self.writeCalControlTable(DoCalFlag, MaxCalTries, ExitDelaySecs) # Load the CCTestPatch firmware image to S-ICD RAM # self.writeCCTestPatch() # Write the calibration configuration table for a specific frequency self.writeCalConfigTable(1) self.icdcmd.ping() # Start the test, the test patch will wait 10 seconds to allow for a break link self.icdcmd.writeUint16(Key.INT_VEC_TCMP0, 0x6A08) # break link with the S-ICD wfdeState = WaitForDisconnectedEventState(Key.DONT_CARE, 0x0) try: self.icdcmd.EventWaiter.execState(wfdeState, TimeSpan.FromSeconds(2)) except Exception, ex: print str(ex) print "Calibrating..." time.sleep(10) sa.set_ref_level_dB(-30) sa.set_span_kHz(100000) sa.set_resolutionBW_kHz(10) sa.set_sweep_time_milliseconds(2000) DoCalFlag = 0x00 MaxCalTries = 0x03 ExitDelaySecs = 0x1E vco_loop_count = 2 # Loop through all candidate frequencies and calibrate for idx in range(0, vco_loop_count): test_time = time.clock() print "Loop Index = ", idx print "Test time = %.2d:%06.3f" % (test_time / 60, test_time % 60.0) if idx == 0: sa.set_center_frequency_MHz(360) else: sa.set_center_frequency_MHz(440) # get initial frequency values for channel 0 val_2 = 0x35 #self.TestProcedure.ICD.readPrbFpga(0x305E) val_1 = 0xF0 #self.TestProcedure.ICD.readPrbFpga(0x3060) val_0 = 0x21 #self.TestProcedure.ICD.readPrbFpga(0x3062) freq_a_init = val_2 * 65536 + val_1 * 256 + val_0 print "PRB FREQ_A = ", freq_a_init val_2 = 0x35 #self.TestProcedure.ICD.readPrbFpga(0x3066) val_1 = 0xFA #self.TestProcedure.ICD.readPrbFpga(0x3068) val_0 = 0xCB #self.TestProcedure.ICD.readPrbFpga(0x306A) freq_b_init = val_2 * 65536 + val_1 * 256 + val_0 print "PRB FREQ_B = ", freq_b_init # Scan and link on Channel 0, with data inversion active self.TestProcedure.ICD.writePrbFpga(0x1026, 0x00) devList = self.icdcmd.scan(17, 2) print "type(devList):", type(devList) print "devList ", devList self.TestProcedure.ICD.writePrbFpga(0x3012, inv_flag) val = self.TestProcedure.ICD.readPrbFpga(0x1026) print "Channel Selection = ", val val = self.TestProcedure.ICD.readPrbFpga(0x3012) print "Data inversion = ", val self.icdcmd.connect((UInt32)(2102003)) # self.icdcmd.connect((UInt32) (2100130)) # self.icdcmd.connect((UInt32) (2149582066)) time.sleep(1) # Read CC1020 AFC register and verify correction logic val_0 = 0 val_1 = 0 for iter in range(0, 10): val_0 = self.TestProcedure.ICD.readCC1020( int(CC1020Register.AFC)) if val_0 > 127: val_0 = val_0 - 256 print "PRB AFC = ", val_0 val_1 = val_1 + val_0 print "PRB Average AFC = ", val_1 / 10.0 # val_2 = self.TestProcedure.ICD.readCC1020( int(CC1020Register.FREQ_2A)) val_1 = self.TestProcedure.ICD.readCC1020( int(CC1020Register.FREQ_1A)) val_0 = self.TestProcedure.ICD.readCC1020( int(CC1020Register.FREQ_0A)) freq_a = val_2 * 65536 + val_1 * 256 + val_0 print "PRB FREQ_A = ", freq_a val_2 = self.TestProcedure.ICD.readCC1020( int(CC1020Register.FREQ_2B)) val_1 = self.TestProcedure.ICD.readCC1020( int(CC1020Register.FREQ_1B)) val_0 = self.TestProcedure.ICD.readCC1020( int(CC1020Register.FREQ_0B)) freq_b = val_2 * 65536 + val_1 * 256 + val_0 print "PRB FREQ_B = ", freq_b # compute frequency offset val = (freq_a - 1) / 2 - (freq_a_init - 1) / 2 print "PRB AFC_A = ", val val = (freq_b - 1) / 2 - (freq_b_init - 1) / 2 print "PRB AFC_B = ", val # set the filter to widest bandwidth to get an unsaturated RSSI val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.FILTER)) print "PRB CC1020 FILTER = ", val self.TestProcedure.ICD.writeCC1020(int(CC1020Register.FILTER), 0x80) time.sleep(0.080) # read RSSI 10 times and compute the average val_0 = 0 val_1 = 0 for iter in range(0, 10): val_0 = self.TestProcedure.ICD.readCC1020( int(CC1020Register.RSSI)) print "PRB RSSI = ", val_0 val_1 = val_1 + val_0 print "PRB Average RSSI = ", val_1 / 10.0 # restore the filter setting self.TestProcedure.ICD.writeCC1020(int(CC1020Register.FILTER), 0x22) time.sleep(0.080) # Dump the Tx/Rx cal results if idx == 0: self.DumpSicdCalResults() # Write the test control table self.writeCalControlTable(DoCalFlag, MaxCalTries, ExitDelaySecs) # Write the configuration table for VCO low/high frequency # low: TEST5 = 0x3F, TEST3 = 0x10 # high: TEST5 = 0x30, TEST3 = 0x17 if idx == 0: self.icdcmd.writeByte((UInt32)(0x0200), 0xE1) self.icdcmd.writeByte((UInt32)(0x021D), 0x3F) self.icdcmd.writeByte((UInt32)(0x021F), 0x10) else: self.icdcmd.writeByte((UInt32)(0x0200), 0xE1) self.icdcmd.writeByte((UInt32)(0x021D), 0x30) self.icdcmd.writeByte((UInt32)(0x021F), 0x17) self.icdcmd.ping() print "VCO frequency starts in 10 seconds and lasts for 30 seconds..." # Start the test, the test patch will wait 10 seconds to allow for a break link self.icdcmd.writeUint16(Key.INT_VEC_TCMP0, 0x6A08) # break link with the S-ICD wfdeState = WaitForDisconnectedEventState(Key.DONT_CARE, 0x0) try: self.icdcmd.EventWaiter.execState(wfdeState, TimeSpan.FromSeconds(2)) except Exception, ex: print str(ex) time.sleep(16.0) sa.set_marker_findpeak() time.sleep(2.000) freq_0 = 0 freq_1 = 0 pwr_0 = 0 pwr_1 = 0 for iter in range(0, 8): freq_0 = sa.get_marker_frequency() print " PRB Tx frequency = ", freq_0 pwr_0 = sa.get_marker_power_level() print " PRB Tx power = ", pwr_0 freq_1 = freq_1 + freq_0 pwr_1 = pwr_1 + pwr_0 time.sleep(2.200) print " PRB Ave Frequency = ", freq_1 / 8.0 print " PRB Ave Power = ", pwr_1 / 8.0 time.sleep(14.0)
def script(self): # Read FPGA address 0x3000 and verify the response is 0x12. val = self.TestProcedure.ICD.readPrbFpga(0x3000) self.verify("FPGA 0x3000", 0x12, val) if val != 0x12: self.verify("ERROR", 0x12, val) #*********instrument setup*************************************** print "Creating instrument..." sa = spec_anal("GPIB::8", 'SPEC_ANAL') #**************************************************************** #*********plotter setup****************************************** plots = plotter(sa, test_dir) #**************************************************************** # read the MATCH value from EEPROM and write to the PRB #need to add read here... # calibrate once on channel 0 self.TestProcedure.ICD.calibrateCc1020() val = self.TestProcedure.ICD.readPrbFpga(0x2012) print " PRB badCal = ", val val = self.TestProcedure.ICD.readCC1020(int(CC1020Register.STATUS)) print " PRB STATUS register = ", val self.DumpCalResult() channel = 0 #5-45 5 degree steps temperatures = range(5, 46, 5) stabilization_mins = 10 chamber = watlowF4ipy.WatlowF4_temp_window(3, debug=True) for temperature in temperatures: chamber.set_temperature_and_time(temperature, temperature - 0.3, temperature + 0.3, stabilization_mins) while chamber.dwelltime_endpoint_reached() == False: #pause before checking the flag again time.sleep(2) sa.set_ref_level_dB(0) sa.set_span_kHz(400) sa.set_resolutionBW_kHz(3) sa.set_sweep_time_milliseconds(200) for index in range(0, self.loop_count): test_time = time.clock() print "Loop Index = ", index print "Test time = %.2d:%06.3f" % (test_time / 60, test_time % 60.0) # for index in range(0, 2): if index % 9 == 0: print "Candidate Frequency = 402.8183MHz, LSI" sa.set_center_frequency_MHz(402.8183) elif index % 9 == 1: print "Candidate Frequency = 403.5108MHz, HSI" sa.set_center_frequency_MHz(403.5108) elif index % 9 == 2: print "Candidate Frequency = 402.4942MHz, LSI" sa.set_center_frequency_MHz(402.4942) elif index % 9 == 3: print "Candidate Frequency = 404.6167MHz, HSI" sa.set_center_frequency_MHz(404.6167) elif index % 9 == 4: print "Candidate Frequency = 402.7209MHz, HSI" sa.set_center_frequency_MHz(402.7209) elif index % 9 == 5: print "Candidate Frequency = 402.4049MHz, HSI" sa.set_center_frequency_MHz(402.4049) elif index % 9 == 6: print "Candidate Frequency = 404.5197MHz, LSI" sa.set_center_frequency_MHz(404.5197) elif index % 9 == 7: print "Candidate Frequency = 402.7049MHz, LSI" sa.set_center_frequency_MHz(402.7049) else: print "Candidate Frequency = 403.5108MHz, HSI" sa.set_center_frequency_MHz(403.5108) time.sleep(1) # write the candidate frequency to PRB channel 0 registers self.writeFreqToPRB(index, 0) # write the candidate frequency to PRB channel 1 registers self.writeFreqToPRB(index, 1) # perform calibration and dump results self.TestProcedure.ICD.calibrateCc1020() # is badcal checked and reported? is there a wait until the cal interrupt? time.sleep(0.300) val = self.TestProcedure.ICD.readPrbFpga(0x2012) print " PRB badCal = ", val val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.STATUS)) print " PRB STATUS register = ", val self.DumpCalResult() # write the legacy frequency to PRB channel 0 registers self.writeFreqToPRB(1, channel) # perform calibration and dump results self.TestProcedure.ICD.calibrateCc1020() # is badcal checked and reported? is there a wait until the cal interrupt? time.sleep(0.300) val = self.TestProcedure.ICD.readPrbFpga(0x2012) print " PRB badCal = ", val val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.STATUS)) print " PRB STATUS register = ", val self.DumpCalResult() # perform an LBT instruction and log results # how do we issue an LBT and capture the interrupt packet? self.TestProcedure.ICD.writePrbFpga(0x1008, 0x10) time.sleep(0.400) val = self.TestProcedure.ICD.readPrbFpga(0x1020) print " PRB LIC = ", val val = self.TestProcedure.ICD.readPrbFpga(0x1026) print " PRB Channel Selection = ", val val = self.TestProcedure.ICD.readPrbFpga(0x1022) print " PRB Channel 0 RSSI = ", val val = self.TestProcedure.ICD.readPrbFpga(0x1024) print " PRB Channel 1 RSSI = ", val #note, after LBT the CC1020 registers contain the channel 1 values val_2 = self.TestProcedure.ICD.readCC1020( int(CC1020Register.FREQ_2A)) val_1 = self.TestProcedure.ICD.readCC1020( int(CC1020Register.FREQ_1A)) val_0 = self.TestProcedure.ICD.readCC1020( int(CC1020Register.FREQ_0A)) freq_a = val_2 * 65536 + val_1 * 256 + val_0 print " CC1020 FREQ_A = ", freq_a val_2 = self.TestProcedure.ICD.readCC1020( int(CC1020Register.FREQ_2B)) val_1 = self.TestProcedure.ICD.readCC1020( int(CC1020Register.FREQ_1B)) val_0 = self.TestProcedure.ICD.readCC1020( int(CC1020Register.FREQ_0B)) freq_b = val_2 * 65536 + val_1 * 256 + val_0 print " CC1020 FREQ_B = ", freq_b # place CC1020 into receive mode self.TestProcedure.ICD.writeCC1020(int(CC1020Register.MAIN), 0x01) #does the write/read routines wait until cc1020 not busy? time.sleep(0.080) val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.STATUS)) print " PRB STATUS register = ", val # log the filter setting val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.FILTER)) print " CC1020 FILTER = ", val time.sleep(0.080) # read RSSI 10 times and compute the average val_0 = 0 val_1 = 0 for iter in range(0, 10): val_0 = self.TestProcedure.ICD.readCC1020( int(CC1020Register.RSSI)) print " CC1020 RSSI = ", val_0 val_1 = val_1 + val_0 print " CC1020 Average RSSI = ", val_1 / 10.0 self.TestProcedure.ICD.writeCC1020(int(CC1020Register.MAIN), 0x1F) time.sleep(0.080) val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.MODEM)) print " CC1020 MODEM = ", val time.sleep(0.080) val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.DEVIATION)) print " CC1020 DEVIATION = ", val time.sleep(0.080) self.TestProcedure.ICD.writeCC1020(int(CC1020Register.MAIN), 0xC1) time.sleep(0.080) val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.STATUS)) print " PRB STATUS register = ", val time.sleep(1) val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.MAIN)) print " CC1020 MAIN = ", val # add SA commands to measure frequency and power for the peak output- read ten times and record the average sa.set_marker_findpeak() time.sleep(2.000) # read peak 10 times and compute the average freq_0 = 0 freq_1 = 0 pwr_0 = 0 pwr_1 = 0 for iter in range(0, 10): freq_0 = sa.get_marker_frequency() print " PRB Tx frequency = ", freq_0 pwr_0 = sa.get_marker_power_level() print " PRB Tx power = ", pwr_0 freq_1 = freq_1 + freq_0 pwr_1 = pwr_1 + pwr_0 print " PRB Ave Frequency = ", freq_1 / 10.0 print " PRB Ave Power = ", pwr_1 / 10.0 self.TestProcedure.ICD.writeCC1020( int(CC1020Register.DEVIATION), 0xD9) time.sleep(0.080) val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.MODEM)) print " CC1020 MODEM = ", val time.sleep(0.080) val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.DEVIATION)) print " CC1020 DEVIATION = ", val time.sleep(1) # read peak 10 times and compute the average sa.set_marker_findpeak() time.sleep(2.000) freq_0 = 0 freq_1 = 0 pwr_0 = 0 pwr_1 = 0 for iter in range(0, 10): freq_0 = sa.get_marker_frequency() print " PRB Tx frequency = ", freq_0 pwr_0 = sa.get_marker_power_level() print " PRB Tx power = ", pwr_0 freq_1 = freq_1 + freq_0 pwr_1 = pwr_1 + pwr_0 print " PRB Ave Frequency = ", freq_1 / 10.0 print " PRB Ave Power = ", pwr_1 / 10.0 self.TestProcedure.ICD.writeCC1020( int(CC1020Register.DEVIATION), 0x59) time.sleep(0.080) val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.MODEM)) print " CC1020 MODEM = ", val time.sleep(0.080) val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.DEVIATION)) print " CC1020 DEVIATION = ", val time.sleep(0.500) self.TestProcedure.ICD.writeCC1020(int(CC1020Register.MAIN), 0x1F) time.sleep(0.080) for index in range(0, self.loop_count): if index % 9 == 0: print "Candidate Frequency = 402.8183MHz, LSI" sa.set_center_frequency_MHz(402.8183) elif index % 9 == 1: print "Candidate Frequency = 403.5108MHz, HSI" sa.set_center_frequency_MHz(403.5108) elif index % 9 == 2: print "Candidate Frequency = 402.4942MHz, LSI" sa.set_center_frequency_MHz(402.4942) elif index % 9 == 3: print "Candidate Frequency = 404.6167MHz, HSI" sa.set_center_frequency_MHz(404.6167) elif index % 9 == 4: print "Candidate Frequency = 402.7209MHz, HSI" sa.set_center_frequency_MHz(402.7209) elif index % 9 == 5: print "Candidate Frequency = 402.4049MHz, HSI" sa.set_center_frequency_MHz(402.4049) elif index % 9 == 6: print "Candidate Frequency = 404.5197MHz, LSI" sa.set_center_frequency_MHz(404.5197) elif index % 9 == 7: print "Candidate Frequency = 402.7049MHz, LSI" sa.set_center_frequency_MHz(402.7049) else: print "Candidate Frequency = 403.5108MHz, HSI" sa.set_center_frequency_MHz(403.5108) # write the legacy frequency to PRB channel 0 registers self.writeFreqToPRB(1, 0) # write the candidate frequency to PRB channel 1 registers self.writeFreqToPRB(index, 1) # perform calibration and dump results self.TestProcedure.ICD.calibrateCc1020() # is badcal checked and reported? is there a wait until the cal interrupt? time.sleep(0.300) val = self.TestProcedure.ICD.readPrbFpga(0x2012) print " PRB badCal = ", val val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.STATUS)) print " PRB STATUS register = ", val self.DumpCalResult() # perform an LBT to place channel 1 frequency into CC1020 self.TestProcedure.ICD.writePrbFpga(0x1008, 0x10) time.sleep(1) # turn off the CC1020 and place into PN9 mode self.TestProcedure.ICD.writeCC1020(int(CC1020Register.MAIN), 0x1F) time.sleep(0.080) self.TestProcedure.ICD.writeCC1020(int(CC1020Register.MODEM), 0x54) time.sleep(0.080) # turn on CC1020 in transmit mode self.TestProcedure.ICD.writeCC1020(int(CC1020Register.MAIN), 0xC1) time.sleep(0.080) val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.STATUS)) print " PRB STATUS register = ", val val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.MODEM)) print " CC1020 MODEM = ", val time.sleep(0.080) val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.DEVIATION)) print " CC1020 DEVIATION = ", val time.sleep(0.500) time.sleep(2) sa.set_OBW_times_to_average(30) sa.set_occupied_bandwidth_pct(99) sa.turn_OBW_averages_on() (a, obw, c) = sa.measure_occupied_bandwidth() print " PRB OBW = ", obw d = sa.get_data() name = 'Occupied Bandwidth (PN9 pattern)' x_units = 'frequency(MHz)' y_units = 'signal power(' + sa.get_units() + ')' plots.make_plot(name, d, x_units, y_units) self.TestProcedure.ICD.writeCC1020( int(CC1020Register.DEVIATION), 0xD9) time.sleep(0.080) val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.MODEM)) print " CC1020 MODEM = ", val time.sleep(0.080) val = self.TestProcedure.ICD.readCC1020( int(CC1020Register.DEVIATION)) print " CC1020 DEVIATION = ", val time.sleep(0.500) time.sleep(2) (a, obw, c) = sa.measure_occupied_bandwidth() print " PRB OBW = ", obw d = sa.get_data() name = 'Occupied Bandwidth (PN9 pattern)' x_units = 'frequency(MHz)' y_units = 'signal power(' + sa.get_units() + ')' plots.make_plot(name, d, x_units, y_units) self.TestProcedure.ICD.writeCC1020( int(CC1020Register.DEVIATION), 0x59) time.sleep(0.080) self.TestProcedure.ICD.writeCC1020(int(CC1020Register.MAIN), 0x1F) sa.reset() self.passed = True self.TestProcedure.ICD.writeCC1020(int(CC1020Register.MAIN), 0x1F) print "Test complete, run prbRssiScript"