예제 #1
0
    def aftest(self, sn):
        try:
            self.sequence_start(sn, 'aftest', test_software_version)
            self.init()
            #while True:
                #self.fault_none()
                #sleep(.25)
                #self.fault_all()
                #sleep(.25)
            # TP24V, tester self test 24V
            self.step_start('TP24V')
            self.tp24v_voltage = self.read_voltage(
                tp24v_mac, tp24v_channel, tp24v_poly)
            self.step_finish(
                self.tp24v_voltage, '%.2f', 'x > 20.0 and x < 26.0', 'V')
            # TP3P3V, tester self test 3.3V
            self.step_start('TP3P3V')
            self.tp3p3v_voltage = self.read_voltage(
                tp3p3v_mac, tp3p3v_channel, tp3p3v_poly)
            self.step_finish(
            self.tp3p3v_voltage, '%.2f', 'x > 3.1 and x < 3.5', 'V')

            self.step_start('RCB3P3_J6_2')
            self.power_on_rcb3p3()  # power from RCB3P3, pin-1 of J1
            sleep(1)
            self.step_finish(
                self.read_voltage(j6_2_mac, j6_2_channel, j6_2_poly),
                '%.2f', 'x < 2.5', 'V')
            #self.i2c_test()
            if programming_enabled:
                self.program()
        except:
            self.passed = False
            print 'Exception while testing:', sn
            print '-' * 60
            traceback.print_exc(file=sys.stdout)
            print '-' * 60
        finally:
            try:
                self.init()
            except:
                pass
            self.sequence_finish()
            tester.print_outcome(self.passed)
            self.buzz(sn)
예제 #2
0
    def e20pstester(self, wo, sn):
        try:
            self.sequence_start(
                sn, self.__class__.__name__, get_revision())
            self.init()
            vfile = open('results.csv','ab')

            sleep(1)
	    # ----------------------------------------------------------
	    #   Initialize
	    # ----------------------------------------------------------
	    self.eng.call(hl_enb_mac, 'writePin', hl_enb_gpio, True)
	    self.eng.call(fl_enb_mac, 'writePin', fl_enb_gpio, True)
	    # ----------------------------------------------Turn on Power
            self.powerOn()
#            sleep(1)
	    # ----------------------------------------------------------
    #=======================================================
    #                         PASS 1
    #=======================================================
            print "-------------------------------"
            print " Supply Measurement - @ 12 Vin"
            print "-------------------------------"
#            self.step('tp1_12v_meas',
#					(self.eng.read_voltage,
#                     tp1_12v_meas_mac, tp1_12v_meas_channel, tp1_poly),
#					 '%.3f', lim=limit_tp1_12v, unit='V')
		    #TODO -- Insert data log print 
		# ---------------------------Check Input Power Secondary stage (TP3)
#            self.step('tp3_meas',
#					(self.eng.read_voltage,
#                     tp3_24v_meas_mac, tp3_24v_meas_channel, tp3_poly),
#					 '%.3f', lim=limit_tp4_0v, unit='V')
		# ---------------------------Check Input Power Secondary stage (TP5)
            self.step('tp5_5v_meas',
					(self.eng.read_voltage,
                     tp5_5v_meas_mac, tp5_5v_meas_channel, tp5_poly),
					 '%.3f', lim=limit_tp5_5v, unit='V')

#		# -----------------------------------------Check Output Power (TP7)
            self.step('tp7_5v_meas',
					(self.eng.read_voltage,
                     tp5_5v_meas_mac, tp5_5v_meas_channel, tp5_poly),
					 '%.3f', lim=limit_tp7_5v, unit='V')  

		# ---------------------------Check Input Power Secondary stage (TP4)
            self.step('tp4_5v_meas',
					(self.eng.read_voltage,
                     tp4_5v_meas_mac, tp4_5v_meas_channel, tp4_poly),
					 '%.3f', lim=limit_tp4_5v, unit='V')

#	    # ----------------------------------------------------------
#	    #    Setup gpio for Half-Load current loading
#	    # ----------------------------------------------------------
#	    self.eng.call(hl_enb_mac, 'writePin', hl_enb_gpio, True)
#	    self.eng.call(fl_enb_mac, 'writePin', fl_enb_gpio, True)
#	    # ----------------------------------------------------------
#
#	    # --------------------------------------------Check Input Power (TP1)
#            print "-----------------------------"
#            print "Supply Measurement - Pass 1 B"
#            print "-----------------------------"
#
##            self.step('tp1_12v_meas',
##					(self.eng.read_voltage,
##                     tp1_12v_meas_mac, tp1_12v_meas_channel, tp1_poly),
##					 '%.3f', lim=limit_tp1_12v, unit='V')
#		    #TODO -- Insert data log print 
#		# ---------------------------Check Input Power Secondary stage (TP3)
##            self.step('tp3_12v_meas',
##					(self.eng.read_voltage,
##                     tp3_24v_meas_mac, tp3_24v_meas_channel, tp1_poly),
##					 '%.3f', lim=limit_tp4_0v, unit='V')
#		# ---------------------------Check Input Power Secondary stage (TP5)
#            self.step('tp5_5v_meas',
#					(self.eng.read_voltage,
#                          tp5_5v_meas_mac, tp5_5v_meas_channel, tp5_poly),
#					 '%.3f', lim=limit_tp5_5v, unit='V')
#
#
##		# -----------------------------------------Check Output Power (TP7)
#            self.step('tp7_5v_meas',
#					(self.eng.read_voltage,
#                     tp5_5v_meas_mac, tp5_5v_meas_channel, tp5_poly),
#					 '%.3f', lim=limit_tp7_5v, unit='V')  
#
#		# ---------------------------Check Input Power Secondary stage (TP4)
#            self.step('tp4_5v_meas',
#					(self.eng.read_voltage,
#                     tp4_5v_meas_mac, tp4_5v_meas_channel, tp4_poly),
#					 '%.3f', lim=limit_tp4_5v, unit='V')
#
#	    # ----------------------------------------------------------
#	    #    Setup gpio for Half-Load current loading
#	    # ----------------------------------------------------------
#	    self.eng.call(hl_enb_mac, 'writePin', hl_enb_gpio, False)
#	    self.eng.call(fl_enb_mac, 'writePin', fl_enb_gpio, True)
#	    # ----------------------------------------------------------
#            print "-----------------------------"
#            print "Supply Measurement - Pass 1 C"
#            print "-----------------------------"
#
##            self.step('tp1_12v_meas',
##					(self.eng.read_voltage,
##                     tp1_12v_meas_mac, tp1_12v_meas_channel, tp1_poly),
##					 '%.3f', lim=limit_tp1_12v, unit='V')
#		    #TODO -- Insert data log print 
#		# ---------------------------Check Input Power Secondary stage (TP3)
##            self.step('tp3_12v_meas',
##					(self.eng.read_voltage,
##                     tp3_24v_meas_mac, tp3_24v_meas_channel, tp1_poly),
##					 '%.3f', lim=limit_tp4_0v, unit='V')
###                 tp3_24v_meas_channel),)
#		# ---------------------------Check Input Power Secondary stage (TP5)
#            self.step('tp5_5v_meas',
#					(self.eng.read_voltage,
#                     tp5_5v_meas_mac, tp5_5v_meas_channel, tp5_poly),
#					 '%.3f', lim=limit_tp5_5v, unit='V')
#
#
##		# -----------------------------------------Check Output Power (TP7)
#            self.step('tp7_5v_meas',
#					(self.eng.read_voltage,
#                     tp5_5v_meas_mac, tp5_5v_meas_channel, tp5_poly),
#					 '%.3f', lim=limit_tp7_5v, unit='V')  
#
#		# ---------------------------Check Input Power Secondary stage (TP4)
#            self.step('tp4_5v_meas',
#					(self.eng.read_voltage,
#                     tp4_5v_meas_mac, tp4_5v_meas_channel, tp4_poly),
#					 '%.3f', lim=limit_tp4_5v, unit='V')

	    # ----------------------------------------------------------
	    #   Turn Off Power to UUT
	    # ----------------------------------------------------------
            self.powerOff()
	    # ----------------------------------------------------------
	    #   Change Power to 18.0v
	    # ----------------------------------------------------------
            self.k.SetOutVoltage(18.0)
	    # ----------------------------------------------------------
	    #   Turn On Power to UUT
	    # ----------------------------------------------------------
            self.powerOn()
