Example #1
0
def runBridgeTests(RMList, num_slots, num_tests, verbosity=0):
    print '\n\nBRIDGE TEST\n\n'
    total_passed = 0
    total_failed = 0
    total_neither = 0
    total_number_tests = num_slots * num_tests
    total_test_list = [total_passed, total_failed, total_neither]
    for rm in RMList:
        t.openRM(rm)
        print '\n-------------------- Test RM: '+str(rm)+' --------------------'
        for slot in xrange(num_slots):
            b.write(0x00,[0x06])
            print '\n-------------------- Test Slot: '+str(slot)+' --------------------'
            test_list = bridgeTests(slot,num_tests)
            total_test_list = map(add, total_test_list, test_list)
            daisyChain = q.qCard(webBus("pi5",0), q.QIEi2c[slot])
            print '\n~~~~~~~~~~ QIE Daisy Chain ~~~~~~~~~~'
            print str(daisyChain)
            if verbosity:
                print '\nNumber passed = '+str(test_list[0])
                print 'Number failed = '+str(test_list[1])
                print 'Number neither pass nor fail = '+str(test_list[2])+'\n'

    # Print Final Test Results for Bridge FPGA
    print '\n\n########   Final Test Results  ########\n'
    print 'Total Number of Tests = '+str(total_number_tests)
    print 'Number passed = '+str(total_test_list[0])
    print 'Number failed = '+str(total_test_list[1])
    print 'Number neither pass nor fail = '+str(total_test_list[2])
    print 'Check total number of tests: '+str(total_number_tests == sum(total_test_list))+'\n'
Example #2
0
def runBridgeTests(RMList, num_slots, num_tests, verbosity=0):
    print '\n\nBRIDGE TEST\n\n'
    total_passed = 0
    total_failed = 0
    total_neither = 0
    total_number_tests = num_slots * num_tests
    total_test_list = [total_passed, total_failed, total_neither]
    for rm in RMList:
        t.openRM(rm)
        print '\n-------------------- Test RM: ' + str(
            rm) + ' --------------------'
        for slot in xrange(num_slots):
            b.write(0x00, [0x06])
            print '\n-------------------- Test Slot: ' + str(
                slot) + ' --------------------'
            test_list = bridgeTests(slot, num_tests)
            total_test_list = map(add, total_test_list, test_list)
            daisyChain = q.qCard(webBus("pi5", 0), q.QIEi2c[slot])
            print '\n~~~~~~~~~~ QIE Daisy Chain ~~~~~~~~~~'
            print str(daisyChain)
            if verbosity:
                print '\nNumber passed = ' + str(test_list[0])
                print 'Number failed = ' + str(test_list[1])
                print 'Number neither pass nor fail = ' + str(
                    test_list[2]) + '\n'

    # Print Final Test Results for Bridge FPGA
    print '\n\n########   Final Test Results  ########\n'
    print 'Total Number of Tests = ' + str(total_number_tests)
    print 'Number passed = ' + str(total_test_list[0])
    print 'Number failed = ' + str(total_test_list[1])
    print 'Number neither pass nor fail = ' + str(total_test_list[2])
    print 'Check total number of tests: ' + str(
        total_number_tests == sum(total_test_list)) + '\n'
Example #3
0
	def powerResetPress(self):
		b = webBus(self.piChoiceVar.get(),0)
		for i in [1,2]:
			b.write(0x72,[i])
			b.write(0x74,[0x08])
			b.write(0x70,[0x08,0])
			b.sendBatch()
		print '\n\nPower Reset Completed!\n\n'
Example #4
0
 def powerResetPress(self):
     b = webBus(self.piChoiceVar.get(), 0)
     for i in [1, 2]:
         b.write(0x72, [i])
         b.write(0x74, [0x08])
         b.write(0x70, [0x08, 0])
         b.sendBatch()
     print '\n\nPower Reset Completed!\n\n'
Example #5
0
    def __init__(self, activeSlots, summaryList, suiteSelection, piAddress,
                 iterations, uHTR_slots, user, overwrite):
        '''Create a test stand object filled with necessary RMs, cards'''
        self.bus = webBus(piAddress, 0)
        self.suiteSelection = suiteSelection
        self.iters = iterations
        self.uHTR_slots = uHTR_slots
        self.user = user
        self.filename = sys.stdout.name  # For loggerclass use
        self.backupStdout = sys.stdout
        self.overwrite = overwrite
        self.timeString = "{:%b%d%Y_%H%M%S}".format(datetime.now())

        self.activeSlots = activeSlots
        self.RMs = []

        RM4_active = []
        RM3_active = []
        RM2_active = []
        RM1_active = []

        # Split the memory locations for summaries up based on what
        # RM slot they correspond to.
        RM4_summaries = summaryList[0:4]
        RM3_summaries = summaryList[4:8]
        RM2_summaries = summaryList[8:12]
        RM1_summaries = summaryList[12:16]

        for slot in self.activeSlots:
            if slot in [2, 3, 4, 5]:
                #RM4
                RM4_active.append(slot)
            elif slot in [7, 8, 9, 10]:
                #RM3
                RM3_active.append(slot)
            elif slot in [18, 19, 20, 21]:
                #RM2
                RM2_active.append(slot)
            elif slot in [23, 24, 25, 26]:
                #RM1
                RM1_active.append(slot)

        #initialize RMs
        print '--- Determining which slots contain active cards ---\n'
        self.RMs.append(RM.RM(1, RM1_active, RM1_summaries, self.bus))
        self.RMs.append(RM.RM(2, RM2_active, RM2_summaries, self.bus))
        self.RMs.append(RM.RM(3, RM3_active, RM3_summaries, self.bus))
        self.RMs.append(RM.RM(4, RM4_active, RM4_summaries, self.bus))
        print '\n--- Slot determination finished. Beginning tests ---\n\n'
Example #6
0
    def __init__(self, activeSlots, summaryList, suiteSelection, piAddress, iterations, uHTR_slots, user, overwrite):
        '''Create a test stand object filled with necessary RMs, cards'''
	self.bus = webBus(piAddress, 0)
	self.suiteSelection = suiteSelection	
	self.iters = iterations
	self.uHTR_slots = uHTR_slots
	self.user = user
	self.filename = sys.stdout.name  # For loggerclass use
	self.backupStdout = sys.stdout
	self.overwrite = overwrite
	self.timeString = "{:%b%d%Y_%H%M%S}".format(datetime.now())

        self.activeSlots = activeSlots
        self.RMs = []

        RM4_active = []
        RM3_active = []
        RM2_active = []
        RM1_active = []
	
	# Split the memory locations for summaries up based on what
	# RM slot they correspond to.
	RM4_summaries = summaryList[0:4]
	RM3_summaries = summaryList[4:8]
	RM2_summaries = summaryList[8:12]
	RM1_summaries = summaryList[12:16]

        for slot in self.activeSlots:
            if slot in [2,3,4,5]:
                #RM4
                RM4_active.append(slot)
            elif slot in [7,8,9,10]:
                #RM3
                RM3_active.append(slot)
            elif slot in [18,19,20,21]:
                #RM2
                RM2_active.append(slot)
            elif slot in [23,24,25,26]:
                #RM1
                RM1_active.append(slot)

        #initialize RMs
	print '--- Determining which slots contain active cards ---\n'
        self.RMs.append(RM.RM(1, RM1_active, RM1_summaries, self.bus))
        self.RMs.append(RM.RM(2, RM2_active, RM2_summaries, self.bus))
        self.RMs.append(RM.RM(3, RM3_active, RM3_summaries, self.bus))
        self.RMs.append(RM.RM(4, RM4_active, RM4_summaries, self.bus))
	print '\n--- Slot determination finished. Beginning tests ---\n\n'
