예제 #1
0
    def test_DCOC_status(self):
        # Start DCOC status test

        self.initialization()

        # DAC DCOC measurements
        # DC IQ registers list selection by rf_id 0/1
        dc_iq_list = self.consts.register['RX_DC_IQ_REGS_HEX'][self.rf_if]

        # Description : Validation loop, get registers measurements of i and q (i-bits [15:8], q-bits[7:0]), use mask to check if value in the expected range and return status Pass/fail
        # Usage example:
        # reg_I = (measured_register_value & 0xFF00)>>8   # extracting bits [15:8]
        # reg_Q = (measured_register_value & 0x00FF)      # extracting bits [7:0]

        results_collect = {}

        #Add report details to results file
        results_collect.update({"gps_version": self.param['gps_version']})
        results_collect.update({"board_IP": self.param['evk_ip']})
        results_collect.update({"board_type": self.param['board_type']})
        results_collect.update({"board_number": self.param['board_number']})

        for i in range(0, len(dc_iq_list)):
            # Registers measurements, returned value in hex
            rf_reg = self.fw_cli.get_reg(
                ('rf' + str(self.rf_if), dc_iq_list[i]))

            # Mask relevant bits and extract i-bits[15:8], q-bits[7:0] using string manipulations
            DC_I = (rf_reg & 0xFF00) >> 8  # extracting bits [15:8]
            DC_Q = (rf_reg & 0x00FF)  # extracting bits [7:0]

            # Checking status
            if (DC_I in range(self.consts.register['DC_RANGE_START_REG_HEX'],
                              self.consts.register['DC_RANGE_STOP_REG_HEX'])
                ) or (DC_Q in range(
                    self.consts.register['DC_RANGE_START_REG_HEX'],
                    self.consts.register['DC_RANGE_STOP_REG_HEX'])):
                dc_status_ok = Fail
            else:
                dc_status_ok = True

            # Add results to report
            iq_name = {'I': DC_I, 'Q': DC_Q}
            for iq_key, reg_value in iq_name.iteritems():
                self.add_limit(
                    "ch_" + str(self.rf_if) + " " + str(hex(dc_iq_list[i])) +
                    ", " + iq_key + " reg DC not in range",
                    self.consts.register['DC_RANGE_START_REG_HEX'], reg_value,
                    self.consts.register['DC_RANGE_STOP_REG_HEX'], 'NIR')

            log.info(
                'DCOC test, DAC register %s, value %s, status %s ' %
                (str(hex(dc_iq_list[i])), str(hex(rf_reg)), str(dc_status_ok)))
            #print >> self.result._original_stdout, "test, {} completed".format( self._testMethodName )
            results_collect.update({str(hex(dc_iq_list[i])): str(hex(rf_reg))})
            #utils.update_dict_in_file( self.param['final_report_file'], str(hex(dc_iq_list[i])), str(hex(rf_reg)))
            results_collect.update(
                utils.file_to_dict(self.param['final_report_file']))
            utils.dict_to_file(results_collect,
                               self.param['final_report_file'])

        # Prepare and measure DC measurements
        # Read the DC values for the wfp gain
        self.fw_cli.dcoc_wfp_timer(self.rf_if + 1, 0)  # timeout 0
        self.fw_cli.dcoc_calibrate(self.rf_if + 1)  #1/2
        time.sleep(5)

        # Read the DC values for [ medium, low, free agc ]
        gain_levels = self.consts.common['DC_GAIN_LEVELS']
        for key, value in gain_levels.iteritems():
            self.fw_cli.set_reg(('phy' + str(self.rf_if), 0x10d), value)
            self.fw_cli.quit_from_registers()
            time.sleep(1)
            data_string = self.fw_cli.dcoc_read_wfp(self.rf_if + 1)

            # Cleaning data string, removes all whitespaces, tabs and newlines and splitting
            dc_values = [s.strip() for s in data_string.splitlines()][0]
            float_format = r"([-+]?\d*\.\d+|[-+]?\d+)"
            v = re.findall(float_format, dc_values)
            dc_value_real, dc_value_imag = v[0], v[1]
            log.info('DC values ' + key + ': ' + dc_values)
            self.add_limit(
                "ch_" + str(self.rf_if) + " " + key +
                " gain DC value real [mV]",
                -1 * (self.consts.expected['EXPECTED_DC_RANGE']),
                float(dc_value_real),
                self.consts.expected['EXPECTED_DC_RANGE'], 'GELE')
            self.add_limit(
                "ch_" + str(self.rf_if) + " " + key +
                " gain DC value imaginary [mV]",
                -1 * (self.consts.expected['EXPECTED_DC_RANGE']),
                float(dc_value_imag),
                self.consts.expected['EXPECTED_DC_RANGE'], 'GELE')
            results_collect.update(
                utils.file_to_dict(self.param['final_report_file']))
            results_collect.update({
                "ch_" + str(self.rf_if) + " " + key + " gain [I,Q] DC value[mV]":
                [dc_value_real, dc_value_imag]
            })
            utils.dict_to_file(results_collect,
                               self.param['final_report_file'])

        # Free AGC
        self.fw_cli.set_reg(('phy' + str(self.rf_if), 0x10d), 1)
        self.fw_cli.quit_from_registers()

        log.info('Test {} finished'.format(self._testMethodName))
