def testBody(self): name = "wte_count" reg = i.igloo[name]["register"] size = i.igloo[name]["size"] / 8 print '----------%s----------' % name resultArr = [] diffGoodVal = True for n in xrange(20): resultArr.append( helpers.getValue( i.intListToString( i.readFromRegister_Quiet(self.bus, i.iglooAdd, reg, size)))) diff = 0 if n != 0: diff = resultArr[n] - resultArr[n - 1] if diff < 0: diff += 2**32 if diff > 39000 and diff < 36000: # approx 37kHz diffGoodVal = False print diff time.sleep(1) if (diffGoodVal): print '~~ Pass: WTE Counter 37kHz ~~' return True else: print '~~ Fail: Counter NOT 37kHz ~~' return False
def testBody(self): name = "wte_count" reg = i.igloo[name]["register"] size = i.igloo[name]["size"] / 8 sleepFactor = 0.25 print '----------%s----------' %name resultArr=[] diffGoodVal = True for n in xrange(2): resultArr.append(t.getValue(i.intListToString(i.readFromRegister_Quiet(self.bus, i.iglooAdd, reg, size)))) diff = 0 if n != 0: diff = resultArr[n] - resultArr[n-1] if diff < 0: diff += 2**32 rate = (float(diff)/(sleepFactor)) if rate > 59000 or rate < 15000: # approx 37kHz diffGoodVal = False print rate time.sleep(1*sleepFactor) if (diffGoodVal): print '~~ Pass: WTE Counter 37kHz ~~' return True else: print '~~ Fail: Counter NOT 37kHz ~~' return False
def toggleIgloo(self): iglooControl = 0x22 message = self.readBridge(iglooControl, 4) value = t.getValue(message) value = value ^ 0x400 # toggle igloo power! messageList = t.getMessageList(value, 4) self.writeBridge(iglooControl, messageList) return self.readBridge(iglooControl, 4)
def toggleIgloo(self): iglooControl = 0x22 message = self.readBridge(iglooControl,4) value = t.getValue(message) value = value ^ 0x400 # toggle igloo power! messageList = t.getMessageList(value,4) self.writeBridge(iglooControl,messageList) return self.readBridge(iglooControl,4)
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
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
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
def testBody(self): sleepFactor = 0.25 resultArr = [] numBytes = 4 isGoodVal = True rate = 0 for n in xrange(2): # Get data from chip, and then process it self.bus.write(self.address, [0x14]) self.bus.read(self.address, numBytes) ret = [] for i in self.bus.sendBatch()[-1].split(): ret.append(int(i)) ret.reverse() if (ret[-1] != 0 ): print "I2C Error in WTE_Counter!" return False del ret[-1] # End I2C and data processing part resultArr.append(h.getValue(self.intListToString(ret))) if (n != 0): diff = resultArr[n] - resultArr[n-1] if diff < 0: diff += 2**32 rate = (float(diff)/(sleepFactor)) if rate > 23000 or rate < 8000: isGoodVal = False time.sleep(1*sleepFactor) if(isGoodVal): # Note we want NOT EQUAL TO print "WTE_Counter rate in acceptable range!" return True else: print "WTE_Counter FAILED. Rate either above 27 kHz or below 8 kHz" print "Failing rate is: " + str(rate) + " Hz" return False
def testBody(self): name = "wte_count" reg = i.igloo[name]["register"] size = i.igloo[name]["size"] / 8 print '----------%s----------' %name resultArr=[] diffGoodVal = True for n in xrange(20): resultArr.append(helpers.getValue(i.intListToString(i.readFromRegister_Quiet(self.bus, i.iglooAdd, reg, size)))) diff = 0 if n != 0: diff = resultArr[n] - resultArr[n-1] if diff < 0: diff += 2**32 if diff > 39000 and diff < 36000: # approx 37kHz diffGoodVal = False print diff time.sleep(1) if (diffGoodVal): print '~~ Pass: WTE Counter 37kHz ~~' return True else: print '~~ Fail: Counter NOT 37kHz ~~' return False
def testBody(self): sleepFactor = 0.25 resultArr = [] numBytes = 4 isGoodVal = True rate = 0 for n in xrange(2): # Get data from chip, and then process it self.bus.write(self.address, [0x12]) self.bus.read(self.address, numBytes) ret = [] for i in self.bus.sendBatch()[-1].split(): ret.append(int(i)) ret.reverse() if (ret[-1] != 0 ): print "I2C Error in RES_QIE_Counter!" return False del ret[-1] # End I2C and data processing part resultArr.append(h.getValue(self.intListToString(ret))) if (n != 0): diff = resultArr[n] - resultArr[n-1] if (abs(diff) > 3650): isGoodVal = False time.sleep(1*sleepFactor) if(isGoodVal): print "Clock_Counter rate in acceptable range!" return True else: print "Clock_Counter FAILED!" print "Failing Clock_Counter diff: " + str(diff) return False