#            sleep(3)
            
#	    # Disable Half Load and full load
	    self.eng.call(hl_enb_mac, 'writePin', hl_enb_gpio, False)
	    self.eng.call(fl_enb_mac, 'writePin', fl_enb_gpio, False)

    #=======================================================
    #                         PASS # 2
    #=======================================================
	    # ----------------------------------------------------------
            print "-------------------------------"
            print " Supply Measurement - @ 18 Vin"
            print "-------------------------------"
#            self.step('tp1_18v_meas',
#					(self.eng.read_voltage,
#                     tp1_12v_meas_mac, tp1_12v_meas_channel, tp1_18_poly),
#					 '%.3f', lim=limit_tp1_18v, unit='V')
		    #TODO -- Insert data log print
#             self.step('tp3_12v_meas',
#			     	(self.eng.read_voltage,
#                     tp3_24v_meas_mac, tp3_24v_meas_channel, tp1_poly),
#					 '%.3f', lim=limit_tp4_0v, unit='V')
 
		# ---------------------------Check Input Power Secondary stage (TP3)
#            self.step('tp3_12v_meas',
#					(self.eng.read_voltage,
#                     tp3_24v_meas_mac, tp3_24v_meas_channel, tp1_poly),
#					 '%.3f', lim=limit_tp4_0v, unit='V')
		# ---------------------------Check Input Power Secondary stage (TP5)
            self.step('tp5_5v_meas',
					(self.eng.read_voltage,
                     tp5_5v_meas_mac, tp5_5v_meas_channel, tp5_poly),
					 '%.3f', lim=limit_tp5_5v, unit='V')

#		# -----------------------------------------Check Output Power (TP7)
            self.step('tp7_5v_meas',
					(self.eng.read_voltage,
                     tp5_5v_meas_mac, tp5_5v_meas_channel, tp5_poly),
					 '%.3f', lim=limit_tp7_5v, unit='V')  

		# ---------------------------Check Input Power Secondary stage (TP4)
            self.step('tp4_5v_meas',
					(self.eng.read_voltage,
                     tp4_5v_meas_mac, tp4_5v_meas_channel, tp4_poly),
					 '%.3f', lim=limit_tp4_5v, unit='V')

#	    # ----------------------------------------------------------
#	    #    Setup gpio for Half-Load current loading
#	    # ----------------------------------------------------------
#	    self.eng.call(hl_enb_mac, 'writePin', hl_enb_gpio, True)
#	    self.eng.call(fl_enb_mac, 'writePin', fl_enb_gpio, True)
#	    # ----------------------------------------------------------
#
#	    # --------------------------------------------Check Input Power (TP1)
#            print "-----------------------------"
#            print "Supply Measurement - Pass 2 B"
#            print "-----------------------------"
#
##            self.step('tp1_18v_meas',
##					(self.eng.read_voltage,
##                     tp1_12v_meas_mac, tp1_12v_meas_channel, tp1_18_poly),
##					 '%.3f', lim=limit_tp1_18v, unit='V')
#		    #TODO -- Insert data log print 
#		# ---------------------------Check Input Power Secondary stage (TP3)
##            self.step('tp3_12v_meas',
##					(self.eng.read_voltage,
##                     tp3_24v_meas_mac, tp3_24v_meas_channel, tp1_poly),
##					 '%.3f', lim=limit_tp4_0v, unit='V')
#		# ---------------------------Check Input Power Secondary stage (TP5)
#            self.step('tp5_5v_meas',
#					(self.eng.read_voltage,
#                     tp5_5v_meas_mac, tp5_5v_meas_channel, tp5_poly),
#					 '%.3f', lim=limit_tp5_5v, unit='V')
#
##		# -----------------------------------------Check Output Power (TP7)
#            self.step('tp7_5v_meas',
#					(self.eng.read_voltage,
#                     tp5_5v_meas_mac, tp5_5v_meas_channel, tp5_poly),
#					 '%.3f', lim=limit_tp7_5v, unit='V')  
#
#		# ---------------------------Check Input Power Secondary stage (TP4)
#            self.step('tp4_5v_meas',
#					(self.eng.read_voltage,
#                     tp4_5v_meas_mac, tp4_5v_meas_channel, tp4_poly),
#					 '%.3f', lim=limit_tp4_5v, unit='V')
#
#
##	    # ----------------------------------------------------------
##	    #    Setup gpio for Half-Load current loading
##	    # ----------------------------------------------------------
#	    self.eng.call(hl_enb_mac, 'writePin', hl_enb_gpio, False)
#	    self.eng.call(fl_enb_mac, 'writePin', fl_enb_gpio, True)
#	    # ----------------------------------------------------------
#            print "-----------------------------"
#            print "Supply Measurement - Pass 2 C"
#            print "-----------------------------"
#
##            self.step('tp1_18v_meas',
##					(self.eng.read_voltage,
##                     tp1_12v_meas_mac, tp1_12v_meas_channel, tp1_18_poly),
##					 '%.3f', lim=limit_tp1_18v, unit='V')
#		    #TODO -- Insert data log print 
#		# ---------------------------Check Input Power Secondary stage (TP3)
##            self.step('tp3_12v_meas',
##					(self.eng.read_voltage,
##                     tp3_24v_meas_mac, tp3_24v_meas_channel, tp1_poly),
##					 '%.3f', lim=limit_tp4_0v, unit='V')
#		# ---------------------------Check Input Power Secondary stage (TP5)
#            self.step('tp5_5v_meas',
#					(self.eng.read_voltage,
#                     tp5_5v_meas_mac, tp5_5v_meas_channel, tp5_poly),
#					 '%.3f', lim=limit_tp5_5v, unit='V')
#
##		# -----------------------------------------Check Output Power (TP7)
#            self.step('tp7_5v_meas',
#					(self.eng.read_voltage,
#                     tp5_5v_meas_mac, tp5_5v_meas_channel, tp5_poly),
#					 '%.3f', lim=limit_tp7_5v, unit='V')  
#
#		# ---------------------------Check Input Power Secondary stage (TP4)
#            self.step('tp4_5v_meas',
#					(self.eng.read_voltage,
#                     tp4_5v_meas_mac, tp4_5v_meas_channel, tp4_poly),
#					 '%.3f', lim=limit_tp4_5v, unit='V')

	    # ----------------------------------------------------------
	    #   Turn Off Power to UUT
	    # ----------------------------------------------------------
            self.powerOff()
	    # ----------------------------------------------------------
	    #   Change Power to 24.0v
	    # ----------------------------------------------------------
            self.k.SetOutVoltage(24.0)
	    # ----------------------------------------------------------
	    #   Turn On Power to UUT
	    # ----------------------------------------------------------
            self.powerOn()