예제 #2
0
    def test_tx_power_calibration(self):
        log.info("Start TSSI calibration test")

        # Test initialization
        self.initialization()

        tx_power_list, detector_meas_list = [], []

        # Start transmiting packets from evk
        self.uut.managment.set_vca_tx_enabled(True, self.rf_if)

        #Settings initial values to zeros
        fix_delta = 0
        res_tx_evm_all = []
        fifo_meas_status = True
        results_collect = {}  # report results dictionary

        print >> self.result._original_stdout, "\nStart TSSI calibration test measurements.."
        # Get measurements for set of tx powers 10,11,12,.....,24 dBm, direction in acsending order to prevent high gain measurements issue (LUT issues in high gains)
        for iter_power in self.consts.common['TX_CAL_RANGE_DBM']:
            self.uut.managment.set_tx_power(iter_power,
                                            self.rf_if)  #Set tx power
            self.vsa.prepare_vsa_measurements()

            delta_sum = 0
            iter_indx = 5  #for delta calc
            # Fixation delta measurements
            for k in range(0, iter_indx):
                #self.vsa.prepare_vsa_measurements()
                self.vsa.vsa_capture_data(2000e-6)  #sec
                self.vsa.vsa_analyze_802_11p()
                delta_sum += self.vsa.get_tx_vsa_measure('rmsPowerNoGap')

            # delta between expected input power and measured average power, fixation delta
            fix_delta = iter_power - delta_sum / iter_indx

            # Set fixation for tx power, if the fixation delta out of limit, set half of value
            delta_limit = self.consts.common[
                "TX_POW_DELTA_LIMIT_DB"]  # default 6dB
            rounded_power = round(iter_power + (fix_delta if (
                abs(fix_delta) < delta_limit) else fix_delta / 2))
            self.uut.managment.set_tx_power(rounded_power,
                                            self.rf_if)  #Set fixed tx power
            log.info(
                "Expected = {}, Measured = {}, delta = {}, rounded_power(dBm) = {}"
                .format(iter_power, delta_sum / iter_indx, fix_delta,
                        rounded_power))
            time.sleep(4)

            # Measurement preparing, read first 10 bits (0 to 9) of TSSI FIFO register at MAC0, also need to verify bit 31 is 0 (false), when 1 (true) the FIFO value is not valid
            fifo_meas_status = bool(
                self.fw_cli.get_reg(("mac0",
                                     self.consts.register['TSSI_FIFO_HEX'][
                                         self.param['rf_if']])) & (0x80000000))

            # Start measurement loop
            if not fifo_meas_status:
                # Initiate dictionary of sums to zeros
                sum = {"tx_pow": 0, "tx_evm": 0, "tx_detector_meas": 0}
                SAMPLES = 5  # number of iteration for addition delta calculation loop

                for i in range(0, SAMPLES):
                    self.vsa.prepare_vsa_measurements()
                    sum["tx_pow"] += self.vsa.get_tx_vsa_measure(
                        'rmsPowerNoGap')
                    sum["tx_evm"] += self.vsa.get_tx_vsa_measure('evmAll')
                    sum["tx_detector_meas"] += int(
                        self.fw_cli.get_reg(
                            ("mac0", self.consts.register['TSSI_FIFO_HEX'][
                                self.rf_if]))
                        & utils.bit_mask(10))  # Read first 10 bits

                # Collect the measurements
                tx_power_list.append(sum["tx_pow"] / SAMPLES)
                detector_meas_list.append(sum["tx_detector_meas"] / SAMPLES)
                res_tx_evm_all.append(sum["tx_evm"] / SAMPLES)

                fifo_meas_status = True
            else:
                log.info("TSSI FIFO not valid!")

        # Reverse list for TX power adjustment function calculations
        tx_power_list = tx_power_list[::-1]
        detector_meas_list = detector_meas_list[::-1]
        res_tx_evm_all = res_tx_evm_all[::-1]
        print >> self.result._original_stdout, "\nMeasured tx_power_list: {}".format(
            tx_power_list)
        print >> self.result._original_stdout, "\nMeasured detector_meas_list: {}".format(
            detector_meas_list)
        print >> self.result._original_stdout, "\nMeasured res_tx_evm_all: {}".format(
            res_tx_evm_all)

        # TX power adjustment function, returns the final vector for an antenna power LUT
        calib_pant_lut_vector_list = tssi.adjust_tx_power(
            self.rf_if, detector_meas_list, tx_power_list)
        print >> self.result._original_stdout, "\nMeasured pant_lut_vector: {}".format(
            calib_pant_lut_vector_list)

        log.info("tx_power_list): {:s}".format(str(tx_power_list)))
        log.info("detector_meas_list: {:s}".format(str(detector_meas_list)))
        log.info("Final vector_list ch{}: {}".format(
            self.rf_if, calib_pant_lut_vector_list))
        results_collect.update(
            utils.file_to_dict(self.param['final_report_file']))
        results_collect.update({
            "pant_lut_vector_" + str(self.rf_if + 1):
            calib_pant_lut_vector_list
        })

        # Stop transmiting packets from evk
        self.uut.managment.set_vca_tx_enabled(False, self.rf_if)

        utils.dict_to_file(results_collect, self.param['final_report_file'])

        #Set uboot params
        assert (self.rf_if in (0, 1))
        ch_pant_lut_index = "ch_" + str(self.rf_if) + "_pant_lut_index"
        #pant_lut_vector_1 = "pant_lut_vector_1"
        #pant_lut_vector_2 = "pant_lut_vector_2"
        #pant_lut_vector_3 = "pant_lut_vector_3"
        #pant_lut_vector_4 = "pant_lut_vector_4"

        pant_lut_vector = {
            1: "pant_lut_vector_1",
            2: "pant_lut_vector_2",
            3: "pant_lut_vector_3",
            4: "pant_lut_vector_4"
        }
        try:
            self.uboot.reboot()

            d = {ch_pant_lut_index: self.rf_if + 1}
            for k, v in d.iteritems():
                self.uboot.set_value(str(k), str(v))

            if self.rf_if == 0:
                self.uboot.set_value(pant_lut_vector[1],
                                     calib_pant_lut_vector_list)
            elif self.rf_if == 1:
                self.uboot.set_value(pant_lut_vector[2],
                                     calib_pant_lut_vector_list)

            self.uboot.save()

        except Exception as e:
            raise Exception("{}, failed to save uboot parameters".format(e))
        finally:
            try:
                # Reboot the board and wait for valid PROMT
                print >> self.result._original_stdout, "Rebooting.."
                self.uboot.reset()
            except Exception as err:
                #traceback.print_exc()
                raise Exception("{}, failed to reset board".format(err))

        # Tx power validation after the calibration
        print >> self.result._original_stdout, "\nPerforming rebooting and validation after the tx power calibration.."
        # Start transmiting packets from evk
        self.uut.managment.set_tx_power(20, self.rf_if)  #Set tx power to 20dBm
        self.uut.managment.set_rf_frequency(self.param['ch_freq'],
                                            self.rf_if)  #Set frequency
        self.uut.managment.set_vca_tx_enabled(True, self.rf_if)
        time.sleep(5)

        SAMPLES_CHECK = 10
        SUM_CHECK = 0
        tx_power_meas_check = None

        for j in range(0, SAMPLES_CHECK):
            self.vsa.prepare_vsa_measurements()
            SUM_CHECK += self.vsa.get_tx_vsa_measure('rmsPowerNoGap')
            time.sleep(0.5)
        try:
            tx_power_meas_check = float(
                format((SUM_CHECK / SAMPLES_CHECK), '0.2f'))
        except:
            raise ArithmeticError("tx power measurements failed")
        log.info("Validation, TX power @20dBm = %sdBm" %
                 str(tx_power_meas_check))
        print >> self.result._original_stdout, "Validation, TX power @20dBm = {}dBm".format(
            tx_power_meas_check)

        # Add measurements to report
        self.add_limit("ch_" + str(self.rf_if) + " tx power @20 [dBm]",
                       self.consts.expected['EXPECTED_TX_POWER_LOW_DBM'],
                       tx_power_meas_check,
                       self.consts.expected['EXPECTED_TX_POWER_HIGH_DBM'],
                       'GELE')
        log.info(" Test finished ")