Example #7
0
    def magicResetPress(self):
        b = webBus(self.piChoiceVar.get(), 0)
        for ngccm in [1, 2]:  #both ngccm
            b.write(0x72, [ngccm])
            b.write(0x74, [0x08])  # PCA9538 is bit 3 on ngccm mux
            #power on and reset
            #register 3 is control reg for i/o modes
            b.write(0x70, [0x03, 0x00])  # sets all GPIO pins to 'output' mode
            b.write(0x70, [0x01, 0x00])
            b.write(0x70, [0x01, 0x08])
            b.write(0x70, [0x01, 0x18])  # GPIO reset is 10
            b.write(0x70, [0x01, 0x08])
            batch = b.sendBatch()
            print 'initial = ' + str(batch)

        print '\n\nMagic reset completed!\n\n'
        for j in range(2):
            self.qie_magicButton.flash()
Example #8
0
	def magicResetPress(self):
		b = webBus(self.piChoiceVar.get(),0)
		for ngccm in [1,2]: #both ngccm
			b.write(0x72,[ngccm])
			b.write(0x74,[0x08]) # PCA9538 is bit 3 on ngccm mux
			#power on and reset
			#register 3 is control reg for i/o modes
			b.write(0x70,[0x03,0x00]) # sets all GPIO pins to 'output' mode
			b.write(0x70,[0x01,0x00])
			b.write(0x70,[0x01,0x08])
			b.write(0x70,[0x01,0x18]) # GPIO reset is 10
			b.write(0x70,[0x01,0x08])
			batch = b.sendBatch()
			print 'initial = '+str(batch)

		print '\n\nMagic reset completed!\n\n'
		for j in range(2):
			self.qie_magicButton.flash()
Example #9
0
    def __init__(self, activeSlots, summaryList, suiteSelection, piAddress, iterations):
        '''Create a test stand object filled with necessary RMs, cards'''
	self.bus = webBus(piAddress, 0)
	self.suiteSelection = suiteSelection	
	self.iters = iterations

        self.activeSlots = activeSlots
        self.RMs = []

        RM4_active = []
        RM3_active = []
        RM2_active = []
        RM1_active = []

	RM4_summaries = summaryList[0:4]
	RM3_summaries = summaryList[4:8]
	RM2_summaries = summaryList[8:12]
	RM1_summaries = summaryList[12:16]

        for slot in self.activeSlots:
            if slot in [2,3,4,5]:
                #RM4
                RM4_active.append(slot)
            elif slot in [7,8,9,10]:
                #RM3
                RM3_active.append(slot)
            elif slot in [18,19,20,21]:
                #RM2
                RM2_active.append(slot)
            elif slot in [23,24,25,26]:
                #RM1
                RM1_active.append(slot)

        #initialize RMs
	print "--- Determining which slots contain active cards ---\n"
        self.RMs.append(RM.RM(1, RM1_active, RM1_summaries, self.bus))
        self.RMs.append(RM.RM(2, RM2_active, RM2_summaries, self.bus))
        self.RMs.append(RM.RM(3, RM3_active, RM3_summaries, self.bus))
        self.RMs.append(RM.RM(4, RM4_active, RM4_summaries, self.bus))
	print "\n--- Slot determination finished. Beginning tests ---\n\n"
Example #10
0
'''
Goals:
* understand the "spy" register (probably the 200-bit one)
* try to write to a "read only" register and ensure that it didn't work
    * but first, read what's there so that in case you overwrite, you can undo your mistakes...
* understand the SERDES registers (see Microsemi documentation for meanings)
* create functions to read (and if possible) write to internal registers

'''
import sys
sys.path.append('../')
from client import webBus
import QIELib
b = webBus("pi5",0) #can add "pi5,0" so won't print send/receive messages
q = QIELib

##############################
# Conversion Functions
##############################

#give this function a string (like '133 4 92 23') and returns the binary cat
def strToBin(aString):
    j = 0
    catBinary = ""
    for i in aString.split():
        catBinary = catBinary + format(int(aString.split()[j]),'08b')
        j += 1
    return catBinary

# helpful string to hex list
def strToHex(string):
Example #11
0
from client import webBus
from operator import add
import TestLib as t
import QIELib as q
b = webBus("pi6",0)

# Read from Igloo
def readIgloo(slot, address, num_bytes):
    b.write(0x00,[0x06])
    b.write(t.bridgeAddress(slot),[0x11,0x03,0,0,0])
    b.write(0x09,[address])
    b.read(0x09, num_bytes)
    message = b.sendBatch()[-1]
    return t.reverseBytes(message)

# Write to Igloo
def writeIgloo(rm,slot,address,messageList):
    t.openRM(b,rm)
    b.write(0x00,[0x06])
    b.write(t.bridgeAddress(slot),[0x11,0x03,0,0,0])
    b.write(0x09,[address] + messageList)
    message = b.sendBatch()[-1]
    return t.reverseBytes(message)

# Adry's open Igloo function
def openIgloo(rm,slot):
    t.openRM(b,rm)
    #the igloo is value "3" in I2C_SELECT table
    b.write(t.bridgeAddress(slot),[0x11,0x03,0,0,0])
    b.sendBatch()
Example #12
0
 def qie_resetPress(self):
     # Instantiate a webBus member:
     b = webBus(self.piChoiceVar.get(), 0)
     b.write(0x00, [0x06])
     b.sendBatch()
     print '\n\nBackplane for ' + self.piChoiceVar.get() + ' reset!\n\n'
Example #13
0
    def __init__(self, webAddress, address):
        '''create a new test suite object... initialize bus and address'''
        self.bus = client.webBus(webAddress, 0)
        self.address = address
	self.outCard = testSummary()
Example #14
0
from client import webBus
import vttxLib
import TestSoftware.Hardware as Hardware

h = Hardware

b = webBus('pi5',0) #can add 'pi5,0' so won't print send/receive messages
v = vttxLib

slot = 18 # the J_# slot

class Test:
    def __init__(self, bus, address, logfile, iterations = 1):
        self.bus = bus
        self.address = address
        self.logstream = logfile #changed from logstream to logfile
        self.iterations = iterations
    def run(self):
        passes = 0
        for i in xrange(self.iterations): #changed from iterations to self.iterations
            if self.testBody() == True: passes += 1 #changed true to True
        return (passes, self.iterations - passes) #changed fails to (self.iterations - passes)
    def log(self, message):
        logprint(message, file=self.logfile)
    def testBody(self):
        return True

