def FWTest(): file_list = [] for root, dirs, files in os.walk(os.getcwd()): for f in files: (filename, ext) = os.path.splitext(f) if ext == ".xml" or ext == ".XML": # print f file_list.append(os.path.join(root, f)) configPath=file_list[0] configFile_data = xmlReader.captureXMLConfigFile(configPath) configTest=configFile_data.get_item("FW Version") FWTestLimits.FWVersion=configTest.Min configTest=configFile_data.get_item("FW Revision") FWTestLimits.FWRevisionControl=configTest.Max if not openPort(): returnData['ErrorCode']=0x30 jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn sleep(0.1) powerOn() sleep(0.1) #print "exiting bootloader" #bridge.ExitBootloaderMode() #enter Sys info mode bridge.WriteI2CData(0x83) #sleep(0.5) datain=bridge.ReadI2CData(0x00, 50) print datain RevControl=1L RevControl=datain[3]*2**16+datain[2]*2**8+datain[1] print RevControl returnData['Data'].append(RevControl) if not (RevControl==FWTestLimits.FWRevisionControl): returnData['ErrorMessage']="Un-supported FW" returnData['TestResult']='Fail' returnData['ErrorCode']=0x14 #print RevControl #print datain[18] powerOff() closePort() jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn
def IDACTest(): file_list = [] for root, dirs, files in os.walk(os.getcwd()): for f in files: (filename, ext) = os.path.splitext(f) if ext == ".xml" or ext == ".XML": # print f file_list.append(os.path.join(root, f)) configPath = file_list[0] configFile_data = xmlReader.captureXMLConfigFile(configPath) configTest = configFile_data.get_item("Global IDAC") IDACTestLimits.GlobalIDACL = configTest.Min IDACTestLimits.GlobalIDACH = configTest.Max # configFile_data=xmlReader.captureXMLConfigFile() configTest = configFile_data.get_item("Local IDAC") IDACTestLimits.LocalIDACL = configTest.Min IDACTestLimits.LocalIDACH = configTest.Max # print config.SensorRows TrackpadColume = configFile_data.get_data().SensorColumns TrackpadRow = configFile_data.get_data().SensorRows if not openPort(): returnData['ErrorCode'] = 0x30 jsonReturn = json.dumps(returnData, True) print jsonReturn return jsonReturn sleep(0.1) powerOn() sleep(0.1) #print "exiting bootloader" bridge.ExitBootloaderMode() #enter Sys info mode bridge.WriteI2CData(0x00, [0x28]) sleep(0.1) #force recalibrate DUT if ReCalibration: WaitForComplet = True bridge.WriteI2CData(0x00, IDACCommands.ReCalMulCap) while (WaitForComplet): sleep(0.2) datain = bridge.ReadI2CData(0x00, 3) if (datain[2] & 0x40 == 0x40): WaitForComplet = False WaitForComplet = True bridge.WriteI2CData(0x00, IDACCommands.ReCalSelCap) while (WaitForComplet): sleep(0.2) datain = bridge.ReadI2CData(0x00, 3) if (datain[2] & 0x40 == 0x40): WaitForComplet = False #Read GlobalIDAC and LocalIDAC WaitForComplet = True bridge.WriteI2CData(0x00, IDACCommands.ReadIDACs) while WaitForComplet: sleep(0.1) datain = bridge.ReadI2CData(0x00, 3) if (datain[2] & 0x80 == 0x80) or (datain[2] & 0x40 == 0x40): WaitForComplet = False dataToRead = TrackpadColume * TrackpadRow + 10 sleep(0.1) datain = bridge.ReadI2CData(0x00, dataToRead) for dataTemp in datain[8:492]: returnData['Data'].append(dataTemp) #print datain #print returnData['Data'] if returnData['Data'][0] < IDACTestLimits.GlobalIDACL: returnData['ErrorMessage'] = "Low Global iDAC" returnData['TestResult'] = 'Fail' returnData['ErrorCode'] = 0x52 powerOff() closePort() jsonReturn = json.dumps(returnData, True) print jsonReturn return jsonReturn if returnData['Data'][0] > IDACTestLimits.GlobalIDACH: returnData['ErrorMessage'] = "High Global iDAC" returnData['TestResult'] = 'Fail' returnData['ErrorCode'] = 0x53 powerOff() closePort() jsonReturn = json.dumps(returnData, True) print jsonReturn return jsonReturn LocalLen = TrackpadColume * TrackpadRow for localIDAC in returnData['Data'][1:LocalLen]: if localIDAC < IDACTestLimits.LocalIDACL: returnData['ErrorMessage'] = "Low Local iDAC" returnData['TestResult'] = 'Fail' returnData['ErrorCode'] = 0x50 powerOff() closePort() jsonReturn = json.dumps(returnData, True) print jsonReturn return jsonReturn if localIDAC > IDACTestLimits.LocalIDACH: returnData['ErrorMessage'] = "High Local iDAC" returnData['TestResult'] = 'Fail' returnData['ErrorCode'] = 0x51 powerOff() closePort() jsonReturn = json.dumps(returnData, True) print jsonReturn return jsonReturn powerOff() closePort() jsonReturn = json.dumps(returnData, True) print jsonReturn return jsonReturn
powerOff() closePort() jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn if __name__=="__main__": file_list = [] for root, dirs, files in os.walk(os.getcwd()): for f in files: (filename, ext) = os.path.splitext(f) if ext == ".xml" or ext == ".XML": # print f file_list.append(os.path.join(root, f)) configPath=file_list[0] configFile_data=xmlReader.captureXMLConfigFile() config=configFile_data.get_data(configPath) TrackpadColume=config.SensorColumns TrackpadRow=config.SensorRows configTest=configFile_data.get_item("Noise",configPath) NoiseLimits.NoiseHigh=configTest.Max readCount=configTest.Samples NoiseCommands.GetSensorFullPanelScan[5]=TrackpadColume*TrackpadRow/256 NoiseCommands.GetSensorFullPanelScan[6]=TrackpadColume*TrackpadRow%256 NoiseTest()
def currentTest(): file_list = [] for root, dirs, files in os.walk(os.getcwd()): for f in files: (filename, ext) = os.path.splitext(f) if ext == ".xml" or ext == ".XML": # print f file_list.append(os.path.join(root, f)) configPath=file_list[0] configFile_data=xmlReader.captureXMLConfigFile() configTest=configFile_data.get_item("ICOM",configPath) powerTestLimits.IcomLow=configTest.Min powerTestLimits.IcomHigh=configTest.Max #print powerTestLimits.IcomLow if not openPort(): returnData['ErrorCode']=0x30 jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn sleep(0.1) powerOn() sleep(0.1) #print "exiting bootloader" bridge.ExitBootloaderMode() #enter operation #bridge.WriteI2CData(0x24, 0x00, [0x08]) #optional depends on if need to read current in operaton mode #sleep(0.1) # Current test using pywinusb device = hid.HidDeviceFilter(vendor_id = 0x04b4, product_id = 0xf123).get_devices()[0] #print device device.open() #sleep(1) for i in range(5): device.set_raw_data_handler(readData_handler) #print device.find_output_reports()[0] report = device.find_output_reports()[0] readCurrent=[0x00]*65 readCurrent[1]=0x02 readCurrent[2]=0x00 readCurrent[3]=0xA6 readCurrent[4]=0x00 readCurrent[5]=0x00 readCurrent[6]=0x00 report.set_raw_data(readCurrent) report.send(readCurrent) sleep(0.1) #print ICOM ICOMvalue=numpy.mean(ICOM) #ICOMvalue=float('%0.1f'%ICOMvalue) ICOMvalue=float(ICOMvalue/100) returnData['Data'].append(ICOMvalue) if ICOMvalue<powerTestLimits.IcomLow: device.close() powerOff() closePort() returnData['TestResult']='Fail' returnData['ErrorMessage']="Low Current" returnData['ErrorCode']=0x42 jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn if ICOMvalue>powerTestLimits.IcomHigh: device.close() powerOff() closePort() returnData['TestResult']='Fail' returnData['ErrorMessage']="High Current" returnData['ErrorCode']=0x43 jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn device.close() powerOff() closePort() jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn
def voltageTest(): file_list = [] for root, dirs, files in os.walk(os.getcwd()): for f in files: (filename, ext) = os.path.splitext(f) if ext == ".xml" or ext == ".XML": # print f file_list.append(os.path.join(root, f)) configPath=file_list[0] configFile_data=xmlReader.captureXMLConfigFile() configTest=configFile_data.get_item("VCOM",configPath) powerTestLimits.VcomLow=configTest.Min powerTestLimits.VcomHigh=configTest.Max #print powerTestLimits.VcomLow if not openPort(): returnData['ErrorCode']=0x30 jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn sleep(0.1) powerOn() sleep(0.1) # Exit bootloader bridge.WriteI2CData(0x24, 0x00, [0x7F,0x01,0x3B,0x00,0x00,0x4F,0x6D,0x17]) sleep(0.1) #enter operation bridge.WriteI2CData(0x24, 0x00, [0x08]) sleep(0.1) # Voltage Test PowerData=bridge.GetPower() #print PowerData VCOMvalue=PowerData['Vcom'] VCOMvalue=float(VCOMvalue)/1000 returnData['Data'].append(VCOMvalue) #powerTestStatus=(powerTestLimits.VcomHigh>VCOMvalue>powerTestLimits.VcomLow) and (powerTestLimits.VauxHigh>VCOMvalue>powerTestLimits.VauxLow) if powerTestLimits.VcomLow>VCOMvalue: powerOff() closePort() returnData['TestResult']='Fail' returnData['ErrorMessage']="Low Voltage" returnData['ErrorCode']=0x40 jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn if VCOMvalue>powerTestLimits.VcomHigh: powerOff() closePort() returnData['TestResult']='Fail' returnData['ErrorMessage']="High Voltage" returnData['ErrorCode']=0x41 jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn powerOff() closePort() jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn
jsonReturn = json.dumps(returnData, True) print jsonReturn return jsonReturn if __name__ == "__main__": file_list = [] for root, dirs, files in os.walk(os.getcwd()): for f in files: (filename, ext) = os.path.splitext(f) if ext == ".xml" or ext == ".XML": # print f file_list.append(os.path.join(root, f)) configPath = file_list[0] configFile_data = xmlReader.captureXMLConfigFile() config = configFile_data.get_data(configPath) TrackpadColume = config.SensorColumns TrackpadRow = config.SensorRows configTest = configFile_data.get_item("Signal", configPath) SignalLimits.SignalHigh = configTest.Max SignalLimits.SignalLow = configTest.Min readCount = configTest.Samples SignalCommands.GetSensorFullPanelScan[ 5] = TrackpadColume * TrackpadRow / 256 SignalCommands.GetSensorFullPanelScan[ 6] = TrackpadColume * TrackpadRow % 256 #print NoiseCommands.GetSensorFullPanelScan SignalTest()
def currentTest(): file_list = [] for root, dirs, files in os.walk(os.getcwd()): for f in files: (filename, ext) = os.path.splitext(f) if ext == ".xml" or ext == ".XML": # print f file_list.append(os.path.join(root, f)) configPath = file_list[0] configFile_data = xmlReader.captureXMLConfigFile() configTest = configFile_data.get_item("FW Version", configPath) FWTestLimits.FWVersion = configTest.Min configTest = configFile_data.get_item("FW Revision", configPath) FWTestLimits.FWRevisionControl = configTest.Max if not openPort(): returnData['ErrorCode'] = 0x30 jsonReturn = json.dumps(returnData, True) print jsonReturn return jsonReturn sleep(0.1) powerOn() sleep(0.1) #print "exiting bootloader" bridge.ExitBootloaderMode() #enter Sys info mode bridge.WriteI2CData(0x24, 0x00, [0x98]) sleep(0.1) bridge.WriteI2CData(0x24, 0x00) #sleep(0.5) datain = bridge.ReadI2CData(0x24, 0x00, 50) if ((datain[18] + float(datain[19]) / 10) > FWTestLimits.FWVersion): returnData['ErrorMessage'] = "New Revision" returnData['TestResult'] = 'Fail' returnData['ErrorCode'] = 0x13 if ((datain[18] + float(datain[19]) / 10) < FWTestLimits.FWVersion): returnData['ErrorMessage'] = "Old Revision" returnData['TestResult'] = 'Fail' returnData['ErrorCode'] = 0x12 returnData['Data'].append(datain[18] + float(datain[19]) / 10) RevControl = 1L RevControl = datain[20] * 2**56 + datain[21] * 2**48 + datain[ 22] * 2**40 + datain[23] * 2**32 + datain[24] * 2**24 + datain[ 25] * 2**16 + datain[26] * 2**8 + datain[27] returnData['Data'].append(RevControl) if not (RevControl == FWTestLimits.FWRevisionControl): returnData['ErrorMessage'] = "Un-supported FW" returnData['TestResult'] = 'Fail' returnData['ErrorCode'] = 0x14 #print RevControl #print datain[18] powerOff() closePort() jsonReturn = json.dumps(returnData, True) print jsonReturn return jsonReturn
def voltageTest(): file_list = [] for root, dirs, files in os.walk(os.getcwd()): for f in files: (filename, ext) = os.path.splitext(f) if ext == ".xml" or ext == ".XML": # print f file_list.append(os.path.join(root, f)) configPath = file_list[0] configFile_data = xmlReader.captureXMLConfigFile() configTest = configFile_data.get_item("VCOM", configPath) powerTestLimits.VcomLow = configTest.Min powerTestLimits.VcomHigh = configTest.Max #print powerTestLimits.VcomLow if not openPort(): returnData['ErrorCode'] = 0x30 jsonReturn = json.dumps(returnData, True) print jsonReturn return jsonReturn sleep(0.1) powerOn() sleep(0.1) # Exit bootloader bridge.WriteI2CData(0x24, 0x00, [0x7F, 0x01, 0x3B, 0x00, 0x00, 0x4F, 0x6D, 0x17]) sleep(0.1) #enter operation bridge.WriteI2CData(0x24, 0x00, [0x08]) sleep(0.1) # Voltage Test PowerData = bridge.GetPower() #print PowerData VCOMvalue = PowerData['Vcom'] VCOMvalue = float(VCOMvalue) / 1000 returnData['Data'].append(VCOMvalue) #powerTestStatus=(powerTestLimits.VcomHigh>VCOMvalue>powerTestLimits.VcomLow) and (powerTestLimits.VauxHigh>VCOMvalue>powerTestLimits.VauxLow) if powerTestLimits.VcomLow > VCOMvalue: powerOff() closePort() returnData['TestResult'] = 'Fail' returnData['ErrorMessage'] = "Low Voltage" returnData['ErrorCode'] = 0x40 jsonReturn = json.dumps(returnData, True) print jsonReturn return jsonReturn if VCOMvalue > powerTestLimits.VcomHigh: powerOff() closePort() returnData['TestResult'] = 'Fail' returnData['ErrorMessage'] = "High Voltage" returnData['ErrorCode'] = 0x41 jsonReturn = json.dumps(returnData, True) print jsonReturn return jsonReturn powerOff() closePort() jsonReturn = json.dumps(returnData, True) print jsonReturn return jsonReturn
def OpensTest(): file_list = [] for root, dirs, files in os.walk(os.getcwd()): for f in files: (filename, ext) = os.path.splitext(f) if ext == ".xml" or ext == ".XML": # print f file_list.append(os.path.join(root, f)) configPath=file_list[0] configFile_data=xmlReader.captureXMLConfigFile() config=configFile_data.get_data(configPath) #print config.SensorRows TrackpadColume=config.SensorColumns TrackpadRow=config.SensorRows if not openPort(): returnData['ErrorCode']=0x30 jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn sleep(0.1) powerOn() sleep(0.1) #print "exiting bootloader" bridge.ExitBootloaderMode() #enter CAT info mode bridge.WriteI2CData(0x24, 0x00, [0x28]) sleep(0.1) #Run Self Test WaitForComplet=True bridge.WriteI2CData(0x24, 0x00, OpensCommands.SelfTest) while WaitForComplet: sleep(0.1) datain=bridge.ReadI2CData(0x24, 0x00, 3) if (datain[2]&0x80==0x80) or (datain[2]&0x40==0x40): WaitForComplet=False #Retrieve Data Structure - Sensor iDACs (Command 0x10, Data ID = 0x00) dataToRead=TrackpadColume*TrackpadRow+10 bridge.WriteI2CData(0x24, 0x00, OpensCommands.GetSensorDataStruct) sleep(0.1) datain=bridge.ReadI2CData(0x24, 0x00, dataToRead) for dataTemp in datain[9:493]: returnData['Data'].append(dataTemp) #print datain # bridge.WriteI2CData(0x24, 0x00, OpensCommands.GetButtonDataStruct) # sleep(0.1) # datain=bridge.ReadI2CData(0x24, 0x00, dataToRead) # print datain LocalLen=TrackpadColume*TrackpadRow for Open in returnData['Data'][1:LocalLen]: if Open<20: returnData['ErrorMessage']="Opens test fail " returnData['TestResult']='Fail' returnData['ErrorCode']=0x56 powerOff() closePort() jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn powerOff() closePort() jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn
def currentTest(): file_list = [] for root, dirs, files in os.walk(os.getcwd()): for f in files: (filename, ext) = os.path.splitext(f) if ext == ".xml" or ext == ".XML": # print f file_list.append(os.path.join(root, f)) configPath=file_list[0] configFile_data=xmlReader.captureXMLConfigFile() configTest=configFile_data.get_item("FW Version",configPath) FWTestLimits.FWVersion=configTest.Min configTest=configFile_data.get_item("FW Revision",configPath) FWTestLimits.FWRevisionControl=configTest.Max if not openPort(): returnData['ErrorCode']=0x30 jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn sleep(0.1) powerOn() sleep(0.1) #print "exiting bootloader" bridge.ExitBootloaderMode() #enter Sys info mode bridge.WriteI2CData(0x24, 0x00, [0x98]) sleep(0.1) bridge.WriteI2CData(0x24, 0x00) #sleep(0.5) datain=bridge.ReadI2CData(0x24, 0x00, 50) if ((datain[18]+float(datain[19])/10)>FWTestLimits.FWVersion): returnData['ErrorMessage']="New Revision" returnData['TestResult']='Fail' returnData['ErrorCode']=0x13 if ((datain[18]+float(datain[19])/10)<FWTestLimits.FWVersion): returnData['ErrorMessage']="Old Revision" returnData['TestResult']='Fail' returnData['ErrorCode']=0x12 returnData['Data'].append(datain[18]+float(datain[19])/10) RevControl=1L RevControl=datain[20]*2**56+datain[21]*2**48+datain[22]*2**40+datain[23]*2**32+datain[24]*2**24+datain[25]*2**16+datain[26]*2**8+datain[27] returnData['Data'].append(RevControl) if not (RevControl==FWTestLimits.FWRevisionControl): returnData['ErrorMessage']="Un-supported FW" returnData['TestResult']='Fail' returnData['ErrorCode']=0x14 #print RevControl #print datain[18] powerOff() closePort() jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn
def IDACTest(): file_list = [] for root, dirs, files in os.walk(os.getcwd()): for f in files: (filename, ext) = os.path.splitext(f) if ext == ".xml" or ext == ".XML": # print f file_list.append(os.path.join(root, f)) configPath = file_list[0] configFile_data = xmlReader.captureXMLConfigFile(configPath) configTest = configFile_data.get_item("Global IDAC") IDACTestLimits.GlobalIDACL = configTest.Min IDACTestLimits.GlobalIDACH = configTest.Max # configFile_data=xmlReader.captureXMLConfigFile() configTest = configFile_data.get_item("Local IDAC") IDACTestLimits.LocalIDACL = configTest.Min IDACTestLimits.LocalIDACH = configTest.Max # print config.SensorRows TrackpadColume = configFile_data.get_data().SensorColumns TrackpadRow = configFile_data.get_data().SensorRows if not openPort(): returnData['ErrorCode']=0x30 jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn sleep(0.1) powerOn() sleep(0.1) #print "exiting bootloader" bridge.ExitBootloaderMode() #enter Sys info mode bridge.WriteI2CData(0x00, [0x28]) sleep(0.1) #force recalibrate DUT if ReCalibration: WaitForComplet=True bridge.WriteI2CData(0x00, IDACCommands.ReCalMulCap) while (WaitForComplet): sleep(0.2) datain=bridge.ReadI2CData(0x00, 3) if (datain[2]&0x40==0x40): WaitForComplet=False WaitForComplet=True bridge.WriteI2CData(0x00, IDACCommands.ReCalSelCap) while (WaitForComplet): sleep(0.2) datain=bridge.ReadI2CData(0x00, 3) if (datain[2]&0x40==0x40): WaitForComplet=False #Read GlobalIDAC and LocalIDAC WaitForComplet=True bridge.WriteI2CData(0x00, IDACCommands.ReadIDACs) while WaitForComplet: sleep(0.1) datain=bridge.ReadI2CData(0x00, 3) if (datain[2]&0x80==0x80) or (datain[2]&0x40==0x40): WaitForComplet=False dataToRead=TrackpadColume*TrackpadRow+10 sleep(0.1) datain=bridge.ReadI2CData( 0x00, dataToRead) for dataTemp in datain[8:492]: returnData['Data'].append(dataTemp) #print datain #print returnData['Data'] if returnData['Data'][0]<IDACTestLimits.GlobalIDACL: returnData['ErrorMessage']="Low Global iDAC" returnData['TestResult']='Fail' returnData['ErrorCode']=0x52 powerOff() closePort() jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn if returnData['Data'][0]>IDACTestLimits.GlobalIDACH: returnData['ErrorMessage']="High Global iDAC" returnData['TestResult']='Fail' returnData['ErrorCode']=0x53 powerOff() closePort() jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn LocalLen=TrackpadColume*TrackpadRow for localIDAC in returnData['Data'][1:LocalLen]: if localIDAC<IDACTestLimits.LocalIDACL: returnData['ErrorMessage']="Low Local iDAC" returnData['TestResult']='Fail' returnData['ErrorCode']=0x50 powerOff() closePort() jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn if localIDAC>IDACTestLimits.LocalIDACH: returnData['ErrorMessage']="High Local iDAC" returnData['TestResult']='Fail' returnData['ErrorCode']=0x51 powerOff() closePort() jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn powerOff() closePort() jsonReturn=json.dumps(returnData, True) print jsonReturn return jsonReturn