예제 #3
0
    def test_rx_sample_gain(self):
        #self.skipTest("Skip over the rest of the routine")
        self.initialization()

        log.info('Start Sample Gain test')
        log.info("Channel frequency:" + str(self.param['ch_freq']))

        # Calculate transmission tx power for a measurements areas, depends on setup attenuation by board type
        selected_btype_attenuation = self.consts.common[
            'RX_PATH_SETUP_ATTENUATION_DB' + "_" + str(self.rf_if) + "_" +
            self.param['board_type']]
        select_meas_area_tx_power = {
            "STRONG": None,
            "MID": None,
            "WEAK": None
        }  # LNA off Mixer off, LNA off Mixer on, LNA on Mixer on
        for area, power in select_meas_area_tx_power.iteritems():
            power = self.consts.common[
                area +
                '_PACKETS_AREA_DBM'] + selected_btype_attenuation  # actual setup
            select_meas_area_tx_power[area] = power

        #Settings phy registers to default values
        self.fw_cli.set_reg(
            ('phy' + str(self.rf_if),
             self.consts.register['RX_SAMPLE_GAIN_REG_LOW_PART_HEX']), 0x0)
        self.fw_cli.set_reg(
            ('phy' + str(self.rf_if),
             self.consts.register['RX_SAMPLE_GAIN_REG_HIGHMID_PART_HEX']), 0x0)

        #Read Backoff compensation configuration
        backoff_index = hex(
            self.fw_cli.get_reg(
                ('phy' + str(self.rf_if),
                 self.consts.register['BACKOFF_COMP_REG_HEX'])))
        backoff_comp = int(
            backoff_index, 16
        ) * 6  # Backoff compensation index*6 = attenuation compensation in dB
        log.info("Backoff compensation = {}".format(backoff_comp))

        # Start transmitting packets and measure RSSI
        sg_dict = {}  # the dictionary will collect measured deltas
        results_collect = {}  # report results dictionary

        for area, power in select_meas_area_tx_power.iteritems():
            # Start transmission
            self.vsg.vsg_settings(self.param['ch_freq'], power)
            expected_rssi = power - float(selected_btype_attenuation)
            log.info("Expected RSSI (dBm) = {}".format(expected_rssi))

            # Get measured DUT Pin(RSSI, EVM)
            results_dict = self.fw_cli.get_rssi(
                self.rf_if + 1, self.consts.common['EVM_AVERAGE_CNT'],
                10)  # timeout = 10sec
            rssi_average = results_dict.get('rssi')[
                1]  # Get Average RSSI from statistics
            evm_average = results_dict.get('evm')[
                1]  # Get Average EVM from statistics
            log.info("Average RSSI = %sdBm, EVM = %sdB" %
                     (rssi_average, evm_average))

            # Sample gain calculation dB
            sample_gain = float(
                rssi_average
            ) - expected_rssi  # sample gain delta = measured - expected
            sg_dict.update({area:
                            sample_gain})  # updating measurements in dictonary

        #Stop transmission
        self.vsg.rf_enable(False)

        # Convert measured diff deltas in dB to (11,3) format
        sg_converted_dict = {}
        for key, value in sg_dict.iteritems():
            sg_converted_dict.update({key: hex(utils.dB_to_11_3(value))})

        #Logging
        log.info('Measured SampleGain low: {}, mid: {}, high :{}'.format(
            sg_dict["STRONG"], sg_dict["MID"], sg_dict["WEAK"]))
        log.info(
            'Measured SampleGain (11,3) format low: {}, mid: {}, high :{}'.
            format(sg_converted_dict["STRONG"], sg_converted_dict["MID"],
                   sg_converted_dict["WEAK"]))

        # Checking status Sample gain range
        if (self.consts.expected['START_RANGE_DB'] <=
            (sg_dict["STRONG"] or sg_dict["MID"]
             or sg_dict["WEAK"]) <= self.consts.expected['END_RANGE_DB']):
            log.info('Status: PASS')
        else:
            log.info('Sample Gain value range fail.Status: FAIL')

        # Update dict
        results_collect.update(
            utils.file_to_dict(self.param['final_report_file']))

        # Add measurements to report
        for key in sg_dict:
            self.add_limit(
                "ch_" + str(self.rf_if) + " " + key +
                " sample Gain value [dB]",
                self.consts.expected['START_RANGE_DB'], sg_dict[key],
                self.consts.expected['END_RANGE_DB'], 'GELE')
            results_collect.update({
                "ch_" + str(self.rf_if) + " " + key + " sample Gain value [dB, hex]":
                [format(float(sg_dict[key]), '0.2f'), sg_converted_dict[key]]
            })
            #utils.update_dict_in_file( self.param['final_report_file'], key + " sample Gain [dB, hex]", [ format(float(sg_dict[key]),'0.2f'), sg_converted_dict[key] ] )

        utils.dict_to_file(results_collect, self.param['final_report_file'])

        # -------------Set and save Uboot params-----------------------
        uboot_sample_gain_high = "ch_" + str(self.rf_if) + "_sample_gain_high"
        uboot_sample_gain_mid = "ch_" + str(self.rf_if) + "_sample_gain_mid"
        uboot_sample_gain_low = "ch_" + str(self.rf_if) + "_sample_gain_low"

        # Rebooting board and save parameters
        log.info("Rebooting board and save parameters")

        try:
            self.uboot.reboot()
            d = {
                uboot_sample_gain_high: sg_converted_dict["STRONG"],
                uboot_sample_gain_mid: sg_converted_dict["MID"],
                uboot_sample_gain_low: sg_converted_dict["WEAK"]
            }
            for k, v in d.iteritems():
                self.uboot.set_value(str(k), str(v))
            self.uboot.save()

        except Exception as e:
            raise Exception("{}, failed to save uboot parameters".format(e))
        finally:
            try:
                # Reset board
                self.uboot.reset()
            except Exception as err:
                #traceback.print_exc()
                raise Exception("{}, failed to reset board".format(err))

        log.info("Test finished ")