#            sleep(2)
            
#	    # Disable Half Load and full load
	    self.eng.call(hl_enb_mac, 'writePin', hl_enb_gpio, True)
	    self.eng.call(fl_enb_mac, 'writePin', fl_enb_gpio, True)

    #=======================================================
    #                         PASS # 3
    #=======================================================
	    # --------------------------------------------Check Input Power (TP1)
            print "-------------------------------"
            print " Supply Measurement - @ 24 Vin "
            print "-------------------------------"
#            self.step('tp1_24v_meas',
#					(self.eng.read_voltage,
#                     tp1_12v_meas_mac, tp1_12v_meas_channel, tp1_24_poly),
#					 '%.3f', lim=limit_tp1_24v, unit='V')
		    #TODO -- Insert data log print 
		# ---------------------------Check Input Power Secondary stage (TP3)
#            self.step('tp3_12v_meas',
#					(self.eng.read_voltage,
#                     tp3_24v_meas_mac, tp3_24v_meas_channel, tp1_poly),
#					 '%.3f', lim=limit_tp4_0v, unit='V')
		# -----------            self.step('tp3_12v_meas',
#					(self.eng.read_voltage,
#                     tp3_24v_meas_mac, tp3_24v_meas_channel, tp1_poly),
#					 '%.3f', lim=limit_tp4_0v, unit='V')
#----------------Check Input Power Secondary stage (TP5)
            self.step('tp5_5v_meas',
					(self.eng.read_voltage,
                     tp5_5v_meas_mac, tp5_5v_meas_channel, tp5_poly),
					 '%.3f', lim=limit_tp5_5v, unit='V')

#		# -----------------------------------------Check Output Power (TP7)
            self.step('tp7_5v_meas',
					(self.eng.read_voltage,
                     tp5_5v_meas_mac, tp5_5v_meas_channel, tp5_poly),
					 '%.3f', lim=limit_tp7_5v, unit='V')  

		# ---------------------------Check Input Power Secondary stage (TP4)
            self.step('tp4_5v_meas',
					(self.eng.read_voltage,
                     tp4_5v_meas_mac, tp4_5v_meas_channel, tp4_poly),
					 '%.3f', lim=limit_tp4_5v, unit='V')

#	    # ----------------------------------------------------------
#	    #    Setup gpio for Half-Load current loading
#	    # ----------------------------------------------------------
#	    self.eng.call(hl_enb_mac, 'writePin', hl_enb_gpio, False)
#	    self.eng.call(fl_enb_mac, 'writePin', fl_enb_gpio, True)
#	    # ----------------------------------------------------------
##            self.step('tp3_12v_meas',
##					(self.eng.read_voltage,
##                     tp3_24v_meas_mac, tp3_24v_meas_channel, tp1_poly),
##					 '%.3f', lim=limit_tp4_5v, unit='V')
#
#	    # --------------------------------------------Check Input Power (TP1)
#            print "-----------------------------"
#            print "Supply Measurement - Pass 3 B"
#            print "-----------------------------"
#
##            self.step('tp1_24v_meas',
##					(self.eng.read_voltage,
##                     tp1_12v_meas_mac, tp1_12v_meas_channel, tp1_24_poly),
##					 '%.3f', lim=limit_tp1_24v, unit='V')
#		    #TODO -- Insert data log print 
#		# ---------------------------Check Input Power Secondary stage (TP3)
##            self.step('tp3_12v_meas',
##					(self.eng.read_voltage,
##                     tp3_24v_meas_mac, tp3_24v_meas_channel, tp1_poly),
##					 '%.3f', lim=limit_tp4_0v, unit='V')
#		# ---------------------------Check Input Power Secondary stage (TP5)
#            self.step('tp5_5v_meas',
#					(self.eng.read_voltage,
#                     tp5_5v_meas_mac, tp5_5v_meas_channel, tp5_poly),
#					 '%.3f', lim=limit_tp5_5v, unit='V')
#
##		# -----------------------------------------Check Output Power (TP7)
#            self.step('tp7_5v_meas',
#					(self.eng.read_voltage,
#                     tp5_5v_meas_mac, tp5_5v_meas_channel, tp5_poly),
#					 '%.3f', lim=limit_tp7_5v, unit='V')  
#
#		# ---------------------------Check Input Power Secondary stage (TP4)
#            self.step('tp4_5v_meas',
#					(self.eng.read_voltage,
#                     tp4_5v_meas_mac, tp4_5v_meas_channel, tp4_poly),
#					 '%.3f', lim=limit_tp4_5v, unit='V')
#
#
##	    # ----------------------------------------------------------
##	    #    Setup gpio for Half-Load current loading
##	    # ----------------------------------------------------------
#	    self.eng.call(hl_enb_mac, 'writePin', hl_enb_gpio, False)
#	    self.eng.call(fl_enb_mac, 'writePin', fl_enb_gpio, False)
#	    # ----------------------------------------------------------
#            print "-----------------------------"
#            print "Supply Measurement - Pass 3 C"
#            print "-----------------------------"
#
##            self.step('tp1_24v_meas',
##					(self.eng.read_voltage,
##                     tp1_12v_meas_mac, tp1_12v_meas_channel, tp1_24_poly),
##					 '%.3f', lim=limit_tp1_24v, unit='V')
#		    #TODO -- Insert data log print 
##		# ---------------------------Check Input Power Secondary stage (TP3)
##            self.step('tp3_12v_meas',
##					(self.eng.read_voltage,
##                     tp3_24v_meas_mac, tp3_24v_meas_channel, tp1_poly),
##					 '%.3f', lim=limit_tp4_5v, unit='V')
#		# ---------------------------Check Input Power Secondary stage (TP5)
#            self.step('tp5_5v_meas',
#					(self.eng.read_voltage,
#                     tp5_5v_meas_mac, tp5_5v_meas_channel, tp5_poly),
#					 '%.3f', lim=limit_tp5_5v, unit='V')
#
##		# -----------------------------------------Check Output Power (TP7)
#            self.step('tp7_5v_meas',
#					(self.eng.read_voltage,
#                     tp5_5v_meas_mac, tp5_5v_meas_channel, tp5_poly),
#					 '%.3f', lim=limit_tp7_5v, unit='V')  
#
#		# ---------------------------Check Input Power Secondary stage (TP4)
#            self.step('tp4_5v_meas',
#					(self.eng.read_voltage,
#                     tp4_5v_meas_mac, tp4_5v_meas_channel, tp4_poly),
#					 '%.3f', lim=limit_tp4_5v, unit='V')

	    # ----------------------------------------------------------
	    #   Turn Off Power to UUT
	    # ----------------------------------------------------------
          
            self.powerOff()
