Ejemplo n.º 1
0
    def readNoCheck(self, testName, iterations = 1):
	i2c_pathway = noCheckRegis[testName]["i2c_path"]
	register = noCheckRegis[testName]["address"]
	size = noCheckRegis[testName]["size"]/8
	command = noCheckRegis[testName]["command"]
	napTime = noCheckRegis[testName]["sleep"]

	for i in xrange(iterations):
		# Clear the backplane
		self.bus.write(0x00,[0x06])

		self.bus.write(self.address,i2c_pathway)
		self.bus.write(register,command)
		if (napTime != 0):
			self.bus.sleep(napTime)  #catching some z's
		self.bus.read(register,size)

	r = self.bus.sendBatch()
	# Remove the entries in r that contain no information
	new_r = []
	for i in r:
		if (i != '0' and i != 'None'):
			new_r.append(i)
	self.outCard.resultList[testName] = new_r
	if (testName == "Unique_ID"):
		new_r[0] = helpers.reverseBytes(new_r[0])
		new_r[0] = helpers.toHex(new_r[0])
	return new_r
Ejemplo n.º 2
0
    def readBridge(self, regAddress, num_bytes):
        self.bus.write(0x00,[0x06])
        self.bus.sendBatch()
        self.bus.write(0x19,[regAddress])
        self.bus.read(0x19, num_bytes)
        message = self.bus.sendBatch()[-1]
        if message[0] != '0':
            print 'Bridge i2c error detected'
        return t.reverseBytes(message[2:])

	def readIgloo(self, regAddress, num_bytes):
		self.bus.write(0x00,[0x06])
		self.bus.write(self.address,[0x11,0x03,0,0,0])
		self.bus.write(0x09,[regAddress])
		self.bus.read(0x09, num_bytes)
		message = self.bus.sendBatch()[-1]
		if message[0] != '0':
			print 'Igloo i2c error detected in readIgloo'
		return t.reverseBytes(message[2:])

	def detectIglooError(self, regAddress, num_bytes):
		self.bus.write(0x00,[0x06])
		self.bus.write(self.address,[0x11,0x03,0,0,0])
		self.bus.write(0x09,[regAddress])
		self.bus.read(0x09, num_bytes)
		message = self.bus.sendBatch()[-1]
		if message[0] != '0':
			print 'Igloo Power Off Confirmed.'
		return message
Ejemplo n.º 3
0
 def getFull(self):
     mlist = self.raw.split()
     if int(mlist.pop(0)) != 0:
         print 'i2c error'
     cereal = ' '.join(mlist)
     oats = helpers.reverseBytes(cereal) # reversed
     eggs = helpers.toHex(oats,0) # hex
     return eggs
Ejemplo n.º 4
0
 def getSerial(self):
     if int(self.raw.split()[1]) != 0x70:
         print 'Not in Family 0x70'
         return 'Family_Code_Error'
     cereal = helpers.serialNum(self.raw) # serial
     oats = helpers.reverseBytes(cereal) # reversed
     eggs = helpers.toHex(oats,2) # hex
     return eggs
Ejemplo n.º 5
0
 def getFull(self):
     mlist = self.raw.split()
     if int(mlist.pop(0)) != 0:
         print 'i2c error'
     cereal = ' '.join(mlist)
     oats = helpers.reverseBytes(cereal)  # reversed
     eggs = helpers.toHex(oats, 0)  # hex
     return eggs
Ejemplo n.º 6
0
 def getSerial(self):
     if int(self.raw.split()[1]) != 0x70:
         print 'Not in Family 0x70'
         return 'Family_Code_Error'
     cereal = helpers.serialNum(self.raw)  # serial
     oats = helpers.reverseBytes(cereal)  # reversed
     eggs = helpers.toHex(oats, 2)  # hex
     return eggs
Ejemplo n.º 7
0
 def readIgloo(self, regAddress, num_bytes):
     self.bus.write(0x00, [0x06])
     self.bus.write(self.address, [0x11, 0x03, 0, 0, 0])
     self.bus.write(0x09, [regAddress])
     self.bus.read(0x09, num_bytes)
     message = self.bus.sendBatch()[-1]
     # if message[0] != '0':
     # 	print 'Igloo i2c error detected in readIgloo'
     return t.reverseBytes(message[2:])