예제 #4
0
    def test_sensitivity(self):

        log.info('Start Sensitivity test')

        self.get_test_parameters()
        self.initialization()

        full_res = []
        results_collect = {}  # report results dictionary

        # Read collected results file and update dict
        results_collect.update(
            utils.file_to_dict(self.param['final_report_file']))

        # Logging
        log.info(
            "Sensitivity test parameters: rf_if {}, freq {}Mhz, rate {}Mbps, temperature {}"
            .format(self.rf_if, self.ch_freq, self.rate, self.temperature))

        firstString = True

        # AGC cross-over points  default (-67dBm,-49dBm)
        pwr_range = self.consts.common[
            "SENSITIVITY_TEST_RANGE_RATE"]  # dictionary of ranges

        # Execute test
        sens_point = np.nan
        fail_details = 'measurement error'
        status_s = False

        print >> self.result._original_stdout, "\nSensitivity measurements loop .. "

        # Point is False when sensitivity point catched
        point = True
        # Run over selected range
        for pwr in pwr_range[self.rate]:
            # When using IQ2010 tester we must transmit 1 packet for clean RF output
            self.vsg.vsg_settings(
                self.ch_freq,
                pwr)  # Set and Transmit 1 packet with Single trigger mode
            self.vsg.vsg_frames_to_send(1)
            self.vsg.rf_enable(True)

            # Get initial RX counter value
            init_value = self.uut.managment.get_wlan_frame_rx_cnt(
                self.rf_if)  # Get Rx counter, initial reference
            self.vsg.vsg_settings(
                self.ch_freq,
                pwr)  # Set and Transmit n packets with Single trigger mode
            self.vsg.vsg_frames_to_send(self.num_pckt2send)
            self.vsg.rf_enable(True)

            # Wait 8 seconds to complete transmission
            #time.sleep(8)   # to do calculate exact time for transmission, Packet transmission time = number_of_packets*(Packet size / Bit rate)

            current_rssi = pwr - float(
                self.consts.common['RX_PATH_SETUP_ATTENUATION_DB_' +
                                   str(self.rf_if) + "_" +
                                   self.param['board_type']])

            # Logging
            log.info('Pin signal power: ' + str(current_rssi) + ' dBm')

            # Get RX counter value after transmission of n packets
            frame_rx_cnt = self.uut.managment.get_wlan_frame_rx_cnt(self.rf_if)

            # Calculate number of recieved packets
            recieved_cnt = frame_rx_cnt - init_value

            # PER calculation
            per = 1 - float(recieved_cnt) / self.num_pckt2send

            # Get RSSI of last packet - read 10 times and calulate average RSSI
            rssi_values = []
            rssi_value = -1
            rssi_var = np.nan
            try:
                for i in range(10):
                    rssi_value = self.uut.managment.get_rx_rssi(self.rf_if)
                    rssi_values = np.append(rssi_values, rssi_value)

                rssi_average = np.mean(rssi_values.astype(
                    np.float))  # calculating average RSSI
                rssi_var = np.var(rssi_values.astype(
                    np.float))  # calculating variance of RSSI measurements

                # Logging
                log.debug('RSSI measurements values: ' + str(rssi_values) +
                          " dBm")
                log.info('RSSI Average: ' + str(rssi_average) + ' dBm, ' +
                         'RSSI Variance: ' + str(rssi_var) + ' dBm')

                # Calculate delta between current RSSI - average RSSI
                average_delta = abs(current_rssi - float(rssi_average))
            except:
                average_delta = np.nan
                pass

            log.info('PER: {} %'.format(per * 100))
            res_dict = {}
            res_dict["ch_freq"] = self.ch_freq
            res_dict["rate"] = self.rate
            res_dict["interval_usec"] = self.interval_usec
            #res_dict["interval_usec"] = 32
            res_dict["num_pckt2send"] = self.num_pckt2send
            res_dict["packet_size"] = self.pad
            res_dict["evk_ip"] = self.evk_ip
            res_dict["PER_ch"] = per * 100
            res_dict["rssi_average"] = format(float(rssi_average), '0.2f')
            res_dict["rssi_variance"] = format(float(rssi_var), '0.2f')
            res_dict["rssi_diff_delta"] = format(float(average_delta), '0.2f')
            #res_dict["EVM"] = format(float(evm_average),'0.2f')
            res_dict["rf_if"] = self.param['rf_if']
            res_dict["macIF_counter_val"] = recieved_cnt

            full_res.append((current_rssi, res_dict))
            log.info("sensitivity results {}".format(full_res))

            #Sensitivity point trap
            if (0 <= per * 100 <=
                    self.consts.expected['EXPECTED_PER_HIGH_PERCENT']) and (
                        current_rssi <
                        self.consts.common['MIN_SENSITIVITY_BY_RATE_DB'][str(
                            self.rate)]) and point:
                sens_point = current_rssi
                log.info('$$Sensitivity point =' + str(current_rssi))
                status_s = self.add_limit(
                    "temp {}, ch_{} {} rx sensitivity [dB]".format(
                        self.temperature, self.rf_if, self.rate),
                    self.consts.common['MIN_SENSITIVITY_BY_RATE_DB'][str(
                        self.rate)], sens_point, None, 'LE')
                point = False
            elif (0 <= per * 100 <=
                  self.consts.expected['EXPECTED_PER_HIGH_PERCENT']) and (
                      current_rssi >
                      self.consts.common['MIN_SENSITIVITY_BY_RATE_DB'][str(
                          self.rate)]) and point:
                sens_point = current_rssi
                log.info('$$Sensitivity point (value exceed expected) = ' +
                         str(current_rssi))
                status_s = self.add_limit(
                    "temp {}, ch_{} {} rx sensitivity [dB]".format(
                        self.temperature, self.rf_if, self.rate),
                    self.consts.common['MIN_SENSITIVITY_BY_RATE_DB'][str(
                        self.rate)], sens_point, None, 'LE')
                point = False
            elif (per * 100 == 0) and point:
                sens_point = current_rssi
                log.info('$$Sensitivity point (value @PER 0%) = ' +
                         str(current_rssi))
                status_s = self.add_limit(
                    "temp {}, ch_{} {} rx sensitivity [dB]".format(
                        self.temperature, self.rf_if, self.rate),
                    self.consts.common['MIN_SENSITIVITY_BY_RATE_DB'][str(
                        self.rate)], sens_point, None, 'LE')
                point = False
            elif (0 <= per * 100 <=
                  self.consts.expected['EXPECTED_PER_HIGH_PERCENT']) and (
                      current_rssi >
                      self.consts.common['MIN_SENSITIVITY_BY_RATE_DB'][str(
                          self.rate)]) and point:
                log.info(
                    '$$Sensitivity point did not reach the expected value, PER arround 10% at {} [dB]'
                    .format(current_rssi))
                status_s = self.add_limit(
                    "temp {}, ch_{} {} rx sensitivity [dB]".format(
                        self.temperature, self.rf_if, self.rate),
                    self.consts.common['MIN_SENSITIVITY_BY_RATE_DB'][str(
                        self.rate)], sens_point, None, 'LE')
                point = False
                #pass

            #results_collect.update( { "ch_{} rate {}Mbps sensitivity point".format( self.rf_if, self.rate ) : format(float(sens_point),'0.2f') } )
            print >> self.result._original_stdout, "ch_{}, rate {}[Mbps], RSSI {}[dBm], PER {}[%]".format(
                self.rf_if, self.rate, str(format(float(current_rssi),
                                                  '0.2f')), per * 100)
            self.add_limit(
                "temp {}C, ch_{}, rate {}[Mbps], RSSI {}[dBm], PER[%]".format(
                    self.temperature, self.rf_if, self.rate,
                    str(format(float(current_rssi), '0.2f'))), 0, per * 100,
                float(self.consts.expected['EXPECTED_PER_HIGH_PERCENT']) if
                (sens_point - 3 < current_rssi < sens_point + 3) else float(0),
                'GELE')

            fail_details = 'sensitivity point did not reach the expected value or not in range of measurements' if point else 'status done'

        # Collect sensitivity results to file
        with open(self.param["sens_results"], "a+") as out_file:
            utils.print_and_log(
                out_file, "{},{},{},{},{},{},{},{},{},".format(
                    ctime(),
                    str(self.consts.common['DSRC_CHANNEL_SIM_MODELS_LIST'][0]),
                    str(self.temperature), str("ch_{}".format(self.rf_if)),
                    str(self.rate), str(self.ch_freq), str(sens_point),
                    status_s, fail_details))

        # Get measured DUT Pin(RSSI, EVM) and save results
        evm_meas_power = self.consts.common[
            "RX_IQ_IMBALANCE_INIT_PIN_POWER_DBM"] - float(
                self.consts.common['RX_PATH_SETUP_ATTENUATION_DB_' +
                                   str(self.rf_if) + "_" +
                                   self.param['board_type']])
        self.vsg.vsg_settings(self.ch_freq, evm_meas_power)  # -55dbm
        self.vsg.vsg_frames_to_send(0)  # free run
        time.sleep(1)
        results_dict = self.fw_cli.get_rssi(
            self.rf_if + 1, self.consts.common['EVM_AVERAGE_CNT'],
            10)  # timeout = 10sec
        rssi_average = results_dict.get('rssi')[
            1]  # Get Average RSSI from statistics
        evm_average = results_dict.get('evm')[
            1]  # Get Average EVM from statistics
        status_evm = self.add_limit(
            "temp {}, ch_{} freq {} rate {} rx evm [dB]".format(
                self.temperature, self.rf_if, self.ch_freq,
                self.rate), self.consts.expected['EXPECTED_RX_EVM_LIMIT_DB'],
            float(evm_average), None, 'LE')

        log.info("Average RSSI = %sdBm, EVM = %sdB" %
                 (rssi_average, evm_average))
        if self.param["calibration_enable"]:
            results_collect.update({
                "ch_{} rate {}Mbps sensitivity point".format(
                    self.rf_if, self.rate):
                [format(float(sens_point), '0.2f'), status_s]
            })
            results_collect.update({
                "ch_{} rx evm@{}dBm".format(
                    self.rf_if, self.consts.common["RX_IQ_IMBALANCE_INIT_PIN_POWER_DBM"]):
                [evm_average, status_evm]
            })
            utils.dict_to_file(results_collect,
                               self.param['final_report_file'])

        # Stop transmisssion
        self.vsg.rf_enable(False)
        log.info('Sensitivity test finished')