#            vstring = (time.strftime('%x %X') + "," + hostname + "," + wo  \
#                      + "," + sn + "\n")
            vstring = (time.strftime('%x %X') + "," + wo + ","\
                      + hostname + "," + sn + "," + "\n")
            #write string to file
            print '========---Writing Data to file---======='
            vfile.write(vstring)
            vfile.close()

#------------------------------------------------------------------------
#                           End of Test
#------------------------------------------------------------------------

        except:
            self.powerOff()
            self.passed = False
            print 'Exception while testing:', sn
            print '-' * 60
            traceback.print_exc(file=sys.stdout)
            print '-' * 60
        finally:
            self.powerOff()
            try:
                self.init()
            except:
                pass
            self.sequence_finish()
            tester.print_outcome(self.passed)
            self.alt_buzz(sn)
예제 #3
0
    def aftest(self, sn):
        try:
            self.sequence_start(sn, 'Arc Fault I2C Test', get_revision())
            self.init()
            #self.led_nolight(2)
            #self.led_nolight(3)
            ##LED D30 Test without LED light
            ##self.led_U1(1)
            #thread1 = threading.Thread(target=self.conn_RS485)
            #thread1.start()
            #thread2 = threading.Thread(target=self.led_D35(2))
            #thread2.start()
            #thread3 = threading.Thread(target=self.led_D34(3))
            #thread3.start()
            #thread1.join()
            #thread2.join()
            #thread3.join()

            #elf.led_D35(2)
            #self.led_D34(3)
            #self.led_U4(4)
            #self.led_U5(5)
            #self.led_U6(6)
            #self.led_U7(7)
            #while True:
                #self.fault_none()
                #sleep(.25)
                #self.fault_all()
                #sleep(.25)
            # TP24V, tester self test 24V
            #self.step_start('TP24V')
            #self.tp24v_voltage = self.read_voltage(
                #tp24v_mac, tp24v_channel, tp24v_poly)
            #self.step_finish(
                #self.tp24v_voltage, '%.2f', 'x > 20.0 and x < 26.0', 'V')
            ## TP3P3V, tester self test 3.3V
            #self.step_start('TP3P3V')
            #self.tp3p3v_voltage = self.read_voltage(
                #tp3p3v_mac, tp3p3v_channel, tp3p3v_poly)
            #self.step_finish(
            #self.tp3p3v_voltage, '%.2f', 'x > 3.1 and x < 3.5', 'V')
            #sleep(3)
            ## J6_2 TBD
            #self.step_start('J6_3_J6_2')
            #self.power_on_j6_3()  # power from J6_3, main
            #sleep(2)
            #self.j6_2_voltage = self.read_voltage(
                #j6_2_mac, j6_2_channel, j6_2_poly)
            #self.step_finish(
                #self.j6_2_voltage, '%.2f', 'x > 20.0 and x < 26.0', 'V')
            # D19
            #self.step_start('D19_DROP')
            #self.d19_drop = self.tp24v_voltage - self.j6_2_voltage
            #self.step_finish(
                #self.d19_drop, '%.2f', 'x > -1.0 and x < 2.0', 'V')
            # TP4
            #self.step_start('MAIN_TP4')
            #self.tp4_voltage = self.read_voltage(
                #tp4_mac, tp4_channel, tp4_poly)
            #self.step_finish(
                #self.tp4_voltage, '%.2f', 'x > 20.0 and x < 26.0', 'V')
            #self.led_D23(7)
            #self.led_D30(6)
            #self.led_D1(5)
            ## TP3
            #self.step_start('TP3')
            #self.tp3_voltage = self.read_voltage(tp3_mac, tp3_channel, tp3_poly)
            #self.step_finish(self.tp3_voltage,
                #'%.2f',
                #lim='x > 4.8 and x < 5.2',
                #unit='V')

            ## TP87
            #self.step_start('TP87')
            #self.tp87_voltage = self.read_voltage(
                #tp87_mac, tp87_channel, tp87_poly)
            #self.step_finish(self.tp87_voltage,
                #'%.2f',
                ##lim='x > 1.1 and x < 1.3',
                #unit='V')
            #self.i2c_test()
            #tp3_voltage = self.read_voltage(tp3_mac, tp3_channel, tp3_poly)
            #print 'tp3_voltage =', tp3_voltage
            #self.i2c_test()
            #j6_2_voltage = self.read_voltage(j6_2_mac, j6_2_channel, j6_2_poly)
            #print 'j6_2_voltage =', j6_2_voltage
            #self.i2c_test()
            #self.i2c_test()
            #self.i2c_test()
            # Complex test to measure turn ON and OFF voltages
            #if tp7_alt_test_enabled:
                #self.tp7_alt_test()
            ##self.i2c_test()
            ##self.i2c_test()
            ##self.i2c_test()
            ##self.power_off()
            ##sleep(2)
            ##self.power_on_j6_3()  # power from J6_3, main
            ##sleep(2)
            ##self.i2c_test()
            ##self.i2c_test()
            ##self.i2c_test()
            ## Check 24V on J6_2 while powered from RJ24V
            #self.step_start('RJ24V_J6_2')
            #self.power_on_rj24v()  # power from RJ24V, pin-7 of either J7 or J8
            #sleep(1)
            #self.step_finish(
                #self.read_voltage(j6_2_mac, j6_2_channel, j6_2_poly),
                #'%.2f', 'x > 20.0 and x < 26.0', 'V')
            ## Check 24V on J6_2 while powered from RCB24
            #self.step_start('RCB24_J6_2')
            ##############   DEBUG STEP 5
            #raw_input('(5) Press Enter to Power on rcb24')
            self.power_on_rcb24()  # power from RCB24, pin-8 of J1
            sleep(2)
            #self.step_finish(
             #   self.read_voltage(j6_2_mac, j6_2_channel, j6_2_poly),
              #  '%.2f', 'x > 20.0 and x < 26.0', 'V')
            # Check 24V on J6_2 while powered from RCB3P3
            #self.step_start('RCB3P3_J6_2')
            ##############   DEBUG STEP 6
            #raw_input('(6) Press Enter to Power on rcb3p3')
            self.power_on_rcb3p3()  # power from RCB3P3, pin-1 of J1
            sleep(2)

            #self.step_finish(
                #self.read_voltage(j6_2_mac, j6_2_channel, j6_2_poly),
                #'%.2f',
                ##lim='x < 2.5',
                #lim='x < 3.0',
                #unit='V')
            #self.i2c_test()
            #if programming_enabled:
             #   self.program()
            #if i2c_test_enabled:
             #   self.i2c_test(
           #for i in range(10):
            if sn_test_enabled:
                while True:
                    ###############  DEBUG - Uncomment afterwards
                    self.serial_number_register_write(sn)
                    print "Successful writing to I2C..............."
                    self.step_start('SN_READ_BACK_AFTER_WRITTEN')
                sn_read = self.serial_number_register_read()
                print "SN Read Back is: ", sn_read
                if sn_read != sn:
                    print 'sn_read =', sn_read
                    raise Exception(
                        'ERROR: serial number read %s' % repr(sn_read))
                self.step_finish()
                self.step_start('SN_READ_BACK_AFTER_RESTART')
                self.i2c_restart()
                sn_read = self.serial_number_register_read()
                if sn_read != sn:
                    print 'sn_read =', sn_read
                    raise Exception(
                        'ERROR: serial number read %s' % repr(sn_read))
                self.step_finish()
            #on_delay = 5
            #while on_delay > 0:
                #print 'on_delay =', on_delay
                #self.power_off()
                #sleep(1)
                #self.power_on_rcb3p3()  # power from J6_3, main
                #sleep(on_delay)
                #self.i2c_test()
                #on_delay -= 0.1
            #self.power_on_j6_3()  # power from J6_3, main
            #self.fault_none()
            # Modbus
            #self.modbus_test()
            #sleep(3.5)
            # I2C test
            #self.i2c_test()
            # SEN1P5
            #self.step_start('SEN1P5')
            #self.sen1p5_voltage = self.read_voltage(
                #sen1p5_mac, sen1p5_channel, sen1p5_poly)
            #self.step_finish(self.sen1p5_voltage,
                #'%.2f', 'x > 1.1 and x < 1.9', 'V')
            # FAULT_NONE
            #self.step_start('FAULT_NONE')
            #self.fault_none()
            ## HWDISC
            #if hwdisc_channel:
                #self.step_start('HWDISC')
                ##print 'hwdisc =', \
                ##self.eng.call(hwdisc_mac, 'readPin', hwdisc_gpio)  TBD
                #self.hwdisc_voltage = self.read_voltage(
                    #hwdisc_mac, hwdisc_channel, hwdisc_poly)
                #self.step_finish(
                    #self.hwdisc_voltage,
                    #'%.2f',
                    ##lim='x > -1 and x < 3.4',
                    #unit='V')
            ## DISCRTN
            #self.step_start('DISCRTN')
            #self.discrtn_voltage = self.read_voltage(
                #discrtn_mac, discrtn_channel, discrtn_poly)
            #self.step_finish(
                #self.discrtn_voltage,
                #'%.2f',
                #lim='x > 20.0',
                #unit='V')
            ## HW_INT
            #self.step_start('HW_INT')
            #self.step_finish(
                #self.eng.call(hw_int_mac, 'readPin', hw_int_gpio),
                #lim='x is False')
            ## AF_STATUS
            #sleep(1.0)
            #self.step_start('AF_STATUS')
            #self.step_finish(
                #self.arc_fault_status_register_read(),
                #lim='x == "\\x00\\x00"')
            #self.step_finish()
            ## FAULT_A
            #self.step_start('FAULT_A')

            #self.fault_a()
            #sleep(1.0)
            ## DISCRTN
            #self.step_start('DISCRTN')
            #self.discrtn_voltage = self.read_voltage(
                #discrtn_mac, discrtn_channel, discrtn_poly)
            #self.step_finish(
                #self.discrtn_voltage, '%.2f', 'x < 0.2', 'V')
            ## HW_INT
            #self.step_start('HW_INT')
            #self.step_finish(
                #self.eng.call(hw_int_mac, 'readPin', hw_int_gpio),
                #lim='x is True')
            ## AF_STATUS
            #self.step_start('AF_STATUS')
            #self.step_finish(
                #self.arc_fault_status_register_read(),
                #lim='x == "\\x00\\x0f"')
            #self.step_finish()
            ## FAULT_B
            #self.step_start('FAULT_B')
            #self.fault_b()
            ## DISCRTN
            #self.step_start('DISCRTN')
            #self.discrtn_voltage = self.read_voltage(
                #discrtn_mac, discrtn_channel, discrtn_poly)
            #self.step_finish(
                #self.discrtn_voltage, '%.2f', 'x < 0.2', 'V')
            ## HW_INT
            #self.step_start('HW_INT')
            #self.step_finish(
                #self.eng.call(hw_int_mac, 'readPin', hw_int_gpio),
                #lim='x is True')
            ## AF_STATUS
            #self.step_start('AF_STATUS')
            #self.step_finish(
                #self.arc_fault_status_register_read(),
                #lim='x == "\\x00\\xff"')
            #self.step_finish()
            ## FAULT_C
            #self.step_start('FAULT_C')
            #self.fault_c()
            ## LED Test D25 Fault Indicator
            #self.led_D25(1)
            ## DISCRTN
            #self.step_start('DISCRTN')
            #self.discrtn_voltage = self.read_voltage(
                #discrtn_mac, discrtn_channel, discrtn_poly)
            #self.step_finish(
                #self.discrtn_voltage, '%.2f', 'x < 0.2', 'V')
            ## HW_INT
            #self.step_start('HW_INT')
            #self.step_finish(
                #self.eng.call(hw_int_mac, 'readPin', hw_int_gpio),
                #lim='x is True')
            ## AF_STATUS
            #self.step_start('AF_STATUS')
            #self.step_finish(
                #self.arc_fault_status_register_read(),
                #lim='x == "\\x0f\\xff"')
            #self.step_finish()
            ## FAULT_D
            #self.step_start('FAULT_D')
            #self.fault_d()
            ## DISCRTN
            #self.step_start('DISCRTN')
            #self.discrtn_voltage = self.read_voltage(
                #discrtn_mac, discrtn_channel, discrtn_poly)
            #self.step_finish(
                #self.discrtn_voltage, '%.2f', 'x < 0.2', 'V')
            ## HW_INT
            #self.step_start('HW_INT')
            #self.step_finish(
                #self.eng.call(hw_int_mac, 'readPin', hw_int_gpio),
                #lim='x is True')
            ## AF_STATUS
            #self.step_start('AF_STATUS')
            #self.step_finish(
                #self.arc_fault_status_register_read(),
                #lim='x == "\\xff\\xff"')
            #self.led_D2(4)
            #self.step_finish()
            ## FAULT_RESET
            #self.step_start('FAULT_RESET')
            #self.fault_none()
            #sleep(1.0)
            ## DISCRTN
            #self.step_start('DISCRTN')
            #self.discrtn_voltage = self.read_voltage(
                #discrtn_mac, discrtn_channel, discrtn_poly)
            #self.step_finish(
                #self.discrtn_voltage,
                #'%.2f',
                ##lim='x > 20.0',
                #unit='V')
            ## HW_INT
            #self.step_start('HW_INT')
            #self.step_finish(
                #self.eng.call(hw_int_mac, 'readPin', hw_int_gpio),
                #lim='x is False')
            ## AF_STATUS
            #self.step_start('AF_STATUS')
            #self.step_finish(
                #self.arc_fault_status_register_read(),
                #lim='x == "\\xff\\xff"')

            #self.step_finish()
            ## SENPWR
            #self.step_start('SENPWR')
            #self.senpwr_voltage = self.read_voltage(
                #senpwr_mac, senpwr_channel, senpwr_poly)
            #self.step_finish(self.senpwr_voltage,
                #'%.2f', 'x > 20.0', 'V')
            ## CLEAR_ARC_FAULT_DETECTORS
            #self.step_start('CLEAR_ARC_FAULT_DETECTORS')
            #self.clear_arc_fault_detectors()
            #sleep(1)
            ## AF_STATUS
            #self.step_start('AF_STATUS')
            #self.step_finish(
                #self.arc_fault_status_register_read(),
                #lim='x == "\\x00\\x00"')
            #self.step_finish()
            # J1_6
            #print 'j1_6 =', self.eng.call(j1_6_mac, 'readPin', j1_6_gpio)
            #self.issue_arc_fault_self_test()
            #sleep(1)
            #self.print_arcfault_status()
            #self.force_processor_reboot()
            #sleep(7.5)
            #self.print_arcfault_status()
            #self.issue_arc_fault_self_test()
            #sleep(1)
            #self.print_arcfault_status()
            # AFST
            #print 'afst =', self.eng.call(afst_mac, 'readPin', afst_gpio)
            # AFSTL
            #print 'afstl =', self.eng.call(afstl_mac, 'readPin', afstl_gpio)
        except:
            self.passed = False
            print 'Exception while testing:', sn
            print '-' * 60
            traceback.print_exc(file=sys.stdout)
            print '-' * 60
        finally:
            try:
                self.init()
            except:
                pass
            self.sequence_finish()
            tester.print_outcome(self.passed)