# ------------------------------------------------------------------------
class VTTX_Display(Test):
    def testBody(self):
        print '----------VTTX_Display----------'
Example #15
0
	def qie_resetPress(self):
		# Instantiate a webBus member:
		b = webBus(self.piChoiceVar.get(),0)
		b.write(0x00,[0x06])
		b.sendBatch()
		print '\n\nBackplane for '+self.piChoiceVar.get()+' reset!\n\n'
Example #16
0
import IglooLib_adry as i
import Hardware as h
from client import webBus
import helpers
import time

# i = IglooLib_adry
bus = webBus('pi5', 0)

slot = 2  # the J_# slot


class Test:
    def __init__(self, bus, address, logfile, iterations=1):
        self.bus = bus
        self.address = address
        self.logstream = logfile
        self.iterations = iterations

    def run(self):
        passes = 0
        for i in xrange(self.iterations):
            if self.testBody() == True: passes += 1
        return (passes, self.iterations - passes)

    def log(self, message):
        logprint(message, file=self.logfile)

    def testBody(self):
        return True
Example #17
0
from client import webBus
import collections
from checksumClass import Checksum
# bus = webBus("pi5",0)
bus = webBus("pi7",0)

# binDataHappy = '0 01110000 00111100 10000011'
# intDataHappy = '0 112 60 131'
# value = 28732

# Set last two bits of LSB to 0 (these are status bits).
# message = '0 01100011 01010010 01100100'
# 0110'0011'0101'0000 = 25424.

# Trigger T measurement     hold master     1110'0011   0xE3
# Trigger RH measurement    hold master     1110'0101   0xE5
# Trigger T measurement     no hold master  1111'0011   0xF3
# Trigger RH measurement    no hold master  1111'0101   0xF5

def reverse(message):
    mlist = message.split()
    error = mlist.pop(0)
    mlist.reverse()
    return error + " " + " ".join(mlist)

def getValue(message):
    value = ''
    mList = message.split()
    mList = mList[1:-1]
    for byte in xrange(len(mList)):
        initialByte = bin(int(mList[byte]))[2:]
Example #18
0
import sys
sys.path.append("../")
from client import webBus

pi = sys.args[1]
bus = webBus(pi,0)


Example #19
0
from client import webBus
b = webBus("pi6",0)

######################################################
# VTTX Dict
######################################################

# size is in BYTES
vttx = {
    "i2c_select" : {
        1 : [0x01, 0,0,0],
        2 : [0x02, 0,0,0]
        },
    "address"   : 0x7E,
    "size"      : 7      #size of register in bytes
}

######################################################
# Helpful tool functions
######################################################

def isError(ret):
    if (ret[0] != 0): # '0' is non-error value
        return True # error
    else:
        return False # no error

# helpful string decimal to string hex
def strToHex(string):
        catBinary = ""
        j=0
Example #20
0
# Check Checsum!!

from checksumClass import Checksum
from uniqueIDClass import ID
import TestLib as t
from client import webBus
bus6 = webBus("pi6", 0)


def check(bus, rmList, slotList):
    for rm in rmList:
        t.openRM(bus, rm)
        for slot in slotList[4 - rm]:
            print '\nUnique ID'
            uniqueID = ID(bus, slot)
            print uniqueID.raw
            print uniqueID.cooked
            check = Checksum(uniqueID.raw, 0)
            print 'result = ', check.result
            if check.result == 2:
                print 'i2c error'
            if check.result == 1:
                print 'checksum error'
            if check.result == 0:
                print 'checksum ok'


# idA = ID(bus6)
# idB = ID(bus6)
# t.openRM(bus6,2)
#
Example #21
0
import IglooLib_adry as i
import Hardware as h
from client import webBus
import helpers
import time

# i = IglooLib_adry
bus = webBus('pi5',0)

slot = 2 # the J_# slot

class Test:
    def __init__(self, bus, address, logfile, iterations = 1):
        self.bus = bus
        self.address = address
        self.logstream = logfile
        self.iterations = iterations
    def run(self):
        passes = 0
        for i in xrange(self.iterations):
            if self.testBody() == True: passes += 1
        return (passes, self.iterations - passes)
    def log(self, message):
        logprint(message, file=self.logfile)
    def testBody(self):
        return True

# ------------------------------------------------------------------------
class fpgaMajVer(Test): #inherit from Test class, overload testBody() function
    def testBody(self):
        name = "fpgaMajVer"
Example #22
0
# Daisy chain objects must use .write() after changes are made in order to affect chips


##### Imports #####
import sys
sys.path.append("../")
from client import webBus
import Hardware as h
import iglooClass_adry as i
from uniqueID import ID
# from uHTR import uHTR


##### Global Vars #####
pi    = "pi5" # 'pi5' or 'pi6' etc
b     = webBus(pi,0) # webBus sets active pi; 0 = server verbosity off
all_slots = [2,3,4,5,7,8,9,10,18,19,20,21,23,24,25,26]
slots = all_slots # list of active J slots

##### Functions ######

def chargeInjectOn(slots, bus):
    for slot in slots:
        h.SetQInjMode(1, slot, b)
        i.displayCI(bus,slot)

def chargeInjectOff(slots, bus):
    for slot in slots:
        h.SetQInjMode(0, slot, b)
        i.displayCI(bus,slot)
Example #23
0
# Run complete QIE Test Sweet
from client import webBus
import uniqueID
import TestLib
b = webBus("pi5")
u = uniqueID
t = TestLib


def run(RMList, num_slots=4):
    uniqueIDArray = []
    # Iterate through RM 0, 1, 2, 3 (include desired RMs in list)
    for rm in RMList:
        idList = []
        # Iterate through Slot 0, 1, 2, 3 (run for all 4 slots by default)
        for slot in xrange(num_slots):
            idList.append(u.uniqueID(rm, slot))
            # b.clearBus()
        uniqueIDArray.append(idList)
    return uniqueIDArray


### Outdated, not used now! ###
def printRun(RMList, num_slots=4):
    uniqueIDArray = run(RMList, num_slots)
    for rm in RMList:
        for slot in xrange(num_slots):
            print 'RM: ', rm, ' slot: ', slot
            print 'UniqueID (dec): ', t.reverseBytes(uniqueIDArray[rm][slot])
            print 'UniqueID (hex): ', t.toHex(
                t.reverseBytes(uniqueIDArray[rm][slot]))
Example #24
0
from client import webBus
import collections
from Checksum import Check
bus = webBus("pi5",0)
#bus = webBus("pi6",0)

# binDataHappy = '0 01110000 00111100 10000011'
# intDataHappy = '0 112 60 131'
# value = 28732

# Set last two bits of LSB to 0 (these are status bits).
# message = '0 01100011 01010010 01100100'
# 0110'0011'0101'0000 = 25424.

# Trigger T measurement     hold master     1110'0011   0xE3
# Trigger RH measurement    hold master     1110'0101   0xE5
# Trigger T measurement     no hold master  1111'0011   0xF3
# Trigger RH measurement    no hold master  1111'0101   0xF5