Ejemplo n.º 8
0
 def readBridge(self, regAddress, num_bytes):
     self.bus.write(0x00, [0x06])
     self.bus.sendBatch()
     self.bus.write(0x19, [regAddress])
     self.bus.read(0x19, num_bytes)
     message = self.bus.sendBatch()[-1]
     # if message[0] != '0':
     #     print 'Bridge i2c error detected'
     return t.reverseBytes(message[2:])
Ejemplo n.º 9
0
 def readIgloo(self, regAddress, num_bytes):
 	self.bus.write(0x00,[0x06])
 	self.bus.write(self.address,[0x11,0x03,0,0,0])
 	self.bus.write(0x09,[regAddress])
 	self.bus.read(0x09, num_bytes)
 	message = self.bus.sendBatch()[-1]
 	# if message[0] != '0':
 	# 	print 'Igloo i2c error detected in readIgloo'
 	return t.reverseBytes(message[2:])
Ejemplo n.º 10
0
 def readBridge(self, regAddress, num_bytes):
     self.bus.write(0x00,[0x06])
     self.bus.sendBatch()
     self.bus.write(0x19,[regAddress])
     self.bus.read(0x19, num_bytes)
     message = self.bus.sendBatch()[-1]
     # if message[0] != '0':
     #     print 'Bridge i2c error detected'
     return t.reverseBytes(message[2:])
Ejemplo n.º 11
0
	def testBody(self):
		# Check for zeros for all oribts but [71:48] (bin 3 of 7)
		# This nonzero bin is address 0x1D
		zeroOrbitRegisters = [0x19,0x1A,0x1B,0x1C,0x1E,0x1F]
		for orbitReg in zeroOrbitRegisters:
			self.bus.write(self.address, [orbitReg])
			self.bus.read(self.address, 3)
			raw_data = self.bus.sendBatch()[-1]
			cooked_data = h.reverseBytes(raw_data)
			cooked_data = h.getValue(cooked_data)
			if (cooked_data != 0):
				print 'Nonzero orbit error!'
				return False
		return True
Ejemplo n.º 12
0
	def testBody(self):
		# Check for zeros for all oribts but [71:48] (bin 3 of 7)
		# This nonzero bin is address 0x1D
		zeroOrbitRegisters = [0x19,0x1A,0x1B,0x1C,0x1E,0x1F]
		for orbitReg in zeroOrbitRegisters:
			self.bus.write(self.address, [orbitReg])
			self.bus.read(self.address, 3)
			raw_data = self.bus.sendBatch()[-1]
			cooked_data = h.reverseBytes(raw_data)
			cooked_data = h.getValue(cooked_data)
			if (cooked_data != 0):
				print 'Nonzero orbit error!'
				return False
		return True
Ejemplo n.º 13
0
def control_reg_orbit_histo(bus,slot,delay):
    bus.write(slot,[0x18,2,0,0,0])
    bus.sendBatch()
    bus.write(slot,[0x18,1,0,0,0])
    bus.sendBatch()
    time.sleep(delay)
    bus.write(slot,[0x18,0,0,0,0])
    bus.sendBatch()
    # runBridgeTests([rm],t.getSlotList(rm,slot),range(16,24),0)
    bus.write(slot,[0x1D])
    bus.read(slot,3)
    message = bus.sendBatch()
    message = message[-1][2:]
    message = t.reverseBytes(message)
    value = t.getValue(message)
    return value
Ejemplo n.º 14
0
def control_reg_orbit_histo(bus, slot, delay):
    bus.write(slot, [0x18, 2, 0, 0, 0])
    bus.sendBatch()
    bus.write(slot, [0x18, 1, 0, 0, 0])
    bus.sendBatch()
    time.sleep(delay)
    bus.write(slot, [0x18, 0, 0, 0, 0])
    bus.sendBatch()
    # runBridgeTests([rm],t.getSlotList(rm,slot),range(16,24),0)
    bus.write(slot, [0x1D])
    bus.read(slot, 3)
    message = bus.sendBatch()
    message = message[-1][2:]
    message = t.reverseBytes(message)
    value = t.getValue(message)
    return value