예제 #4
0
    def runtest(self, sn):
        try:
            self.sequence_start(
                sn, self.__class__.__name__, get_revision())
            self.log(
                'tp_3v3_isol_max_error: %.3f[Volt]' % tp_3v3_isol_max_error)
            self.init()
            sleep(1)
	    # ----------------------------------------------------------
	    #   Initialize
	    # ----------------------------------------------------------
	    #TODO    Setup gpio for no current loading
	    # ----------------------------------------------Turn on Power
            self.set_power_state(PowerState.on)
	    # ----------------------------------------------Check Input Power (TP1)
            if input_power_check_enabled:
                self.step(
                    'tp1_24v_meas',
                    [self.eng.read_voltage,
                        tp1_24v_meas_mac,
                        tp1_24v_meas_channel,
                        0.00],
                    '%.3f',
                    retry=5,
                    lim='x > 23.5 and x < 24.5'
		    #TODO -- Insert data log print 
                    )
		# ----------------------------------------------Check Input Power Secondary stage (TP3)
		self.step(
		    'tp3_24v_meas',
		    [self.eng.read_voltage,
		        tp3_24v_meas_mac,
		        tp3_24v_meas_channel,
		        0.00],
		    '%.3f',
		    retry=5,
		    lim='x > 23.5 and x < 24.5'
		    #TODO -- Insert data log output
		    )
		# ----------------------------------------------Check Input Power Secondary stage (TP4)
		self.step(
		    'tp4_5v_meas',
		    [self.eng.read_voltage,
		        tp4_5v_meas_mac,
		        tp4_5v_meas_channel,
		        0.00],
		    '%.3f',
		    retry=5,
		    lim='x > 4.75 and x < 5.25'
		    #TODO -- Insert data log output
		    )
		# ----------------------------------------------Check Input Power Secondary stage (TP5)
		self.step(
		    'tp5_5v_meas',
		    [self.eng.read_voltage,
		        tp4_5v_meas_mac,
		        tp4_5v_meas_channel,
		        0.00],
		    '%.3f',
		    retry=5,
		    lim='x > 4.75 and x < 5.25'
		    #TODO -- Insert data log output
		    )
		# ----------------------------------------------Check Output Power (TP7)
		self.step(
		    'tp7_5v_meas',
		    [self.eng.read_voltage,
		        tp7_5v_meas_mac,
		        tp7_5v_meas_channel,
		        0.00],
		    '%.3f',
		    retry=5,
		    lim='x > 4.75 and x < 5.25'
		    #TODO -- Insert data log output
		    )
	    # ----------------------------------------------------------
	    #    Setup gpio for Half-Load current loading
	    # ----------------------------------------------------------
	    #hl_enb_mac
	    # Enable Half Load
	    self.eng.call(hl_enb_mac, 'setPinDir', hl_enb_gpio, True)
	    self.eng.call(hl_enb_mac, 'writePin', hl_enb_gpio, False)
	    # ----------------------------------------------Check Output Power under half load(TP7)
	    self.step(
	        'tp7_5v_meas',
	        [self.eng.read_voltage,
	            tp7_5v_meas_mac,
	            tp7_5v_meas_channel,
	            0.00],
	        '%.3f',
	        retry=5,
	        lim='x > 4.75 and x < 5.25'
	        #TODO -- Insert data log output
	        )
	    # ----------------------------------------------------------
	    #    Setup gpio for Half-Load current loading
	    # ----------------------------------------------------------
	    #fl_enb_mac
	    self.eng.call(fl_enb_mac, 'setPinDir', fl_enb_gpio, True)
	    self.eng.call(fl_enb_mac, 'writePin', fl_enb_gpio, False)
	    # ----------------------------------------------Check Output Power under full load(TP7)
	    self.step(
	        'tp7_5v_meas',
	        [self.eng.read_voltage,
	            tp7_5v_meas_mac,
	            tp7_5v_meas_channel,
	            0.00],
	        '%.3f',
	        retry=5,
	        lim='x > 4.75 and x < 5.25'
	        #TODO -- Insert data log output
	        )
	    # ----------------------------------------------------------
	    #   Turn Off Power to UUT
	    # ----------------------------------------------------------
            self.set_power_state(PowerState.off)

            #self.step(
                #'TEMPERATURE',
                #(self.eng.call, eng1_mac, 'getTemperature', self.i2c_address),
                #retry=3,
                #lim='x >= 200 and x <= 350'
                #)
	    # ----------------------------------------------------------
	    #   Current Test
	    # ----------------------------------------------------------
            if current_test_enabled:
                sleep(5)
                self.step(
                    'CURRENT0',
                    self.readCurrent(0),
                    lim='x >= 202 and x <= 207'
                    )
                self.step(
                    'CURRENT1',
                    self.readCurrent(1),
                    lim='x >= 144 and x <= 149'
                    )
                self.step(
                    'CURRENT2',
                    self.readCurrent(2),
                    lim='x >= 126 and x <= 130'
                    )
        except:
            self.passed = False
            print 'Exception while testing:', sn
            print '-' * 60
            traceback.print_exc(file=sys.stdout)
            print '-' * 60
        finally:
            # TBD
            try:
                self.init()
            except:
                pass
            self.sequence_finish()
            tester.print_outcome(self.passed)
            self.buzz(sn)