def reverse(message):
    mlist = message.split()
    error = mlist.pop(0)
    mlist.reverse()
    return error + " " + " ".join(mlist)

def getValue(message):
    value = ''
    mList = message.split()
    mList = mList[1:-1]
    for byte in xrange(len(mList)):
        initialByte = bin(int(mList[byte]))[2:]
Example #25
0
from client import webBus
import collections
import time
import TestLib as t
from checksumClass import Checksum
bus = webBus("pi6",0)

# binDataHappy = '0 01110000 00111100 10000011'
# intDataHappy = '0 112 60 131'
# value = 28732

# Set last two bits of LSB to 0 (these are status bits).
# message = '0 01100011 01010010 01100100'
# 0110'0011'0101'0000 = 25424.

# Trigger T measurement     hold master     1110'0011   0xE3
# Trigger RH measurement    hold master     1110'0101   0xE5
# Trigger T measurement     no hold master  1111'0011   0xF3
# Trigger RH measurement    no hold master  1111'0101   0xF5

def reverse(message):
    mlist = message.split()
    error = mlist.pop(0)
    mlist.reverse()
    return error + " " + " ".join(mlist)

def getValue(message):
    value = ''
    mList = message.split()
    mList = mList[1:-1]
    for byte in xrange(len(mList)):
    def __init__(self, parent):
        # Create a webBus instance
        self.myBus = client.webBus("pi7",0)

        # Create a permanent address of QCard
        self.address = 0x19

        # Create an instance of initialTests
        self.initialTest = initialTests()

        # Create an instance of cardInformation
        self.cardInfo = cardInformation()

	# Read info from left side?
	self.readFromList = True

        # Make an empty list that will eventually contain all of
        # the active card slots
        self.outSlotNumbers = []

        # Name the parent. This is mostly for bookkeeping purposes
        # and doesn't really get used too much.
        self.myParent = parent

        # Make a placeholder for the shortened unique ID
        self.uniqueIDPass = ""

        self.nameChoiceVar         =  StringVar()
        self.gpioChoiceVar         =  StringVar()
        self.infoCommentVar        =  StringVar()
        self.barcodeEntry          =  StringVar()
        self.uniqueIDEntry         =  StringVar()
        self.tempEntry             =  StringVar()
        self.firmwareVerEntry      =  StringVar()
        self.firmwareVerMinEntry   =  StringVar()
        self.firmwareVerOtherEntry =  StringVar()
        self.iglooToggleEntry      =  StringVar()
        self.iglooMajVerEntry      =  StringVar()
        self.iglooMinVerEntry      =  StringVar()
        self.overwriteVar          =  IntVar()

        # Place an all-encompassing frame in the parent window. All of the following
        # frames will be placed here (topMost_frame) and not in the parent window.
        self.topMost_frame = Frame(parent)
        self.topMost_frame.pack()

        #----- constants for controlling layout
        button_width = 6

        button_padx = "2m"
        button_pady = "1m"

        frame_padx = "3m"
        frame_pady = "2m"
        frame_ipadx = "3m"
        frame_ipady = "1m"
        #---------- end layout constants ------


        ##########################################
        ###                                    ###
        ###     BEGIN MAKING SUB-FRAMES        ###
        ###                                    ###
        ##########################################

        # Make and pack a sub-frame within topMost_frame that will contain
        # all of the controls for non-hardware related test information
        # (i.e. name of tester)
        self.info_frame = Frame(
            self.topMost_frame,
            borderwidth=5, relief=RIDGE,
            height=50,
            background="white",
            )
        self.info_frame.pack(
            side=TOP,
            ipadx=frame_ipadx,
            ipady=frame_ipady,
            padx=frame_padx,
            pady=frame_pady
            )

        # Make a top half-frame
        self.topHalf_frame = Frame(self.topMost_frame)
        self.topHalf_frame.pack(side=TOP)

        # Make a frame for containing an experiment diagram
        self.experiment_frame = Frame(
            self.topHalf_frame,
            borderwidth=5, relief=RIDGE,
            height=580, width=300,
            background="white"
            )
        self.experiment_frame.pack_propagate=(False)
        self.experiment_frame.pack(
            side=RIGHT,
            ipadx=frame_ipadx,
            ipady=frame_ipady,
            padx=frame_padx,
            pady=frame_pady
            )

        # Make a label for the entire right frame
        self.experi_rightFrame = Frame(
            self.topHalf_frame,
            borderwidth=5, relief=RIDGE,
            height=580, width=300,
            background="white"
            )
        self.experi_rightFrame.pack_propagatte=(False)
        self.experi_rightFrame.pack(
            side=LEFT,
            ipadx=frame_ipadx,
            ipady=frame_ipady,
            padx=frame_padx,
            pady=frame_pady
            )

        ##########################################
        ###                                    ###
        ###     BEGIN MAKING WIDGETS           ###
        ###                                    ###
        ##########################################

        ######################################
        #####                            #####
        #####    Widgets in info frame   #####
        #####                            #####
        ######################################

        # Make and pack a text label for name selector
        self.info_Label = Label(self.info_frame, text="Testing Information/Parameters")
        self.info_Label.configure(
            padx=button_padx,
            pady=button_pady,
            background="white"
            )
        self.info_Label.pack(side=TOP)

        # Make a sub-sub-frame within the frame to hold another label and a dropdown box
        self.info_subTop_frame = Frame(self.info_frame,background="white")
        self.info_subTop_frame.pack(
            side=TOP,
            ipadx=frame_ipadx,
            ipady=frame_ipady,
            padx=frame_padx,
            pady=frame_pady
            )

        # Make a sub-sub-frame within the frame to hold comment box
        self.info_subBot_frame = Frame(self.info_frame,background="white")
        self.info_subBot_frame.pack(
            side=TOP,
            ipadx=frame_ipadx,
            ipady=frame_ipady,
            padx=frame_padx,
            pady=frame_pady
            )

        # Make a label for the name drop-down:
        self.info_nameLabel = Label(self.info_subTop_frame, text="Tester Name: ")
        self.info_nameLabel.configure(
            padx=button_padx,
            pady=button_pady,
            background="white"
            )
        self.info_nameLabel.pack(side=LEFT)

        # Make and pack a listbox to pick which QIE card to talk to:
        self.info_nameBox = OptionMenu(self.info_subTop_frame, self.nameChoiceVar,
                          "Shaun Hogan","Caleb Smith","Adryanna Smith","Jordan Potarf",
                          "John Lawrence","Andrew Baas","Mason Dorseth","Josh Hiltbrand")
        self.info_nameBox.pack(side=LEFT)
        self.nameChoiceVar.set("Choose Name") # initializes the OptionMenu

        # Make a label for the name drop-down:
        self.info_commentLabel = Label(self.info_subBot_frame, text="User Testing Comments: ")
        self.info_commentLabel.configure(
            padx=button_padx,
            pady=button_pady,
            background="white"
            )
        self.info_commentLabel.pack(side=LEFT)

        # Make a entrybox for testing comments
        self.info_commentBox = Entry(
            self.info_subBot_frame,
            textvariable=self.infoCommentVar
            )
        self.info_commentBox.pack(side=LEFT)

        ######################################
        #####                            #####
        #####  Experiment Setup Frames   #####
        #####                            #####
        ######################################

        self.testLabelList = ["Res_1","Res_2","Res_3","Res_4",
                          "Res_5","Res_6","Res_7","Res_8",
                      "Res_9","Res_10","Res_11", "Res_12",
                      "Res_13", "Res_14", "Res_15", "SuplCur", "Vis", "Program",
                      "Res_16"]

        # Make a label for the entire left frame
        self.experi_subFrame_lbl = Label(self.experiment_frame,text="QIE Card Setup & Parameters")
        self.experi_subFrame_lbl.configure(
            padx=button_padx,
            pady=button_pady,
            background="white"
            )
        self.experi_subFrame_lbl.pack(side=TOP)

        # Make top 2_7 subframe
        self.experi_subTop2_7_frame = Frame(self.experiment_frame, bg="white")
        self.experi_subTop2_7_frame.pack(
            side=TOP,
            ipadx=frame_ipadx, padx=frame_padx,
            ipady=frame_ipady, pady=frame_pady,
            )

        # Make top 2_8 subframe
        self.experi_subTop2_8_frame = Frame(self.experiment_frame, bg="white")
        self.experi_subTop2_8_frame.pack(
            side=TOP,
            ipadx=frame_ipadx, padx=frame_padx,
            ipady=frame_ipady, pady=frame_pady,
            )

        # Make top 2_6 subframe
        self.experi_subTop2_6_frame = Frame(self.experiment_frame, bg="white")
        self.experi_subTop2_6_frame.pack(
            side=TOP,
            ipadx=frame_ipadx, padx=frame_padx,
            ipady=frame_ipady, pady=frame_pady,
            )

        # Make top 2 subframe
        self.experi_subTop2_frame = Frame(self.experiment_frame,background="white")
        self.experi_subTop2_frame.pack(
            side=TOP,
            ipadx=frame_ipadx,
            ipady=frame_ipady,
            padx=frame_padx,
            pady=frame_pady
            )

        # Make top 2_0 subframe
        self.experi_subTop2_0_frame = Frame(self.experiment_frame,background="white")
        self.experi_subTop2_0_frame.pack(
            side=TOP,
            ipadx=frame_ipadx,
            ipady=frame_ipady,
            padx=frame_padx,
            pady=frame_pady
            )

        # Make top 2_1 subframe
        self.experi_subTop2_1_frame = Frame(self.experiment_frame,background="white")
        self.experi_subTop2_1_frame.pack(
            side=TOP,
            ipadx=frame_ipadx,
            ipady=frame_ipady,
            padx=frame_padx,
            pady=frame_pady
            )

        # Make top 2_2 subframe
        self.experi_subTop2_2_frame = Frame(self.experiment_frame,background="white")
        self.experi_subTop2_2_frame.pack(
            side=TOP,
            ipadx=frame_ipadx,
            ipady=frame_ipady,
            padx=frame_padx,
            pady=frame_pady
            )

        # Make top 2_3 subframe
        self.experi_subTop2_3_frame = Frame(self.experiment_frame,background="white")
        self.experi_subTop2_3_frame.pack(
            side=TOP,
            ipadx=frame_ipadx,
            ipady=frame_ipady,
            padx=frame_padx,
            pady=frame_pady
            )

        # Make top 2_4 subframe
        self.experi_subTop2_4_frame = Frame(self.experiment_frame,background="white")
        self.experi_subTop2_4_frame.pack(
            side=TOP,
            ipadx=frame_ipadx,
            ipady=frame_ipady,
            padx=frame_padx,
            pady=frame_pady
            )

        # Make top 2_4_5 subframe
        self.experi_subTop2_4_5_frame = Frame(self.experiment_frame,background="white")
        self.experi_subTop2_4_5_frame.pack(
            side=TOP,
            ipadx=frame_ipadx,
            ipady=frame_ipady,
            padx=frame_padx,
            pady=frame_pady
            )

        # Make top 2_4_6 subframe
        self.experi_subTop_2_4_6_frame = Frame(self.experiment_frame, background="white")
        self.experi_subTop_2_4_6_frame.pack(
            side=TOP,
            ipadx=frame_ipadx,
            ipady=frame_ipady,
            padx=frame_padx,
            pady=frame_pady
            )


        # Make top 2_5 subframe
        self.experi_subTop2_5_frame = Frame(self.experiment_frame,background="white")
        self.experi_subTop2_5_frame.pack(
            side=TOP,
            ipadx=frame_ipadx,
            ipady=frame_ipady,
            padx=frame_padx,
            pady=frame_pady
            )

        ###################################
        ###                             ###
        ###   Subframes on right side   ###
        ###                             ###
        ###################################

        # Make a buffer frame
        self.experi_subTopBuffer_frame = Frame(self.experi_rightFrame,bg="white")
        self.experi_subTopBuffer_frame.pack(
            side=TOP,
            ipady=frame_ipady,
            ipadx=frame_ipadx,
            padx=frame_padx,
            pady=frame_pady
            )

        # Make an "inspections and tests" label
        self.experi_inspections_label = Label(self.experi_subTopBuffer_frame,
                        text="Inspections and Tests")
        self.experi_inspections_label.configure(bg="white")
        self.experi_inspections_label.pack()

        # Make a subframe for the barcode box
        self.experi_barcode_frame = Frame(self.experi_rightFrame, bg="white")
        self.experi_barcode_frame.pack(
            side=TOP,
            ipady=frame_ipady,
            ipadx=frame_ipadx,
            padx=frame_padx,
            pady=frame_pady
            )

        # Make a label for the Barcode entry
        self.experi_barcode_lbl = Label(self.experi_barcode_frame, text="Barcode: ")
        self.experi_barcode_lbl.configure(
            background="white",
            padx=button_padx,
            pady=button_pady,
            )
        self.experi_barcode_lbl.pack(side=LEFT)

        # Make an entry box for the barcode
        # Make a entrybox for testing comments
        self.experi_barcode_entry = Entry(
            self.experi_barcode_frame,
            textvariable=self.barcodeEntry
            )
        self.experi_barcode_entry.pack(side=RIGHT)

        # Make another buffer frame
        self.experi_subTopBuffer2_frame = Frame(self.experi_rightFrame,bg="white")
        self.experi_subTopBuffer2_frame.pack(
            side=TOP,
            ipady=frame_ipady,
            ipadx=frame_ipadx,
            padx=frame_padx,
            pady=frame_pady
            )

        # Make top 3 subframe
        self.experi_subTop3_frame = Frame(self.experi_rightFrame,background="white")
        self.experi_subTop3_frame.pack(
            side=TOP,
            ipadx=frame_ipadx,
            ipady=frame_ipady,
            padx=frame_padx,
            )

        # Make top 3 subframe for text
        self.experi_subTop3_fText = Frame(self.experi_rightFrame,background="white")
        self.experi_subTop3_fText.pack(
            side=TOP,
            ipadx=frame_ipadx,
            ipady=frame_ipady,
            padx=frame_padx,
            )

        # Make top 4 subframe
        self.experi_subTop4_frame = Frame(self.experi_rightFrame,background="white")
        self.experi_subTop4_frame.pack(
            side=TOP,
            ipadx=frame_ipadx,
            padx=frame_padx,
            )

        # Make top 4 subframe for text
        self.experi_subTop4_fText = Frame(self.experi_rightFrame,background="white")
        self.experi_subTop4_fText.pack(
            side=TOP,
            ipadx=frame_ipadx,
            padx=frame_padx,
            )

        # Make top 5 subframe
        self.experi_subTop5_frame = Frame(self.experi_rightFrame,background="white")
        self.experi_subTop5_frame.pack(
            side=TOP,
            ipadx=frame_ipadx,
            padx=frame_padx,
            )

        # Make top 5 subframe for text
        self.experi_subTop5_fText = Frame(self.experi_rightFrame,background="white")
        self.experi_subTop5_fText.pack(
            side=TOP,
            ipadx=frame_ipadx,
            padx=frame_padx,
            )

        # Make top 6 subframe
        self.experi_subTop6_frame = Frame(self.experi_rightFrame,background="white")
        self.experi_subTop6_frame.pack(
            side=TOP,
            ipadx=frame_ipadx,
            padx=frame_padx,
            )

        # Make top 6 subframe for text
        self.experi_subTop6_fText = Frame(self.experi_rightFrame,background="white")
        self.experi_subTop6_fText.pack(
            side=TOP,
            ipadx=frame_ipadx,
            padx=frame_padx,
            )

        # Make top 7 subframe
        self.experi_subTop7_frame = Frame(self.experi_rightFrame,background="white")
        self.experi_subTop7_frame.pack(
            side=TOP,
            ipadx=frame_ipadx,
            ipady=frame_ipady,
            pady=frame_pady,
            padx=frame_padx,
            )


        # Create variables for each manual check (16 placeholders for now)
        self.testPassList = [StringVar() for i in range(0,19)]
        self.testPassState = ("Pass","Fail")

        #################################
        ###               ###
        ###       Info for Card       ###
        ###               ###
        #################################

        # Make a label for the uniqueID entry
        self.experi_uniqueID_lbl = Label(self.experi_subTop2_frame, text="Unique ID: ")
        self.experi_uniqueID_lbl.configure(
            background="white",
            padx=button_padx,
            pady=button_pady,
            )
        self.experi_uniqueID_lbl.pack(side=LEFT)

        # Make an entry box for the UniqueID
        # Make a entrybox for testing comments
        self.experi_uniqueID_entry = Entry(
            self.experi_subTop2_frame,
            textvariable=self.uniqueIDEntry,
            state="readonly"
            )
        self.experi_uniqueID_entry.pack(side=RIGHT)

        # Make a label for the temperature entry
        self.experi_temperature_lbl = Label(self.experi_subTop2_0_frame, text="Temperature: ")
        self.experi_temperature_lbl.configure(
            background="white",
            padx=button_padx,
            pady=button_pady,
            )
        self.experi_temperature_lbl.pack(side=LEFT)

        # Make an entry box for the temperature
        # Make a entrybox for testing comments
        self.experi_temperature_entry = Entry(
            self.experi_subTop2_0_frame,
            textvariable=self.tempEntry,
            state="readonly"
            )
        self.experi_temperature_entry.pack(side=RIGHT)

        # Make a label for the main firmware ver entry
        self.experi_firmwareVer_lbl = Label(self.experi_subTop2_1_frame, text="Bridge Ver (Major): ")
        self.experi_firmwareVer_lbl.configure(
            background="white",
            padx=button_padx,
            pady=button_pady,
            )
        self.experi_firmwareVer_lbl.pack(side=LEFT)

        # Make an entry box for the main firmware ver
        # Make a entrybox for testing comments
        self.experi_firmwareVer_entry = Entry(
            self.experi_subTop2_1_frame,
            textvariable=self.firmwareVerEntry,
            state="readonly"
            )
        self.experi_firmwareVer_entry.pack(side=RIGHT)

        # Make a label for the minor firmware ver entry
        self.experi_firmwareVerMin_lbl = Label(self.experi_subTop2_2_frame, text="Bridge Ver (Minor): ")
        self.experi_firmwareVerMin_lbl.configure(
            background="white",
            padx=button_padx,
            pady=button_pady,
            )
        self.experi_firmwareVerMin_lbl.pack(side=LEFT)

        # Make an entry box for the minor firmware
        # Make a entrybox for testing comments
        self.experi_firmwareVerMin_entry = Entry(
            self.experi_subTop2_2_frame,
            textvariable=self.firmwareVerMinEntry,
            state="readonly"
            )
        self.experi_firmwareVerMin_entry.pack(side=RIGHT)

        # Make a label for the other firmware entry
        self.experi_firmwareVerOther_lbl = Label(self.experi_subTop2_3_frame, text="Bridge Ver (Other): ")
        self.experi_firmwareVerOther_lbl.configure(
            background="white",
            padx=button_padx,
            pady=button_pady,
            )
        self.experi_firmwareVerOther_lbl.pack(side=LEFT)

        # Make an entry box for the other firmware
        # Make a entrybox for testing comments
        self.experi_firmwareVerOther_entry = Entry(
            self.experi_subTop2_3_frame,
            textvariable=self.firmwareVerOtherEntry,
            state="readonly"
            )
        self.experi_firmwareVerOther_entry.pack(side=RIGHT)

        # Make a label for the major igloo firmware entry
        self.experi_iglooMajVer_lbl = Label(self.experi_subTop2_4_frame, text="Igloo Ver (Major): ")
        self.experi_iglooMajVer_lbl.configure(
            background="white",
            padx=button_padx,
            pady=button_pady,
            )
        self.experi_iglooMajVer_lbl.pack(side=LEFT)

        # Make an entry box for the major firmware
        self.experi_iglooMajVer_entry = Entry(
            self.experi_subTop2_4_frame,
            textvariable=self.iglooMajVerEntry,
            state="readonly"
            )
        self.experi_iglooMajVer_entry.pack(side=RIGHT)


        # Make a label for the minor igloo firmware entry
        self.experi_iglooMinVer_lbl = Label(self.experi_subTop2_4_5_frame, text="Igloo Ver (Minor): ")
        self.experi_iglooMinVer_lbl.configure(
            background="white",
            padx=button_padx,
            pady=button_pady,
            )
        self.experi_iglooMinVer_lbl.pack(side=LEFT)

        # Make an entry box for the minor firmware
        self.experi_iglooMinVer_entry = Entry(
            self.experi_subTop2_4_5_frame,
            textvariable=self.iglooMinVerEntry,
            state="readonly"
            )
        self.experi_iglooMinVer_entry.pack(side=RIGHT)

        # Make a label for the igloo toggle check
        self.iglooToggle_label = Label(self.experi_subTop_2_4_6_frame, text="Igloo Toggle Test: ")
        self.iglooToggle_label.configure(bg="white",padx=button_padx,pady=button_pady)
        self.iglooToggle_label.pack(side=LEFT)

        # Make an entry box for the minor firmware
        self.iglooToggle_entry = Entry(
            self.experi_subTop_2_4_6_frame,
            textvariable=self.iglooToggleEntry,
            state="readonly"
            )
        self.iglooToggle_entry.pack(side=RIGHT)


        # Make a button to read the unique ID & firmware LEFT SIDE
        self.experi_uniqueID_left_get = Button(self.experi_subTop2_5_frame, text ="Get Unique ID & Firmware Ver. from Left", command=self.getUniqueIDPress_left)
        self.experi_uniqueID_left_get.configure(bg="CadetBlue1")
        self.experi_uniqueID_left_get.pack(side=TOP)

        # Make a button to read the unique ID & firmware RIGHT SIDE
        self.experi_uniqueID_right_get = Button(self.experi_subTop2_5_frame, text ="Get Unique ID & Firmware Ver. from Right", command=self.getUniqueIDPress_right)
        self.experi_uniqueID_right_get.configure(bg="lemon chiffon")
        self.experi_uniqueID_right_get.pack(side=TOP)

        # Make a button to submit the unique ID & firmware
        self.experi_uniqueID_give = Button(self.experi_subTop2_5_frame, text ="Upload Unique ID & Firmware Ver.", command=self.infoSubmitButtonPress)
        self.experi_uniqueID_give.configure(bg="salmon2")
        self.experi_uniqueID_give.pack(side=TOP)

        # Make a line of hypens
        self.experi_hyphenLine = Label(self.experi_subTop2_6_frame, text="----------------------------------")
        self.experi_hyphenLine.configure(bg="white",padx=button_padx,pady=button_pady)
        self.experi_hyphenLine.pack()

        # Make a label for the GPIO selection
        self.gpioSelect_label = Label(self.experi_subTop2_7_frame, text="Select GPIO Option: ")
        self.gpioSelect_label.configure(bg="white",padx=button_padx,pady=button_pady)
        self.gpioSelect_label.pack(side=LEFT)

        # Make a option menu for GPIO selection
        self.gpioSelect_box = OptionMenu(self.experi_subTop2_7_frame, self.gpioChoiceVar,
                          "J2 and J21","J3 and J20","J4 and J19","J5 and J18",
                          "J7 and J26","J8 and J25","J9 and J24","J10 and J23")
        self.gpioSelect_box.pack(side=LEFT)
        self.gpioChoiceVar.set("J2 and J21")

        # Make a button to submit GPIO option
        self.gpioSelect_bttn = Button(self.experi_subTop2_8_frame, command=self.gpioBttnPress,
                          text="Submit GPIO Choice")
        self.gpioSelect_bttn.configure(bg="CadetBlue1")
        self.gpioSelect_bttn.pack()

        ################################
        ###                          ###
        ###     Visual Tests         ###
        ###                          ###
        ################################

        self.testDescDict = {"Res_1" : "Bkpln to GND", "Res_2" : "1.2V to GND", "Res_3" : "1.5V to GND",
                     "Res_4" : "2.5V to GND", "Res_5" : "3.3V to GND", "Res_6" : "5.0V to GND",
                     "Res_7" : "1.2V to 1.5V", "Res_8" : "1.2V to 2.5V", "Res_9" : "1.2V to 3.3V",
                     "Res_10" : "1.2V to 5.0V", "Res_11" : "1.5V to 2.5V", "Res_12" : "1.5V to 5.0V",
                     "Res_13" : "2.5V to 3.3V", "Res_14" : "2.5V to 5.0V", "Res_15" : "3.3V to 5.0V",
                     "SuplCur" : "Supply Current", "Vis" : "Visual Inspec.", "Program" : "Programming OK", "Res_16" : "1.5V to 3.3V"}