예제 #5
0
                        print "\n The current temperature is {}".format( chamber_temp )
                        print "Returning to room temperature, wait.."
                        if ( DEFAULT_TEMP - 3 ) <= chamber_temp <= ( DEFAULT_TEMP + 3 ):
                            pass
                        else:
                            time.sleep(60*30)
                    
                    chamber_temp = int( temperature_chamber.get_temp() )
                    print "\n The current temperature is {}".format( chamber_temp )
                    print "Temperature loop is finished!!"
                except:
                    print "The chamber not in use"
        except:
            log.info("Unable to set chamber")
            pass
    


    # Create pdf report True/False
    pdf_report = data_configuration.PdfReport[0]
    if pdf_report:
        results_collect = {} # report results dictionary   
        # Read collected results file and update dict 
        results_collect.update( utils.file_to_dict( final_report_file ) ) 
        pdf_report = create_pdf_report.Report()
        pdf_report.run(logs_path, test_data_dir, results_collect, ver_info, serial_number, False)
        pass



예제 #6
0
    def test_tx_path(self):
        log.info("Start TX path test, measurements for ch_{}, rate {}, temp {}..".format( self.rf_if, self.param["rate"], self.param['temperature'] ) )

        # Test initialization
        self.initialization()
               
        # Start transmiting packets from evk
        self.uut.managment.set_vca_tx_enabled( True, self.rf_if )
        time.sleep(5)

        
        # Update dict
        results_collect = {} # report results dictionary
        results_collect.update(utils.file_to_dict( self.param['final_report_file'] ))
       
        print >> self.result._original_stdout, "\nStart measurements for ch_{}, rate {}, temp {}..".format( self.rf_if, self.param["rate"], self.param['temperature'] )

        # Tx path parameters measurements
        print >> self.result._original_stdout, "\nPerforming Tx path parameters measurements.."

        # Initiate dictionary of sums to zeros
        SAMPLES = 10     # number of iteration for addition delta calculation loop
        measurement = { "rmsPowerNoGap" : [], "evmAll" : [], "ampErrDb" : [], "phaseErr" : [], "dcLeakageDbc" : [] , "freqErr" : [], "clockErr" : [] }
        self.vsa.prepare_vsa_measurements()

        # Measure params
        for iteration in range(0, SAMPLES): 
            for item, val in measurement.items():
                try:
                    self.vsa.vsa_capture_data(2000e-6) #sec
                    self.vsa.vsa_analyze_802_11p()
                    measurement[ item ] = np.append( measurement[ item ], self.vsa.get_tx_vsa_measure( item ) )
                except:
                    measurement[ item ] = np.append( measurement[ item ], np.nan )
                
        # Stop transmission packets
        self.uut.managment.set_vca_tx_enabled( False, self.rf_if )

        # Calculate mean of valid measurements and update the dictionary
        for k, v in measurement.items():
            measurement.update( { k : float( format(np.mean(v), '0.2f') ) } )
        
     # Add measurements to report
        fails_list = []
        self.add_limit( "temp {}C, freq {}MHz, ch_{}, rate {}[Mbps]".format( self.param['temperature'], self.param['ch_freq'], self.rf_if, self.param['rate'] ), 0, 0, 0 , 'GELE')
        self.status_tx_power = self.add_limit( "ch_{} tx power [dBm]".format(self.rf_if), self.param['tx_power'] - 1  , measurement ["rmsPowerNoGap"], self.param['tx_power'] + 1, 'GELE')
        self.status_tx_evm = self.add_limit( "ch_{} tx evm [dB]".format(self.rf_if), self.consts.expected['EXPECTED_TX_EVM_DB'], measurement[ "evmAll" ], np.nan, 'LE')
        self.status_tx_iq_ampl_imbalance = self.add_limit( "ch_{} iq imbalance amplitude error [dB]".format(self.rf_if), self.consts.expected['EXPECTED_TX_IQIMBALANCE_GAIN_LOW_DB'], measurement[ "ampErrDb" ], self.consts.expected['EXPECTED_TX_IQIMBALANCE_GAIN_HIGH_DB'] , 'GELE')
        self.status_tx_iq_phase_imbalance = self.add_limit( "ch_{} iq imbalance phase error [deg]".format(self.rf_if), self.consts.expected['EXPECTED_TX_IQIMBALANCE_PHASE_LOW_DEG'], measurement[ "phaseErr" ], self.consts.expected['EXPECTED_TX_IQIMBALANCE_PHASE_HIGH_DEG'] , 'GELE')
        self.status_dc_lo_leakage = self.add_limit( "ch_{} dc lo leakage [dBc]".format(self.rf_if), self.consts.expected['EXPECTED_LO_LEAKAGE_DBC'], measurement[ "dcLeakageDbc" ], np.nan, 'LE')
        self.status_freq_error = self.add_limit( "ch_{} frequency error [kHz]".format(self.rf_if), self.consts.expected['EXPECTED_TX_FREQ_ERROR_LOW_KHZ'] , (measurement[ "freqErr" ])/1e3, self.consts.expected['EXPECTED_TX_FREQ_ERROR_HIGH_KHZ'] , 'GELE')
        self.status_sym_clock_error = self.add_limit( "ch_{} symbol clock error [ppm]".format(self.rf_if), self.consts.expected['EXPECTED_TX_SYMBOL_CLK_ERROR_LOW_PPM'], measurement[ "clockErr" ], self.consts.expected['EXPECTED_TX_SYMBOL_CLK_ERROR_HIGH_PPM'] , 'GELE')

        fails_list.append("tx_power = {}".format( measurement ["rmsPowerNoGap"] )) if not self.status_tx_power else log.info("status_tx_power {}".format( self.status_tx_power ))
        fails_list.append("tx evm = {}".format( measurement ["evmAll"] ) ) if not self.status_tx_evm else log.info("status_tx_evm {}".format( self.status_tx_evm ))
        fails_list.append("iq imbalance amplitude error = {}".format( measurement ["ampErrDb"] ) ) if not self.status_tx_iq_ampl_imbalance else log.info("status_tx_iq_ampl_imbalance {}".format(self.status_tx_iq_ampl_imbalance ))
        fails_list.append("iq imbalance phase error = {}".format( measurement ["phaseErr"] ) ) if not self.status_tx_iq_phase_imbalance else log.info("status_tx_iq_phase_imbalance {}".format(self.status_tx_iq_phase_imbalance ))
        fails_list.append("dc lo leakage = {}".format( measurement ["dcLeakageDbc"] ) ) if not self.status_dc_lo_leakage else log.info("status_dc_lo_leakage {}".format(self.status_dc_lo_leakage ))
        fails_list.append("frequency error = {}".format( measurement ["freqErr"] ) ) if not self.status_freq_error else log.info("status_freq_error {}".format(self.status_freq_error ))
        fails_list.append("symbol clock error = {}".format( measurement ["clockErr"] ) ) if not self.status_sym_clock_error else log.info("status_sym_clock_error {}".format(self.status_sym_clock_error ))
        
        # Collect tx meas results to file
        with open(self.param["tx_results"], "a+") as out_file:
            utils.print_and_log(out_file, "{:s},{:s},{:s},{:s},{:s},{:s},{:s},{:s},{:s},{:s},{:s},{:s},{:s},{:s},{:s},{:s},{:s},{:s},{:s},{:s},{:s},{:s},{:s},{:s},{:s},".format(
                                ctime(),
                                str((self.param['temperature'])),
                                ("ch_{}").format(self.rf_if),
                                str((self.param['rate'])),
                                str(self.param['pad']),
                                str(self.param['ch_freq']),
                                str(self.param['tx_power']),
                                str(measurement ["rmsPowerNoGap"]),
                                "<"+str(self.consts.expected['EXPECTED_LO_LEAKAGE_DBC']),
                                str(measurement[ "dcLeakageDbc" ]),
                                "<"+str(self.consts.expected['EXPECTED_TX_EVM_DB']),
                                str(measurement[ "evmAll" ]),
                                str(self.consts.expected['EXPECTED_TX_IQIMBALANCE_GAIN_LOW_DB']),
                                str(measurement[ "ampErrDb" ]),
                                str(self.consts.expected['EXPECTED_TX_IQIMBALANCE_GAIN_HIGH_DB']),
                                str(self.consts.expected['EXPECTED_TX_IQIMBALANCE_PHASE_LOW_DEG']),
                                str(measurement[ "phaseErr" ]),
                                str(self.consts.expected['EXPECTED_TX_IQIMBALANCE_PHASE_HIGH_DEG']),
                                str(self.consts.expected['EXPECTED_TX_FREQ_ERROR_LOW_KHZ']),
                                str((measurement[ "freqErr" ])/1e3),
                                str(self.consts.expected['EXPECTED_TX_FREQ_ERROR_HIGH_KHZ']),
                                str(self.consts.expected['EXPECTED_TX_SYMBOL_CLK_ERROR_LOW_PPM']),
                                str(measurement[ "clockErr" ]),
                                str(self.consts.expected['EXPECTED_TX_SYMBOL_CLK_ERROR_HIGH_PPM']),
                                str(fails_list).replace(",",";")))
        
        if self.param["calibration_enable"]:
            results_collect.update( { "ch_{} tx power@{}dBm".format(self.rf_if, self.param['tx_power']): [ measurement ["rmsPowerNoGap"], self.status_tx_power ] } )
            results_collect.update( { "ch_{} tx evm@{}dBm".format(self.rf_if, self.param['tx_power']): [ measurement[ "evmAll" ], self.status_tx_evm ] } )
            results_collect.update( { "ch_{} iq imbalance amplitude error".format(self.rf_if): [ measurement ["ampErrDb"], self.status_tx_iq_ampl_imbalance ] } )
            results_collect.update( { "ch_{} iq imbalance phase error".format(self.rf_if): [ measurement ["phaseErr"], self.status_tx_iq_phase_imbalance ] } )
            results_collect.update( { "ch_{} dc lo leakage".format(self.rf_if): [ measurement ["dcLeakageDbc"] , self.status_dc_lo_leakage ] } )
            results_collect.update( { "ch_{} frequency error".format(self.rf_if): [ (measurement ["freqErr"])/1e3 , self.status_freq_error ] } )
            results_collect.update( { "ch_{} symbol clock error".format(self.rf_if): [ measurement ["clockErr"], self.status_sym_clock_error ] } )

            utils.dict_to_file( results_collect, self.param['final_report_file'] )
        else:
            pass
        log.info("Test finished ")