예제 #5
0
파일: blmaudit.py 프로젝트: GRay63/blmaudit
    def blmtester(self, sn, rfMac,  wo):
        global snap_mac
        global hostname
        
        try:
#            gitrev = get_app_revision()
            self.sequence_start(sn + '_' + wo, 'blmtest', get_revision())
            self.init()
            uut_snap_mac = rfMac
            print 'UUT_SNAP_MAC: ', hexlify(uut_snap_mac)
            vresult = os.path.exists('results.csv')
            if vresult == False:
                #lets create the file.
                try:
                    #lets use the append command. If no file exsists it will create it and open for read/write
                    vfile = open('results.csv','ab')
                except:
                    print('Error in creating the data file.')
                    sys.exit(0)
            else:
                try:
                   #lets use the append command. If it does exists it will open for read/write
                    vfile = open('results.csv','ab')
                except:
                    print('Error in creating the data file.')
                    sys.exit(0)
                                 
                    pass
                        
            sounder.play(sound_test, repeat=False)

            if Powerup_Init:
                self.step('Powerup_Init',(self.powerOn,),
                          lim='x == %s' % "True")
            
            sleep(3)              
# ************************************************************************
#                        Look for BOGUS  NetID and Channel 
# ************************************************************************
            print '*********************************************'
            print '  Setting up for netID = 0x0101 Channel: 1'
            print '*********************************************'
            self.eng.open_usb_serial(eng1_usb_serial)
            self.eng.call(eng1_mac,'saveNvParam', 3, 0x0101)
            sleep(.5)
            self.eng.call(eng1_mac,'saveNvParam', 4, 1)
            sleep(.5)
            self.eng.call(eng1_mac,'saveNvParam', 11, 0x0514)
            self.eng.enable_crc(uut_snap_mac, True, False)