#       self.testPassList = [StringVar() for i in range(0,19)]

#       self.testLabelList = ["Res_1","Res_2","Res_3","Res_4",
#                         "Res_5","Res_6","Res_7","Res_8",
#                     "Res_9","Res_10","Res_11", "Res_12",
#                     "Res_13", "Res_14", "Res_15", "SuplCur", "Vis", "Program",
#                     "Res_16"]

        self.testPassInfo = []

        for i in range(0,4):
            self.testPassInfo.append(OptionMenu(self.experi_subTop3_frame,self.testPassList[i],"Fail","Pass","N/A",command=self.infoValChange))
            self.testPassInfo[i].configure(width=15,bg="#CCDDFF")
            self.testPassList[i].set("N/A")
            self.testPassInfo[i].pack(side=LEFT)

            self.testPassLabel=Label(self.experi_subTop3_fText, text=self.testDescDict[self.testLabelList[i]]+"\n",bg="white")
            self.testPassLabel.configure(width=20)
            self.testPassLabel.pack(side=LEFT)

        for i in range(4,9):
            self.testPassInfo.append(OptionMenu(self.experi_subTop4_frame,self.testPassList[i],"Fail","Pass","N/A",command=self.infoValChange))
            self.testPassInfo[i].configure(width=11, bg="#CCDDFF")
            self.testPassList[i].set("N/A")
            self.testPassInfo[i].pack(side=LEFT)

            self.testPassLabel=Label(self.experi_subTop4_fText, text=self.testDescDict[self.testLabelList[i]]+"\n", bg="white")
            self.testPassLabel.configure(width=15)
            self.testPassLabel.pack(side=LEFT)

        for i in range(9,14):
            self.testPassInfo.append(OptionMenu(self.experi_subTop5_frame,self.testPassList[i],"Fail","Pass","N/A",command=self.infoValChange))
            self.testPassInfo[i].configure(width=11,bg="#CCDDFF")
            self.testPassList[i].set("N/A")
            self.testPassInfo[i].pack(side=LEFT)

            self.testPassLabel=Label(self.experi_subTop5_fText, text=self.testDescDict[self.testLabelList[i]]+"\n", bg="white")
            self.testPassLabel.configure(width=15)
            self.testPassLabel.pack(side=LEFT)

        for i in range(14,19):
            self.testPassInfo.append(OptionMenu(self.experi_subTop6_frame,self.testPassList[i],"Fail","Pass","N/A",command=self.infoValChange))
            self.testPassInfo[i].configure(width=11,bg="#CCDDFF")
            self.testPassList[i].set("N/A")
            self.testPassInfo[i].pack(side=LEFT)

            self.testPassLabel=Label(self.experi_subTop6_fText, text=self.testDescDict[self.testLabelList[i]]+"\n", bg="white")
            self.testPassLabel.configure(width=15)
            self.testPassLabel.pack(side=LEFT)

        # Make a checkbox to overwrite/not overwrite pre-existing data
        self.overwriteBox = Checkbutton(self.experi_subTop7_frame, text="Overwrite existing QIE Card data (if applicable)?", variable=self.overwriteVar)
        self.overwriteBox.configure(bg="lemon chiffon")
        self.overwriteBox.pack(side=TOP,
                       padx = button_padx,
                       pady = button_pady,
                       ipady = button_pady*2,
                       ipadx = button_padx*2)

        # Make a button to submit tests and information
        self.passAllTestsBttn = Button(self.experi_subTop7_frame, text="Pass All Tests", command=self.throwPassAllBox)
        self.passAllTestsBttn.configure(bg="#FFE699", width=40)
        self.passAllTestsBttn.pack(side=TOP)

        # Make a button to submit tests and information
        self.initSubmitBttn = Button(self.experi_subTop7_frame, text="Submit Inspections & Tests", command=self.initSubmitBttnPress)
        self.initSubmitBttn.configure(bg="#FFCC66", width=40)
        self.initSubmitBttn.pack(side=TOP)

        # Make a button to clear all results
        self.clearDataBttn = Button(self.experi_subTop7_frame, text="Clear Inspections, Tests, & Info", command=self.clearDataBttnPress)
        self.clearDataBttn.configure(bg="orange", width=40)
        self.clearDataBttn.pack(side=TOP)