Ejemplo n.º 15
0
    def readNoCheck(self, testName, iterations = 1):
	# Assign some names for read/write parameters
	self.outCard.cardGenInfo["DateRun"] = str(datetime.now())
	i2c_pathway = noCheckRegis[testName]["i2c_path"]
	register = noCheckRegis[testName]["address"]
	size = noCheckRegis[testName]["size"]/8
	command = noCheckRegis[testName]["command"]
	napTime = noCheckRegis[testName]["sleep"]
	new_r = []

	for i in xrange(iterations):
		# Clear the backplane
		self.b.write(0x00,[0x06])
		# Switch to the proper i2c channel
		self.b.write(self.a,i2c_pathway)
		# Send command to the active register
		self.b.write(register,command)
		if (napTime != 0):
			self.b.sleep(napTime)  #catching some z's
		# Read back what we actually want
		self.b.read(register,size)

	# Process the above read/write commands
	r = self.b.sendBatch()
	# Remove the entries in r that contain no information
	for i in r:
		if (i != '0' and i != 'None'):
			new_r.append(i)

	self.outCard.cardGenInfo[testName] = new_r
	
	# Do things that depend on whether we're getting UID or Temp/Humid
	if (testName == "Unique_ID"):
		message = r[-1]
		check = Check(message,0)
		# Using checksum, ask: is the message "good"?
		if (check.result != 0):  # Message bad: print error, assign error UID.
			print 'Unique ID checksum error! Continuing...'
			self.outCard.cardGenInfo[testName] = "0xXXXXXXXXXXXXX"
		else:   # Message good: assign the card its UID.
			new_r[0] = helpers.reverseBytes(new_r[0])
			new_r[0] = helpers.toHex(new_r[0])
			self.outCard.cardGenInfo[testName]=new_r[0]

	elif (testName == "Temperature" or testName == "Humidity"):
		self.outCard.cardGenInfo[testName] = temp.readManyTemps(self.a,15,testName,"nohold")
Ejemplo n.º 16
0
    def readNoCheck(self, testName, iterations = 1):
	self.outCard.cardGenInfo["DateRun"] = str(datetime.now())
	i2c_pathway = noCheckRegis[testName]["i2c_path"]
	register = noCheckRegis[testName]["address"]
	size = noCheckRegis[testName]["size"]/8
	command = noCheckRegis[testName]["command"]
	napTime = noCheckRegis[testName]["sleep"]
	new_r = []

	for i in xrange(iterations):
		# Clear the backplane
		self.b.write(0x00,[0x06])
		self.b.write(self.a,i2c_pathway)
		self.b.write(register,command)
		if (napTime != 0):
			self.b.sleep(napTime)  #catching some z's
		self.b.read(register,size)

	r = self.b.sendBatch()
	# Remove the entries in r that contain no information
	for i in r:
		if (i != '0' and i != 'None'):
			new_r.append(i)

	self.outCard.cardGenInfo[testName] = new_r
	
	# Do things that depend on whether we're getting UID or Temp/Humid
	if (testName == "Unique_ID"):
		message = r[-1]
		check = Checksum(message,0)
		if (check.result != 0):
			print "Unique ID checksum error! Continuing..."
			self.outCard.cardGenInfo[testName] = "0xXXXXXXXXXXXXX"
		else:
			new_r[0] = helpers.reverseBytes(new_r[0])
			new_r[0] = helpers.toHex(new_r[0])
			self.outCard.cardGenInfo[testName]=new_r[0]
	elif (testName == "Temperature" or testName == "Humidity"):
								      #(address, iterations, "Temperature"/"Humidity","hold"/"nohold")
		self.outCard.cardGenInfo[testName] = temp.readManyTemps(self.a,15,testName,"nohold")