#            self.eng.print_info('eng1', uut_snap_mac)
#            print '--------------------------->     Proper group ID found'
#            self.eng.call(eng1_mac,'reboot')
#            sleep(3)
            
            if SNAP_OS_VERSION:
               self.uut_snappy_os_version_read = self.step(
               'UUT_SNAPPY_OS_VERSION_READ',
               (self.eng.read_snappy_os_version, uut_snap_mac),)          

            if Firmware_Upgrade:
                if self.eng.read_snappy_os_version(uut_snap_mac) !=\
                    uut_snap_os_version:
                    self.step('UUT_SNAP_OS_UPGRADE',
                              (self.firmware_upgrade,
                               uut_snap_mac, SM220_firmware_file),
                               )
                    sleep(30)                  
                    self.eng.call(uut_snap_mac,'reboot')
                    sleep(3)                  
             
#            if SNAP_OS_VERSION:
#               self.uut_snappy_os_version_read = self.step(
#               'UUT_SNAPPY_OS_VERSION_READ',
#               (self.eng.read_snappy_os_version, uut_snap_mac),)          

#                tmp = self.eng.read_snappy_os_version(eng1_mac)
#                print 'Test OS:', str(tmp)
#                tmp = self.eng.read_snappy_os_version(uut_snap_mac)
#                print 'UUT OS:', str(tmp)

#            self.step('Verify_UUT_Script_Erased',
#                (self.eng.call, uut_snap_mac,
#                    'imageName'), lim=('x=="Arcee"')
#                )

            sounder.play(sound_test, repeat=False)

            if Spy_Upload:
                self.step('SPY_UPLOAD',
                         (self.spy_up, uut_snap_mac, uut_test_script))
#            sleep(2)                         
#            self.eng.call(uut_snap_mac,'reboot')
#            sleep(5)                         
            
#            tmp = k.GetReading()
#            print '*********************************************'
#            print tmp
#            print '*********************************************'
            
# ************************************************************************
#                        Change NetID and Channel 
# ************************************************************************
            print '*********************************************'
            print '  Setting up for netID = 0xbeef Channel: 7'
            print '*********************************************'
            self.eng.enable_crc(eng1_mac)
            self.eng.call(eng1_mac,'saveNvParam', 3, 0xbeef)
            self.eng.call(eng1_mac,'saveNvParam', 4, 7)
#            sleep(.5)
#            self.eng.call(eng1_mac,'saveNvParam', 11, 0x0514)
#            sleep(1)
            self.eng.call(eng1_mac,'reboot')
            sleep(3)                         
            self.eng.enable_crc(uut_snap_mac)

#            self.eng.enable_crc(uut_snap_mac, True, False)
            self.eng.print_info('eng1', uut_snap_mac)

            sounder.play(sound_test, repeat=False)

            self.step('Verify_UUT_Script_Loaded',
                (self.eng.call, uut_snap_mac,
                    'imageName'), lim=('x=="Arcee"')
                )

#            self.step('UUT Temp Read',
#                (self.eng.call, uut_snap_mac,
#                    'read_temp'),'x > 17 and x < 30')
#
#            self.step('UUT Input Voltage',
#                (self.eng.call, uut_snap_mac,
#                    'read_input_voltage'),)

            temptmp = self.eng.call(uut_snap_mac,'read_temp')
            print 'Input Voltage = ', temptmp
            vtmp = self.eng.call(uut_snap_mac,'read_input_voltage')
            print 'Input Voltage = ', vtmp

#            self.step('UUT Output Voltage',
#                (self.eng.call, uut_snap_mac,
#                    'read_out_voltage'),'x > 11750 and x < 12250')


            sounder.play(sound_test, repeat=False)

#            tmp = k.GetReading()
#            print '*********************************************'
#            print tmp
#            print '*********************************************'

            sounder.play(sound_test, repeat=False)

            self.eng.enable_crc(eng1_mac)
            self.eng.call(eng1_mac,'saveNvParam', 3, 0x0101)
            self.eng.call(eng1_mac,'saveNvParam', 4, 1)
            sleep(1)
            self.eng.call(eng1_mac,'reboot')
            sleep(5)                         

            self.eng.close_usb_serial(eng1_usb_serial)

            #create string for file
            vstring = time.strftime('%x %X') + "," + hostname + "," + wo + "," + sn + "," + "001C2C1B" + snap_mac_full + "\n"
            #write string to file
            print '========---Writing Data to file---======='
            vfile.write(vstring)
            vfile.close()
            
            self.BK_TurnPSOff()

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#            self.BK_TurnPSOff()
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
        except BaseException as e:
            self.passed = False
            self.ex = '%s%s' % (
                type(e).__name__,
                str(e.args)
                )

            self.eng.enable_crc(eng1_mac)
            self.eng.call(eng1_mac,'saveNvParam', 3, 0x0101)
            self.eng.call(eng1_mac,'saveNvParam', 4, 1)
            sleep(1)
            self.eng.call(eng1_mac,'reboot')
            sleep(5)                         

            self.BK_TurnPSOff()  # Power BK Off in event of failure
            self.tb = traceback.format_exc()
            
            #create string for file
            print '(Exception) Writing Data to file'
            vstring = time.strftime('%x %X') + "," + hostname + "," + wo + "," + sn + "," + "001C2C1B" + snap_mac_full + "\n"
            #write string to file
            vfile.write(vstring)

        finally:
            #try:
             #   self.init()
            #except:
             #   pass
            self.sequence_finish()
            tester.print_outcome(self.passed)
            self.alt_buzz(sn)