Example #27
0
# Check Checsum!!

from checksumClass import Checksum
from uniqueIDClass import ID
import TestLib as t
from client import webBus

bus6 = webBus("pi6", 0)


def check(bus, rmList, slotList):
    for rm in rmList:
        t.openRM(bus, rm)
        for slot in slotList[4 - rm]:
            print "\nUnique ID"
            uniqueID = ID(bus, slot)
            print uniqueID.raw
            print uniqueID.cooked
            check = Checksum(uniqueID.raw, 0)
            print "result = ", check.result
            if check.result == 2:
                print "i2c error"
            if check.result == 1:
                print "checksum error"
            if check.result == 0:
                print "checksum ok"


# idA = ID(bus6)
# idB = ID(bus6)
# t.openRM(bus6,2)
Example #28
0
from client import webBus

b = webBus('pi5', 0)  #can add 'pi5,0' so won't print send/receive messages

##############################
# Helpful Tool Functions
##############################


# give function a !!REVERSED!! r/w indexed from sendBatch() and will determine
# if LAST value in the string is a non-zero error code
def isError(ret):
    if (ret[-1] != 0):  # '0' is non-error value
        return True  # error
    else:
        return False  # no error


# takes decimal byte, returns list filled with exactly 8 bits
def getBitsFromByte(decimal):
    return list('%08d' % int(bin(decimal)[2:]))


