Exemplo n.º 1
0
    def check_dut_discharge(self):
        """ check auto/self discharge function on each DUT.
        :return: None
        """
        for dut in self.dut_list:
            if dut is None:
                continue
            config = load_test_item(self.config_list[dut.slotnum],
                                    "Self_Measured_Capacitor")
            if(not config["enable"]):
                continue
            if(config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
                continue

            # disable auto discharge
            self.switch_to_mb()
            self.auto_discharge(slot=dut.slotnum, status=False)
            # disable charge
            self.switch_to_dut(dut.slotnum)
            dut.charge(status=False)

            # enable self discharge
            dut.self_discharge(status=True)

        for i in range(SD_COUNTER):
            for dut in self.dut_list:
                if dut is None:
                    continue
                if(not config["enable"]):
                    continue
                if(config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
                    continue

                self.switch_to_dut(dut.slotnum)
                this_cycle = Cycle()
                this_cycle.vin = self.ps.measureVolt()
                try:
                    temperature = dut.check_temp()
                except aardvark.USBI2CAdapterException:
                    # temp ic not ready
                    temperature = 0
                this_cycle.temp = temperature
                this_cycle.counter = self.counter
                this_cycle.time = time.time()
                this_cycle.state = "self_discharge"
                self.ld.select_channel(dut.slotnum)
                this_cycle.vcap = self.ld.read_volt()
                self.counter += 1
                logger.info("dut: {0} status: {1} vcap: {2} "
                            "temp: {3} message: {4} ".
                            format(dut.slotnum, dut.status, this_cycle.vcap,
                                   this_cycle.temp, dut.errormessage))
                dut.cycles.append(this_cycle)
            time.sleep(INTERVAL)

        for dut in self.dut_list:
            if dut is None:
                continue
            config = load_test_item(self.config_list[dut.slotnum],
                                    "Self_Measured_Capacitor")
            if(not config["enable"]):
                continue
            if(config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
                continue
            if dut.status != DUT_STATUS.Idle:
                continue
            cap_list = []
            pre_vcap, pre_time = None, None
            for cycle in dut.cycles:
                if cycle.state == "self_discharge":
                    if pre_vcap is None:
                        pre_vcap = cycle.vcap
                        pre_time = cycle.time
                    else:
                        cur_vcap = cycle.vcap
                        cur_time = cycle.time
                        cap = (cur_time - pre_time)\
                            / (float(config["Resistance"]) * math.log(pre_vcap /
                                                                      cur_vcap))
                        cap_list.append(cap)
            if(len(cap_list) > 0):
                capacitor = sum(cap_list) / float(len(cap_list))
                dut.self_capacitance_measured = capacitor
                logger.debug(cap_list)
            else:
                dut.capacitance_measured = 0
            if not (config["min"] < dut.self_capacitance_measured <
                    config["max"]):
                dut.status = DUT_STATUS.Fail
                dut.errormessage = "Capacitor out of range."
                logger.info("dut: {0} self meas capacitor: {1} message: {2} ".
                            format(dut.slotnum, dut.capacitance_measured,
                                   dut.errormessage))
Exemplo n.º 2
0
    def discharge_dut(self):
        """discharge
        """
        for dut in self.dut_list:
            if dut is None:
                continue
            config = load_test_item(self.config_list[dut.slotnum],
                                    "Discharge")
            if(not config["enable"]):
                continue
            if(config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
                continue
            # disable auto discharge
            self.switch_to_mb()
            self.auto_discharge(slot=dut.slotnum, status=False)
            # disable self discharge
            self.switch_to_dut(dut.slotnum)
            dut.self_discharge(status=False)
            # disable charge
            dut.charge(status=False)

            self.ld.select_channel(dut.slotnum)
            self.current = float(config["Current"].strip("aAvV"))
            self.ld.set_curr(self.current)  # set discharge current
            self.ld.input_on()
            dut.status = DUT_STATUS.Discharging

        # start discharge cycle
        all_discharged = False
        start_time = time.time()
        while(not all_discharged):
            all_discharged = True
            for dut in self.dut_list:
                if dut is None:
                    continue
                config = load_test_item(self.config_list[dut.slotnum],
                                        "Discharge")
                if(not config["enable"]):
                    continue
                if(config["stoponfail"]) & \
                        (dut.status != DUT_STATUS.Discharging):
                    continue
                self.switch_to_dut(dut.slotnum)

                this_cycle = Cycle()
                this_cycle.vin = self.ps.measureVolt()
                try:
                    temperature = dut.check_temp()
                except aardvark.USBI2CAdapterException:
                    # temp ic not ready
                    temperature = 0
                this_cycle.temp = temperature
                this_cycle.counter = self.counter
                this_cycle.time = time.time()

                this_cycle.state = "discharge"
                self.ld.select_channel(dut.slotnum)
                this_cycle.vcap = self.ld.read_volt()
                self.counter += 1

                threshold = float(config["Threshold"].strip("aAvV"))
                max_dischargetime = config["max"]
                min_dischargetime = config["min"]

                discharge_time = this_cycle.time - start_time
                dut.discharge_time = discharge_time
                if(discharge_time > max_dischargetime):
                    all_discharged &= True
                    self.ld.select_channel(dut.slotnum)
                    self.ld.input_off()
                    dut.status = DUT_STATUS.Fail
                    dut.errormessage = "Discharge Time Too Long."
                elif(this_cycle.vcap < threshold):
                    all_discharged &= True
                    self.ld.select_channel(dut.slotnum)
                    self.ld.input_off()
                    if(discharge_time < min_dischargetime):
                        dut.status = DUT_STATUS.Fail
                        dut.errormessage = "Discharge Time Too Short."
                    else:
                        dut.status = DUT_STATUS.Idle    # pass
                else:
                    all_discharged &= False
                dut.cycles.append(this_cycle)
                logger.info("dut: {0} status: {1} vcap: {2} "
                            "temp: {3} message: {4} ".
                            format(dut.slotnum, dut.status, this_cycle.vcap,
                                   this_cycle.temp, dut.errormessage))
            time.sleep(INTERVAL)
Exemplo n.º 3
0
    def charge_dut(self):
        """charge
        """
        for dut in self.dut_list:
            if dut is None:
                continue
            config = load_test_item(self.config_list[dut.slotnum],
                                    "Charge")
            # print dut.slotnum
            if (not config["enable"]):
                continue
            if (config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
                continue
            # disable auto discharge
            self.switch_to_mb()
            self.auto_discharge(slot=dut.slotnum, status=False)
            self.switch_to_dut(dut.slotnum)
            try:
                # disable self discharge
                dut.self_discharge(status=False)
            except aardvark.USBI2CAdapterException:
                # maybe dut has no power, doesn't response
                pass
            # start charge
            dut.charge(option=config, status=True)
            dut.status = DUT_STATUS.Charging
            # dut.write_ltc3350(0x02, 0x78)
            # dut.write_ltc3350(0x17, 0x01)

        all_charged = False
        self.counter = 0
        start_time = time.time()
        while (not all_charged):
            all_charged = True
            for dut in self.dut_list:
                if dut is None:
                    continue
                config = load_test_item(self.config_list[dut.slotnum],
                                        "Charge")
                if (not config["enable"]):
                    continue
                if (config["stoponfail"]) & \
                        (dut.status != DUT_STATUS.Charging):
                    continue
                self.switch_to_dut(dut.slotnum)

                this_cycle = Cycle()
                this_cycle.vin = self.ps.measureVolt()
                this_cycle.counter = self.counter
                this_cycle.time = time.time()
                try:
                    temperature = dut.check_temp()
                except aardvark.USBI2CAdapterException:
                    # temp ic not ready
                    temperature = 0
                this_cycle.temp = temperature
                this_cycle.state = "charge"
                self.counter += 1

                self.ld.select_channel(dut.slotnum)
                this_cycle.vcap = self.read_volt(dut)

                threshold = float(config["Threshold"].strip("aAvV"))
                max_chargetime = config["max"]
                min_chargetime = config["min"]

                charge_time = this_cycle.time - start_time
                dut.charge_time = charge_time
                if (charge_time > max_chargetime):
                    all_charged &= True
                    dut.status = DUT_STATUS.Fail
                    dut.errormessage = "Charge Time Too Long."
                elif (this_cycle.vcap > threshold):
                    all_charged &= True
                    # dut.charge(status=False)
                    if (charge_time < min_chargetime):
                        dut.status = DUT_STATUS.Fail
                        dut.errormessage = "Charge Time Too Short."
                    else:
                        dut.status = DUT_STATUS.Idle  # pass
                else:
                    all_charged &= False
                dut.cycles.append(this_cycle)
                logger.info("dut: {0} status: {1} vcap: {2} "
                            "temp: {3} message: {4} ".
                            format(dut.slotnum, dut.status, this_cycle.vcap,
                                   this_cycle.temp, dut.errormessage))
            time.sleep(INTERVAL)
Exemplo n.º 4
0
    def check_dut_discharge(self):
        """ check auto/self discharge function on each DUT.
        :return: None
        """
        for dut in self.dut_list:
            if dut is None:
                continue
            config = load_test_item(self.config_list[dut.slotnum],
                                    "Self_Measured_Capacitor")
            if (not config["enable"]):
                continue
            if (config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
                continue

            # disable auto discharge
            self.switch_to_mb()
            self.auto_discharge(slot=dut.slotnum, status=False)
            # disable charge
            self.switch_to_dut(dut.slotnum)
            dut.charge(status=False)

            # enable self discharge
            dut.self_discharge(status=True)

        for i in range(SD_COUNTER):
            for dut in self.dut_list:
                if dut is None:
                    continue
                if (not config["enable"]):
                    continue
                if (config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
                    continue

                self.switch_to_dut(dut.slotnum)
                this_cycle = Cycle()
                this_cycle.vin = self.ps.measureVolt()
                try:
                    temperature = dut.check_temp()
                except aardvark.USBI2CAdapterException:
                    # temp ic not ready
                    temperature = 0
                this_cycle.temp = temperature
                this_cycle.counter = self.counter
                this_cycle.time = time.time()
                this_cycle.state = "self_discharge"
                self.ld.select_channel(dut.slotnum)
                this_cycle.vcap = self.read_volt(dut)
                self.counter += 1
                logger.info("dut: {0} status: {1} vcap: {2} "
                            "temp: {3} message: {4} ".format(
                                dut.slotnum, dut.status, this_cycle.vcap,
                                this_cycle.temp, dut.errormessage))
                dut.cycles.append(this_cycle)
            time.sleep(INTERVAL)

        for dut in self.dut_list:
            if dut is None:
                continue
            config = load_test_item(self.config_list[dut.slotnum],
                                    "Self_Measured_Capacitor")
            if (not config["enable"]):
                continue
            if (config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
                continue
            if dut.status != DUT_STATUS.Idle:
                continue
            cap_list = []
            pre_vcap, pre_time = None, None
            for cycle in dut.cycles:
                if cycle.state == "self_discharge":
                    if pre_vcap is None:
                        pre_vcap = cycle.vcap
                        pre_time = cycle.time
                    else:
                        cur_vcap = cycle.vcap
                        cur_time = cycle.time
                        cap = (cur_time - pre_time) \
                              / (float(config["Resistance"]) * math.log(pre_vcap /
                                                                        cur_vcap))
                        cap_list.append(cap)
            if (len(cap_list) > 0):
                capacitor = sum(cap_list) / float(len(cap_list))
                dut.self_capacitance_measured = capacitor
                logger.debug(cap_list)
            else:
                dut.capacitance_measured = 0
            if not (config["min"] < dut.self_capacitance_measured <
                    config["max"]):
                dut.status = DUT_STATUS.Fail
                dut.errormessage = "Capacitor out of range."
                logger.info(
                    "dut: {0} self meas capacitor: {1} message: {2} ".format(
                        dut.slotnum, dut.capacitance_measured,
                        dut.errormessage))
Exemplo n.º 5
0
    def discharge_dut(self):
        """discharge
        """
        for dut in self.dut_list:
            if dut is None:
                continue
            config = load_test_item(self.config_list[dut.slotnum], "Discharge")
            if (not config["enable"]):
                continue
            if (config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
                continue
            # disable auto discharge
            self.switch_to_mb()
            self.auto_discharge(slot=dut.slotnum, status=False)
            # disable self discharge
            self.switch_to_dut(dut.slotnum)
            dut.self_discharge(status=False)
            # disable charge
            dut.charge(status=False)

            self.ld.select_channel(dut.slotnum)
            self.current = float(config["Current"].strip("aAvV"))
            self.ld.set_curr(self.current)  # set discharge current
            self.ld.input_on()
            dut.status = DUT_STATUS.Discharging

        # start discharge cycle
        all_discharged = False
        start_time = time.time()
        self.ps.setVolt(0.0)
        while (not all_discharged):
            all_discharged = True
            for dut in self.dut_list:
                if dut is None:
                    continue
                config = load_test_item(self.config_list[dut.slotnum],
                                        "Discharge")
                if (not config["enable"]):
                    continue
                if (config["stoponfail"]) & \
                        (dut.status != DUT_STATUS.Discharging):
                    continue
                self.switch_to_dut(dut.slotnum)
                # cap_in_ltc = dut.meas_capacitor()
                # print cap_in_ltc
                this_cycle = Cycle()
                this_cycle.vin = self.ps.measureVolt()
                try:
                    temperature = dut.check_temp()
                except aardvark.USBI2CAdapterException:
                    # temp ic not ready
                    temperature = 0
                this_cycle.temp = temperature
                this_cycle.counter = self.counter
                this_cycle.time = time.time()

                this_cycle.state = "discharge"
                self.ld.select_channel(dut.slotnum)
                this_cycle.vcap = self.read_volt(dut)
                # this_cycle.vcap = self.ld.read_volt()
                self.counter += 1

                threshold = float(config["Threshold"].strip("aAvV"))
                max_dischargetime = config["max"]
                min_dischargetime = config["min"]

                discharge_time = this_cycle.time - start_time
                dut.discharge_time = discharge_time
                if (discharge_time > max_dischargetime):
                    all_discharged &= True
                    self.ld.select_channel(dut.slotnum)
                    self.ld.input_off()
                    dut.status = DUT_STATUS.Fail
                    dut.errormessage = "Discharge Time Too Long."
                elif (this_cycle.vcap < threshold):
                    all_discharged &= True
                    self.ld.select_channel(dut.slotnum)
                    self.ld.input_off()
                    if (discharge_time < min_dischargetime):
                        dut.status = DUT_STATUS.Fail
                        dut.errormessage = "Discharge Time Too Short."
                    else:
                        dut.status = DUT_STATUS.Idle  # pass
                else:
                    all_discharged &= False
                dut.cycles.append(this_cycle)
                logger.info("dut: {0} status: {1} vcap: {2} "
                            "temp: {3} message: {4} ".format(
                                dut.slotnum, dut.status, this_cycle.vcap,
                                this_cycle.temp, dut.errormessage))
            #time.sleep(0)
        self.ps.setVolt(PS_VOLT)
Exemplo n.º 6
0
    def charge_dut(self):
        """charge
        """
        for dut in self.dut_list:
            if dut is None:
                continue
            config = load_test_item(self.config_list[dut.slotnum], "Charge")
            # print dut.slotnum
            if (not config["enable"]):
                continue
            if (config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
                continue
            # disable auto discharge
            self.switch_to_mb()
            self.auto_discharge(slot=dut.slotnum, status=False)
            self.switch_to_dut(dut.slotnum)
            try:
                # disable self discharge
                dut.self_discharge(status=False)
            except aardvark.USBI2CAdapterException:
                # maybe dut has no power, doesn't response
                pass
            # start charge
            dut.charge(option=config, status=True)
            dut.status = DUT_STATUS.Charging
            # dut.write_ltc3350(0x02, 0x78)
            # dut.write_ltc3350(0x17, 0x01)

        all_charged = False
        self.counter = 0
        start_time = time.time()
        while (not all_charged):
            all_charged = True
            for dut in self.dut_list:
                if dut is None:
                    continue
                config = load_test_item(self.config_list[dut.slotnum],
                                        "Charge")
                if (not config["enable"]):
                    continue
                if (config["stoponfail"]) & \
                        (dut.status != DUT_STATUS.Charging):
                    continue
                self.switch_to_dut(dut.slotnum)

                this_cycle = Cycle()
                this_cycle.vin = self.ps.measureVolt()
                this_cycle.counter = self.counter
                this_cycle.time = time.time()
                try:
                    temperature = dut.check_temp()
                except aardvark.USBI2CAdapterException:
                    # temp ic not ready
                    temperature = 0
                this_cycle.temp = temperature
                this_cycle.state = "charge"
                self.counter += 1

                self.ld.select_channel(dut.slotnum)
                this_cycle.vcap = self.read_volt(dut)

                threshold = float(config["Threshold"].strip("aAvV"))
                max_chargetime = config["max"]
                min_chargetime = config["min"]

                charge_time = this_cycle.time - start_time
                dut.charge_time = charge_time
                if (charge_time > max_chargetime):
                    all_charged &= True
                    dut.status = DUT_STATUS.Fail
                    dut.errormessage = "Charge Time Too Long."
                elif (this_cycle.vcap > threshold):
                    all_charged &= True
                    # dut.charge(status=False)
                    if (charge_time < min_chargetime):
                        dut.status = DUT_STATUS.Fail
                        dut.errormessage = "Charge Time Too Short."
                    else:
                        dut.status = DUT_STATUS.Idle  # pass
                else:
                    all_charged &= False
                dut.cycles.append(this_cycle)
                logger.info("dut: {0} status: {1} vcap: {2} "
                            "temp: {3} message: {4} ".format(
                                dut.slotnum, dut.status, this_cycle.vcap,
                                this_cycle.temp, dut.errormessage))
            time.sleep(INTERVAL)