예제 #6
0
 def runtest(self, sn):
     try:
         self.sequence_start(
             sn, self.__class__.__name__, get_revision())
         self.log(
             'tp_3v3_isol_max_error: %.3f[Volt]' % tp_3v3_isol_max_error)
         self.init()
         sleep(1)
         if programming_enabled:
             self.step_start('PROGRAMMING')
             self.program()
             self.step_finish()  # PROGRAMMING
         self.set_power_state(PowerState.on)
         if power_voltages_test_enabled:
             self.step(
                 'TP_3V3_UNREG',
                 [self.eng.read_voltage,
                     tp_3v3_unreg_mac,
                     tp_3v3_unreg_channel,
                     tp_3v3_unreg_poly],
                 '%.3f',
                 retry=5,
                 lim='x > 3.5 and x < 4.3'
                 )
             self.step(
                 'TP_3V3_ISOL',
                 self.eng.read_voltage(
                     tp_3v3_isol_mac,
                     tp_3v3_isol_channel,
                     tp_3v3_isol_poly),
                 '%.3f',
                 lim='x > %.3f and x < %.3f' % (
                     3.3 - tp_3v3_isol_max_error,
                     3.3 + tp_3v3_isol_max_error)
                 )
             self.step(
                 'TP_3V_REF',
                 self.eng.read_voltage(
                     tp_3v_ref_mac,
                     tp_3v_ref_channel,
                     tp_3v_ref_poly),
                 '%.3f',
                 lim='x > 2.98 and x < 3.02'
                 )
         self.step_start('ISOLATION')
         self.set_power_state(PowerState.off)
         self.step(
             'PULL_UP_ON',
             self.eng.call(
                 tp_sgnd_mac, 'setPinPullup', tp_sgnd_gpio, True)
             )
         self.step(
             'SGND_HI',
             self.eng.call(
                 tp_sgnd_mac, 'readPin', tp_sgnd_gpio),
             lim='x == True'
             )
         self.step(
             'PULL_UP_OFF',
             self.eng.call(
                 tp_sgnd_mac, 'setPinPullup', tp_sgnd_gpio, False)
             )
         self.set_power_state(PowerState.on)
         self.step_finish()  # ISOLATION
         self.step_start('ADDR_ONE')
         self.set_power_state(PowerState.off)
         self.set_i2c_address(1)
         sleep(1)
         self.step(
             'I2C_INIT',
             self.eng.call(eng1_mac, 'i2cInit', True))
         self.step(
             'SCB_VERSION',
             [self.turnOnAndReadScbVersion],
             lim="x == '%s'" % scb_version_expected)
         self.step(
             'SCB_CHECKSUM',
             self.eng.call(
                 eng1_mac,
                 'getChecksum',
                 self.i2c_address),
             lim='x == %d' % scb_checksum_expected)
         self.step_finish()  # ADDR_ONE
         self.step_start('ADDR_ZERO')
         self.set_power_state(PowerState.off)
         self.set_i2c_address(0)
         sleep(1)
         self.set_power_state(PowerState.on)
         sleep(.5)
         self.step(
             'I2C_INIT',
             self.eng.call(eng1_mac, 'i2cInit', True))
         self.step(
             'SCB_VERSION',
             [self.turnOnAndReadScbVersion],
             lim="x == '%s'" % scb_version_expected)
         self.step(
             'SCB_CHECKSUM',
             self.eng.call(
                 eng1_mac,
                 'getChecksum',
                 self.i2c_address),
             lim='x == %d' % scb_checksum_expected)
         self.step_finish()  # ADDR_ZERO
         if hv_test_enabled:
             self.step(
                 'HV_ZERO',
                 self.eng.call(
                     eng1_mac,
                     'getVoltage',
                     self.i2c_address),
                 lim='x >= -1 and x <= 1'
                 )
             # enable 24V
             self.eng.call(
                 tp_24v_ena_mac,
                 'setPinDir',
                 tp_24v_ena_gpio,
                 True)
             self.eng.call(
                 tp_24v_ena_mac,
                 'writePin',
                 tp_24v_ena_gpio,
                 False)
             sleep(.1)
             self.step(
                 'HV_24V',
                 self.eng.call(
                     eng1_mac,
                     'getVoltage',
                     self.i2c_address),
                 lim='x >= 21 and x <= 26'
                 )
         self.step(
             'TEMPERATURE',
             (self.eng.call, eng1_mac, 'getTemperature', self.i2c_address),
             retry=3,
             lim='x >= 200 and x <= 350'
             )
         if current_test_enabled:
             sleep(5)
             self.step(
                 'CURRENT0',
                 self.readCurrent(0),
                 lim='x >= 202 and x <= 207'
                 )
             self.step(
                 'CURRENT1',
                 self.readCurrent(1),
                 lim='x >= 144 and x <= 149'
                 )
             self.step(
                 'CURRENT2',
                 self.readCurrent(2),
                 lim='x >= 126 and x <= 130'
                 )
         if led_test_enabled:
             self.step(
                 'SET_RED_LED',
                 self.eng.call(
                     eng1_mac,
                     'writeReg',
                     self.i2c_address,
                     0x92,
                     '\x80'),
                 )
             sleep(1)
             self.step(
                 'READ_RED_ON_RED',
                 self.eng.read_voltage(
                     tp_d1_1_mac,
                     tp_d1_1_channel,
                     tp_d1_1_poly),
                 '%.3f',
                 lim='x > 1.711 and x < 1.807'  # centered on 1.759
                 )
             self.step(
                 'READ_GREEN_ON_RED',
                 self.eng.read_voltage(
                     tp_d1_3_mac,
                     tp_d1_3_channel,
                     tp_d1_3_poly),
                 '%.3f',
                 lim='x < 0.3'
                 )
             self.step(
                 'SET_GREEN_LED',
                 self.eng.call(
                     eng1_mac,
                     'writeReg',
                     self.i2c_address,
                     0x92,
                     '\x40'),
                 )
             sleep(1)
             self.step(
                 'READ_GREEN_ON_GREEN',
                 self.eng.read_voltage(
                     tp_d1_3_mac,
                     tp_d1_3_channel,
                     tp_d1_3_poly),
                 '%.3f',
                 lim='x > 1.900 and x < 1.996'  # centered on 1.948
                 )
             self.step(
                 'READ_RED_ON_GREEN',
                 self.eng.read_voltage(
                     tp_d1_1_mac,
                     tp_d1_1_channel,
                     tp_d1_1_poly),
                 '%.3f',
                 lim='x < 0.3'
                 )
         if flash_configuring_enabled:
             self.step(
                 'ERASE_FLASH_BLOCK_ZERO',
                 self.eng.call(
                     eng1_mac,
                     'eraseFlashBlock',
                     self.i2c_address,
                     0),
                 )
             self.step(
                 'ERASE_FLASH_BLOCK_ONE',
                 self.eng.call(
                     eng1_mac,
                     'eraseFlashBlock',
                     self.i2c_address,
                     1),
                 )
             self.step(
                 'SET_NUM_SENSORS',
                 self.eng.call(
                     eng1_mac,
                     'setNumSensors',
                     self.i2c_address,
                     16),
                 )
             self.step(
                 'GET_NUM_SENSORS',
                 self.eng.call(
                     eng1_mac,
                     'readNumSensors',
                     self.i2c_address),
                 lim="x == 16"
                 )
             set_sn = sn[1:]
             #while len(set_sn) < 16:
                 #set_sn += '\x00'
             self.step(
                 'SET_SN',
                 self.eng.call(
                     eng1_mac,
                     'setSerialNumber',
                     self.i2c_address,
                     set_sn),
                 lim='x == 0'
                 )
             get_sn = sn[1:]
             while len(get_sn) < 16:
                 get_sn += '\xff'
             self.step(
                 'GET_SN',
                 self.eng.call(
                     eng1_mac,
                     'getSerialNumber',
                     self.i2c_address),
                 lim="x == %s" % repr(get_sn)
                 )
     except:
         self.passed = False
         print 'Exception while testing:', sn
         print '-' * 60
         traceback.print_exc(file=sys.stdout)
         print '-' * 60
     finally:
         # TBD
         try:
             self.init()
         except:
             pass
         self.sequence_finish()
         tester.print_outcome(self.passed)
         self.buzz(sn)