# give a list with decimal bytes, returns list of all bits
def getBitsFromBytes(decimalBytes):
    ret = []
    if not isinstance(decimalBytes, bool):
        for i in decimalBytes:
            ret = ret + getBitsFromByte(i)
    return ret
Example #29
0
# new fanout pi6

from client import webBus
b = webBus("pi6",0)
bus5 = webBus("pi5",0)
bus6 = webBus("pi6",0)

# Slots 1,2,3,4
def bridgeAddress(slot):
    address = [0x19, 0x1a,0x1b, 0x1c]
    return address[slot-1]

# RMs 1,2,3,4
def ngccmGroup(rm):
    i2cGroups = [0x01,0x10,0x20,0x02]
    return i2cGroups[rm-1]

def openRM(rm,bus):
    if rm in [3,4]:
        # Open channel to ngCCM for RM 3,4: J1 - J10
        print '### Open RM ', rm
        bus.write(0x72,[2])
    elif rm in [1,2]:
        # Open channel to ngCCM for RM 1,2: J17 - J26
        print '### Open RM ', rm
        bus.write(0x72,[1])
    else:
        print 'Invalid RM = ', rm
        print 'Please choose RM = {1,2,3,4}'
        return 'closed channel'
    # Open channel to i2c group
Example #30
0
import sys
sys.path.append('../')
from client import webBus
import Hardware as h
import iglooClass as i
# from TestSoftware.uHTR import uHTR

