Пример #1
0
    def check_power_fail(self):
        self.switch_to_mb()

        # check power fail io with power on
        for dut in self.dut_list:
            if dut is None:
                continue
            config = load_test_item(self.config_list[dut.slotnum],
                                    "Check_PowerFailInt")
            if (not config["enable"]):
                continue
            if (config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
                continue
            if dut.status != DUT_STATUS.Idle:
                continue

            val = self.read_power_fail_io(dut)

            if (val != int(config["ON"])):
                dut.status = DUT_STATUS.Fail
                dut.errormessage = "check power_fail_int fail."
                logger.info(
                    "dut: {0} status: {1} int_io: {2} message: {3} ".format(
                        dut.slotnum, dut.status, val, dut.errormessage))

        # set power supply to 9V
        self.ps.setVolt(9.0)
        time.sleep(1.5)

        # check power fail io with power below 10
        for dut in self.dut_list:
            if dut is None:
                continue
            config = load_test_item(self.config_list[dut.slotnum],
                                    "Check_PowerFailInt")
            if (not config["enable"]):
                continue
            if (config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
                continue
            if dut.status != DUT_STATUS.Idle:
                continue

            val = self.read_power_fail_io(dut)

            if (val != int(config["OFF"])):
                dut.status = DUT_STATUS.Fail
                dut.errormessage = "check power_fail_int fail."
                logger.info(
                    "dut: {0} status: {1} int_io: {2} message: {3} ".format(
                        dut.slotnum, dut.status, val, dut.errormessage))

        # set power supply to normal
        self.ps.setVolt(PS_VOLT)
Пример #2
0
    def check_power_fail(self):
        self.switch_to_mb()

        # check power fail io with power on
        for dut in self.dut_list:
            if dut is None:
                continue
            config = load_test_item(self.config_list[dut.slotnum],
                                    "Check_PowerFailInt")
            if(not config["enable"]):
                continue
            if(config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
                continue
            if dut.status != DUT_STATUS.Idle:
                continue

            val = self.read_power_fail_io(dut)

            if(val != int(config["ON"])):
                dut.status = DUT_STATUS.Fail
                dut.errormessage = "check power_fail_int fail."
                logger.info("dut: {0} status: {1} int_io: {2} message: {3} ".
                            format(dut.slotnum, dut.status,
                                   val, dut.errormessage))

        # set power supply to 9V
        self.ps.setVolt(9.0)
        time.sleep(1.5)

        # check power fail io with power below 10
        for dut in self.dut_list:
            if dut is None:
                continue
            config = load_test_item(self.config_list[dut.slotnum],
                                    "Check_PowerFailInt")
            if(not config["enable"]):
                continue
            if(config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
                continue
            if dut.status != DUT_STATUS.Idle:
                continue

            val = self.read_power_fail_io(dut)

            if(val != int(config["OFF"])):
                dut.status = DUT_STATUS.Fail
                dut.errormessage = "check power_fail_int fail."
                logger.info("dut: {0} status: {1} int_io: {2} message: {3} ".
                            format(dut.slotnum, dut.status,
                                   val, dut.errormessage))

        # set power supply to normal
        self.ps.setVolt(PS_VOLT)
Пример #3
0
 def calculate_capacitance(self):
     """ calculate the capacitance of DUT, based on vcap list in discharging.
     :return: capacitor value
     """
     for dut in self.dut_list:
         if dut is None:
             continue
         config = load_test_item(self.config_list[dut.slotnum],
                                 "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 == "discharge":
                 if pre_vcap is None:
                     pre_vcap = cycle.vcap
                     pre_time = cycle.time
                 else:
                     pre_vcap = cur_vcap
                     pre_time = cur_time
                     cur_vcap = cycle.vcap
                     cur_time = cycle.time
                     if ( 5.2 < pre_vcap < 6.3) & ( 5.2 < cur_vcap < 6.3):
                         cap = (self.current * (cur_time - pre_time)) \
                               / (pre_vcap - cur_vcap)
                         cap_list.append(cap)
         if (len(cap_list) > 0):
             # for i in range(len(cap_list)):
             #     print cap_list[i],
             capacitor = sum(cap_list) / float(len(cap_list))
             dut.capacitance_measured = capacitor
             # logger.debug(cap_list)
         else:
             dut.capacitance_measured = 0
         if not (config["min"] < dut.capacitance_measured < config["max"]):
             dut.status = DUT_STATUS.Fail
             dut.errormessage = "Capacitor out of range."
             logger.info("dut: {0} capacitor: {1} message: {2} ".
                         format(dut.slotnum, dut.capacitance_measured,
                                dut.errormessage))
Пример #4
0
 def calculate_capacitance(self):
     """ calculate the capacitance of DUT, based on vcap list in discharging.
     :return: capacitor value
     """
     for dut in self.dut_list:
         if dut is None:
             continue
         config = load_test_item(self.config_list[dut.slotnum], "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 == "discharge":
                 if pre_vcap is None:
                     pre_vcap = cycle.vcap
                     pre_time = cycle.time
                 else:
                     pre_vcap = cur_vcap
                     pre_time = cur_time
                     cur_vcap = cycle.vcap
                     cur_time = cycle.time
                     if (5.2 < pre_vcap < 6.3) & (5.2 < cur_vcap < 6.3):
                         cap = (self.current * (cur_time - pre_time)) \
                               / (pre_vcap - cur_vcap)
                         cap_list.append(cap)
         if (len(cap_list) > 0):
             # for i in range(len(cap_list)):
             #     print cap_list[i],
             capacitor = sum(cap_list) / float(len(cap_list))
             dut.capacitance_measured = capacitor
             # logger.debug(cap_list)
         else:
             dut.capacitance_measured = 0
         if not (config["min"] < dut.capacitance_measured < config["max"]):
             dut.status = DUT_STATUS.Fail
             dut.errormessage = "Capacitor out of range."
             logger.info("dut: {0} capacitor: {1} message: {2} ".format(
                 dut.slotnum, dut.capacitance_measured, dut.errormessage))
Пример #5
0
 def check_temperature_dut(self):
     """
     check temperature value of IC on DUT.
     :return: None.
     """
     for dut in self.dut_list:
         if dut is None:
             continue
         config = load_test_item(self.config_list[dut.slotnum],
                                 "Check_Temp")
         if(not config["enable"]):
             continue
         if(config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
             continue
         self.switch_to_dut(dut.slotnum)
         temp = dut.check_temp()
         if not (config["min"] < temp < config["max"]):
             dut.status = DUT_STATUS.Fail
             dut.errormessage = "Temperature out of range."
             logger.info("dut: {0} status: {1} message: {2} ".
                         format(dut.slotnum, dut.status, dut.errormessage))
Пример #6
0
 def check_temperature_dut(self):
     """
     check temperature value of IC on DUT.
     :return: None.
     """
     for dut in self.dut_list:
         if dut is None:
             continue
         config = load_test_item(self.config_list[dut.slotnum],
                                 "Check_Temp")
         if (not config["enable"]):
             continue
         if (config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
             continue
         self.switch_to_dut(dut.slotnum)
         temp = dut.check_temp()
         if not (config["min"] < temp < config["max"]):
             dut.status = DUT_STATUS.Fail
             dut.errormessage = "Temperature out of range."
             logger.info("dut: {0} status: {1} message: {2} ".format(
                 dut.slotnum, dut.status, dut.errormessage))
Пример #7
0
    def check_encryptedic_dut(self):
        """ check the data in encrypted ic, if data is not all zero, dut is
        passed.
        :return: None
        """
        for dut in self.dut_list:
            if dut is None:
                continue
            config = load_test_item(self.config_list[dut.slotnum],
                                    "Check_EncryptedIC")
            if (not config["enable"]):
                continue
            if (config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
                continue
            if dut.status != DUT_STATUS.Idle:
                continue

            self.switch_to_dut(dut.slotnum)
            if (not dut.encrypted_ic()):
                dut.status = DUT_STATUS.Fail
                dut.errormessage = "Check I2C on Encrypted IC Fail."
                logger.info("dut: {0} status: {1} message: {2} ".format(
                    dut.slotnum, dut.status, dut.errormessage))
Пример #8
0
    def check_encryptedic_dut(self):
        """ check the data in encrypted ic, if data is not all zero, dut is
        passed.
        :return: None
        """
        for dut in self.dut_list:
            if dut is None:
                continue
            config = load_test_item(self.config_list[dut.slotnum],
                                    "Check_EncryptedIC")
            if(not config["enable"]):
                continue
            if(config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
                continue
            if dut.status != DUT_STATUS.Idle:
                continue

            self.switch_to_dut(dut.slotnum)
            if(not dut.encrypted_ic()):
                dut.status = DUT_STATUS.Fail
                dut.errormessage = "Check I2C on Encrypted IC Fail."
                logger.info("dut: {0} status: {1} message: {2} ".
                            format(dut.slotnum, dut.status, dut.errormessage))
Пример #9
0
    def program_dut(self):
        """ program vpd of DUT.
        :return: None
        """
        for dut in self.dut_list:
            if dut is None:
                continue
            config = load_test_item(self.config_list[dut.slotnum],
                                    "Program_VPD")
            if (not config["enable"]):
                continue
            if (config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
                continue
            self.switch_to_dut(dut.slotnum)

            try:
                dut.write_vpd(config["File"], config["PGEMID"])
                dut.read_vpd()
                dut.program_vpd = 1
            except AssertionError:
                dut.status = DUT_STATUS.Fail
                dut.errormessage = "Programming VPD Fail"
                logger.info("dut: {0} status: {1} message: {2} ".format(
                    dut.slotnum, dut.status, dut.errormessage))
Пример #10
0
    def program_dut(self):
        """ program vpd of DUT.
        :return: None
        """
        for dut in self.dut_list:
            if dut is None:
                continue
            config = load_test_item(self.config_list[dut.slotnum],
                                    "Program_VPD")
            if(not config["enable"]):
                continue
            if(config["stoponfail"]) & (dut.status != DUT_STATUS.Idle):
                continue
            self.switch_to_dut(dut.slotnum)

            try:
                dut.write_vpd(config["File"], config["PGEMID"])
                dut.read_vpd()
                dut.program_vpd = 1
            except AssertionError:
                dut.status = DUT_STATUS.Fail
                dut.errormessage = "Programming VPD Fail"
                logger.info("dut: {0} status: {1} message: {2} ".
                            format(dut.slotnum, dut.status, dut.errormessage))
Пример #11
0
"""Description:
"""

__version__ = "0.1"
__author__ = "@boqiling"

from UFT.backend import load_config, sync_config, load_test_item

test_uri = "sqlite:///C:\\UFT\\db\\pgem_config.db"
test_folder = "C:\\UFT\\xml\\"

#config = load_config(test_uri, partnumber="AGIGA9601-002BCA", revision="04")
#for item in config.testitems:
#    if(item.name == "Charge"):
#        Charge_Option = item
#print Charge_Option.max
#print Charge_Option.misc


if __name__ == "__main__":
    sync_config(test_uri, test_folder, direction="in")
    config = load_config(test_uri, partnumber="AGIGA9711-004BCA", revision="09")
    charge_settings = load_test_item(config, "Charge")
    print charge_settings
    print charge_settings["ChargeOption"]
    print charge_settings["max"]
    programming = load_test_item(config, "Program_VPD")
    print programming["File"]
    print programming["stoponfail"]
    print programming["enable"]
Пример #12
0
def run():
    # aardvark
    adk = aardvark.Adapter()
    adk.open(portnum=ADK_PORT)

    # setup dut_list
    dut_list = []
    config_list = []
    for slot in range(TOTAL_SLOTNUM):
        dut = PGEMBase(device=adk, slot=slot, barcode=barcode_list[slot])
        dut.status = DUT_STATUS.Idle
        dut_list.append(dut)

        # load config
        dut_config = load_config(CONFIG_DB, dut.partnumber, dut.revision)
        config_list.append(dut_config)

    # setup load
    ld = load.DCLoad(port=LD_PORT, timeout=LD_DELAY)
    for slot in range(TOTAL_SLOTNUM):
        ld.select_channel(slot)
        ld.input_off()
        ld.protect_on()
        ld.change_func(load.DCLoad.ModeCURR)
        #ld.set_curr(0.8)    # discharge current, should be in dut config.

    # setup main power 12V
    ps = pwr.PowerSupply()
    ps.selectChannel(node=PS_ADDR, ch=PS_CHAN)

    setting = {"volt": PS_VOLT, "curr": PS_CURR, "ovp": PS_OVP, "ocp": PS_OCP}
    ps.set(setting)
    ps.activateOutput()
    time.sleep(1)
    volt = ps.measureVolt()
    curr = ps.measureCurr()
    assert (PS_VOLT - 1) < volt < (PS_VOLT + 1)
    assert curr >= 0

    # setup database
    sm = SessionManager()
    my_session = sm.get_session(RESULT_DB)
    sm.prepare_db(RESULT_DB, [DUT, Cycle])

    # charging
    #TODO add time out gauge here.

    counter = 0  # counter for whole charging and discharging

    for slot in range(TOTAL_SLOTNUM):
        charge_config = load_test_item(config_list[slot], "Charge")

        dut_list[slot].switch()  # to dut
        dut_list[slot].charge(option=charge_config, status=True)
        dut_list[slot].slotnum = slot

    all_charged = False
    while (not all_charged):
        all_charged = True
        for slot in range(TOTAL_SLOTNUM):
            charge_config = load_test_item(config_list[slot], "Charge")

            this_cycle = Cycle()
            this_cycle.vin = ps.measureVolt()
            this_cycle.temp = dut_list[slot].check_temp()
            this_cycle.time = counter
            counter += 1

            ld.select_channel(slot)
            this_cycle.vcap = ld.read_volt()

            threshold = float(charge_config["Threshold"].strip("aAvV"))
            if (this_cycle.vcap > threshold):
                all_charged &= True
                dut_list[slot].status = DUT_STATUS.Charged
            else:
                all_charged &= False
            dut_list[slot].cycles.append(this_cycle)
        time.sleep(INTERVAL)

    # programming
    for slot in range(TOTAL_SLOTNUM):
        program_config = load_test_item(config_list[slot], "Program_VPD")
        dut_list[slot].write_vpd(program_config["File"])
        dut_list[slot].read_vpd()

    # discharging
    #TODO add time out gauge here.
    for slot in range(TOTAL_SLOTNUM):
        charge_config = load_test_item(config_list[slot], "Charge")
        discharge_config = load_test_item(config_list[slot], "Discharge")

        dut_list[slot].switch()  # to dut
        dut_list[slot].charge(option=charge_config, status=False)

        ld.select_channel(slot)

        current = float(discharge_config["Current"].strip("aAvV"))
        ld.set_curr(current)  # set discharge current
        ld.input_on()

    all_discharged = False
    while (not all_discharged):
        all_discharged = True
        for slot in range(TOTAL_SLOTNUM):
            discharge_config = load_test_item(config_list[slot], "Discharge")

            this_cycle = Cycle()
            this_cycle.vin = ps.measureVolt()
            this_cycle.temp = dut_list[slot].check_temp()
            this_cycle.time = counter
            counter += 1

            ld.select_channel(slot)
            this_cycle.vcap = ld.read_volt()

            threshold = float(discharge_config["Threshold"].strip("aAvV"))
            if (this_cycle.vcap <= threshold):
                all_discharged &= True
                dut_list[slot].status = DUT_STATUS.Discharged
            else:
                all_discharged &= False
            dut_list[slot].cycles.append(this_cycle)
        time.sleep(INTERVAL)

    # save to database
    for dut in dut_list:
        if (dut.status != DUT_STATUS.Blank):
            my_session.add(dut)
            my_session.commit()
Пример #13
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))
Пример #14
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)
Пример #15
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)
Пример #16
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)
Пример #17
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)
Пример #18
0
def run():
    # aardvark
    adk = aardvark.Adapter()
    adk.open(portnum=ADK_PORT)

    # setup dut_list
    dut_list = []
    config_list = []
    for slot in range(TOTAL_SLOTNUM):
        dut = PGEMBase(device=adk, slot=slot, barcode=barcode_list[slot])
        dut.status = DUT_STATUS.Idle
        dut_list.append(dut)

        # load config
        dut_config = load_config(CONFIG_DB, dut.partnumber, dut.revision)
        config_list.append(dut_config)

    # setup load
    ld = load.DCLoad(port=LD_PORT, timeout=LD_DELAY)
    for slot in range(TOTAL_SLOTNUM):
        ld.select_channel(slot)
        ld.input_off()
        ld.protect_on()
        ld.change_func(load.DCLoad.ModeCURR)
        #ld.set_curr(0.8)    # discharge current, should be in dut config.

    # setup main power 12V
    ps = pwr.PowerSupply()
    ps.selectChannel(node=PS_ADDR, ch=PS_CHAN)

    setting = {"volt": PS_VOLT, "curr": PS_CURR,
               "ovp": PS_OVP, "ocp": PS_OCP}
    ps.set(setting)
    ps.activateOutput()
    time.sleep(1)
    volt = ps.measureVolt()
    curr = ps.measureCurr()
    assert (PS_VOLT-1) < volt < (PS_VOLT+1)
    assert curr >= 0

    # setup database
    sm = SessionManager()
    my_session = sm.get_session(RESULT_DB)
    sm.prepare_db(RESULT_DB, [DUT, Cycle])

    # charging
    #TODO add time out gauge here.

    counter = 0     # counter for whole charging and discharging

    for slot in range(TOTAL_SLOTNUM):
        charge_config = load_test_item(config_list[slot], "Charge")

        dut_list[slot].switch()   # to dut
        dut_list[slot].charge(option=charge_config, status=True)
        dut_list[slot].slotnum = slot

    all_charged = False
    while(not all_charged):
        all_charged = True
        for slot in range(TOTAL_SLOTNUM):
            charge_config = load_test_item(config_list[slot], "Charge")

            this_cycle = Cycle()
            this_cycle.vin = ps.measureVolt()
            this_cycle.temp = dut_list[slot].check_temp()
            this_cycle.time = counter
            counter += 1

            ld.select_channel(slot)
            this_cycle.vcap = ld.read_volt()

            threshold = float(charge_config["Threshold"].strip("aAvV"))
            if(this_cycle.vcap > threshold):
                all_charged &= True
                dut_list[slot].status = DUT_STATUS.Charged
            else:
                all_charged &= False
            dut_list[slot].cycles.append(this_cycle)
        time.sleep(INTERVAL)

    # programming
    for slot in range(TOTAL_SLOTNUM):
        program_config = load_test_item(config_list[slot], "Program_VPD")
        dut_list[slot].write_vpd(program_config["File"])
        dut_list[slot].read_vpd()

    # discharging
    #TODO add time out gauge here.
    for slot in range(TOTAL_SLOTNUM):
        charge_config = load_test_item(config_list[slot], "Charge")
        discharge_config = load_test_item(config_list[slot], "Discharge")

        dut_list[slot].switch()   # to dut
        dut_list[slot].charge(option=charge_config, status=False)

        ld.select_channel(slot)

        current = float(discharge_config["Current"].strip("aAvV"))
        ld.set_curr(current)  # set discharge current
        ld.input_on()

    all_discharged = False
    while(not all_discharged):
        all_discharged = True
        for slot in range(TOTAL_SLOTNUM):
            discharge_config = load_test_item(config_list[slot], "Discharge")

            this_cycle = Cycle()
            this_cycle.vin = ps.measureVolt()
            this_cycle.temp = dut_list[slot].check_temp()
            this_cycle.time = counter
            counter += 1

            ld.select_channel(slot)
            this_cycle.vcap = ld.read_volt()

            threshold = float(discharge_config["Threshold"].strip("aAvV"))
            if(this_cycle.vcap <= threshold):
                all_discharged &= True
                dut_list[slot].status = DUT_STATUS.Discharged
            else:
                all_discharged &= False
            dut_list[slot].cycles.append(this_cycle)
        time.sleep(INTERVAL)

    # save to database
    for dut in dut_list:
        if(dut.status != DUT_STATUS.Blank):
            my_session.add(dut)
            my_session.commit()
Пример #19
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))