qcard_slots = [2, 5]

b = webBus("pi5", 0)
# uhtr = uHTR(6,qcard_slots,b)

#-------------------------------------
for slot in qcard_slots:
    print '__________________________________________________'
    print '____________________Slot %d_______________________' % slot
    print '__________________________________________________'
    myDC = h.getDChains(slot, b)

    # i.turnOnCI()
    d
    myDC.read()
    print myDC[0]

    print '__________________________________________________'
    print '__________________________________________________'
    print '__________________________________________________'

    # for num in xrange(12):
    #     for chip in xrange(12):
    #         myDC[chip].ChargeInjectDAC(8640)
Example #31
0
from client import webBus

b = webBus("pi4")

b.read(0x72, 1)
print b.sendBatch()

Example #32
0
# Daisy chain objects must use .write() after changes are made in order to affect chips


##### Imports #####
import sys
sys.path.append("../")
from client import webBus
import Hardware as h
import iglooClass_adry as i
from uniqueID import ID
# from uHTR import uHTR


##### Global Vars #####
pi    = "pi5" # 'pi5' or 'pi6' etc
b     = webBus(pi,0) # webBus sets active pi; 0 = server verbosity off
all_slots = [2,3,4,5,7,8,9,10,18,19,20,21,23,24,25,26]
slots = all_slots # list of active J slots

##### Functions ######

def chargeInjectOn(slots, bus):
    for slot in slots:
        h.SetQInjMode(1, slot, b)
        i.displayCI(bus,slot)

def chargeInjectOff(slots, bus):
    for slot in slots:
        h.SetQInjMode(0, slot, b)
        i.displayCI(bus,slot)
Example #33
0
#TestLib.py
#Testing Library for QIE Tests.

from client import webBus
import QIELib as q
import TestLib as t
b = webBus("pi5",0)

#MUX slave addresses (slave i2c addresses)
MUXs = {
    "fanout" : 0x72,
    "ngccm" : {
                "u10" : 0x74,
                "u18" : 0x70
                },
    "bridge" : [0x19, 0x1a, 0x1b, 0x1c]
        }
#Register addresses
REGs = {
    "qie0" : 0x30,
    "qie1" : 0x31,
    "iscSelect" : 0x11,
    "vttx" : 0x7E,
    "igloo" : 0x09,
    "ID" : 0x50,
    "temp" : 0x40
        }
# Simplify your life today with RMi2c and QIEi2c. Boom dog.

RMi2c = {
    # RM 0,1
# Run complete QIE Test Sweet
from client import webBus
import uniqueID
import TestLib
b = webBus("pi5")
u = uniqueID
t = TestLib

def run(RMList, num_slots=4):
    uniqueIDArray = []
    # Iterate through RM 0, 1, 2, 3 (include desired RMs in list)
    for rm in RMList:
        idList = []
        # Iterate through Slot 0, 1, 2, 3 (run for all 4 slots by default)
        for slot in xrange(num_slots):
            idList.append(u.uniqueID(rm,slot))
            # b.clearBus()
        uniqueIDArray.append(idList)
    return uniqueIDArray

### Outdated, not used now! ###
def printRun(RMList, num_slots=4):
    uniqueIDArray = run(RMList, num_slots)
    for rm in RMList:
        for slot in xrange(num_slots):
            print 'RM: ', rm, ' slot: ', slot
            print 'UniqueID (dec): ', t.reverseBytes(uniqueIDArray[rm][slot])
            print 'UniqueID (hex): ', t.toHex(t.reverseBytes(uniqueIDArray[rm][slot]))

# Use printIDs from TestLib
uniqueIDArray = run([0])