Beispiel #1
0
 def open_usb_serial(self, usb_serial):
     self.close_usb_serial(usb_serial)
     port = ttyusb.find_tty_usb_sn(
         usb_serial['vid'],
          usb_serial['pid'],
          usb_serial['sn'])
     self.open_serial(
         snap.SERIAL_TYPE_RS232,
         port)
     self.open_ports[usb_serial['name']] = port
Beispiel #2
0
 def open(self):
     with self.mylock:
         if not self.isOpen():
             if self.e20_sn:
                 self.port = ttyusb.find_tty_usb_sn(
                     '10c4', 'ea60', self.e20_sn)
             else:
                 e20_ports = ttyusb.find_tty_usb('10c4', 'ea60')
                 if len(e20_ports) > 1:
                     raise 'more than one olimex connected'\
                     'but serial number is not specified'
                 self.port = e20_ports[0]
             super(E20Com, self).open()
     return self.port
Beispiel #3
0
 def conn_RS485(self):
     find_RS485 = ttyusb.find_tty_usb_sn(
         RS485_usb_serial['vid'],
         RS485_usb_serial['pid'],
         RS485_usb_serial['sn'],
         )
     print 'find_RS485:', find_RS485
     RS485 = serial.Serial(find_RS485)
     try:
         for i in range(500):
                     # open RS485 Serial comm
             RS485.write("abcdefghijklmnopqrstuvwxyz")
     finally:
             RS485.close()
Beispiel #4
0
    def __init__(self):
        # initialize Fluke
        self.fluke_port = ttyusb.find_tty_usb_sn('0403', '6001', fluke_usb_sn)
        self.fluke = fluke8845a.Fluke8845A(self.fluke_port)
        self.fluke.set_voltage_dc()
        # initialize Keithley
        self.k = keithley2220.Keithley2220(keithley_sn)
        self.k.output_state(False)
        # initialize engine
        self.eng = snapengine.SnapEngine()
        self.eng.open_usb_serial(eng1_usb_serial)
        self.eng.open_usb_serial(eng2_usb_serial)
        self.eng.open_usb_serial(eng3_usb_serial)

        self.k.select(2)
        self.k.set_voltage(keithley_3p3v)
        self.k.set_current(0.5)
        self.k.output_enable(True)
        self.k.output_state(True)
Beispiel #5
0
def print_info(sn):
    port = ttyusb.find_tty_usb_sn('0403', '6001', sn)
    eng = snapengine.SnapEngine(
        snap.SERIAL_TYPE_RS232, port)
    print 'sn =', sn, 'local_address =', str2hexstr(eng.local_address)
Beispiel #6
0
 try:
     # Make settings accessible to user by
     # executing user script(s)
     # Path of the script(s) received as command line argument(s)
     tester.process_settings(globals())
     tester.check_file_md5sum(
         arcfault_firmware_file, arcfault_firmware_md5sum)
     print_ranges()
     eng = snapengine.SnapEngine(
         license_file=license_file,
         nvparams_file=nvparams_file,
         )
     k = keithley2220.Keithley2220(keithley_sn)
     v = versaloon.Versaloon('0123456789ABCDEF00000000',
         vsprog=os.path.expanduser('~/vsprog/src/vsprog'))
     uut_port = ttyusb.find_tty_usb_sn('0403', '6001', s5_usb_serial['sn'])
     print 'uut_port = ', uut_port
     # Find RS485
     RS485_port = ttyusb.find_tty_usb_sn('0403', '6001',
     RS485_usb_serial['sn'])
     print 'RS485_port = ', RS485_port
     aftester = AfTester(eng, k, v)
     if token:
         from dropup import dropup
         dup = dropup.DropUp(aftester.datadir, "/", token)
         dup.start()
     aftester.start_loop()
 except:
     if dup:
         dup.stop()
         dup.join()
Beispiel #7
0
        tester.process_settings(globals())
        check_file_md5sum(eng1_firmware_file, eng1_firmware_md5sum)
        check_file_md5sum(eng1_spy_file, eng1_spy_md5sum)
        if gwps_firmware_md5sum:
            m = hashlib.md5()
            with open(gwps_firmware_file, 'rb') as content_file:
                m.update(content_file.read())
            my_digest = m.hexdigest()
            if my_digest != gwps_firmware_md5sum:
                raise Exception('Firmware checksum test failed')

        ports = []

        #ftdi_serial_numbers = []
        for usb_sn in ftdi_serial_numbers:
            ports.append(ttyusb.find_tty_usb_sn('0403', '6001', usb_sn))
        for usb_sn in silab_serial_numbers:
            ports.append(ttyusb.find_tty_usb_sn('10c4', 'ea60', usb_sn))
        print ports
        engine = snapengine.SnapEngine(ports=ports)
        engine.save_nv_param(11, 0x100)
        engine.print_info('eng1', eng1_mac)
        engine.call(eng1_mac, 'rx', False)
        gwpstester = GWPSTester(engine)
        if token:
            from dropup import dropup
            dup = dropup.DropUp(gwpstester.datadir, "/", token)
            dup.start()
        gwpstester.start_loop()
    except:
        if dup:
Beispiel #8
0
            self.write('CONF:SETPT %d\r\n' % value)
            return value

    def remote_sense(self, value=None):
        if value is None:
            return int(self.ask('REM:SENS?\r\n'))
        else:
            if value:
                self.write('REM:SENS 1\r\n')
            else:
                self.write('REM:SENS 0\r\n')

if __name__ == "__main__":
    usb_serial_number = 'FTFJXVY9'
    from ttyusb import find_tty_usb_sn
    port = find_tty_usb_sn('0403', '6001', usb_serial_number)
    m = Magna(port)
    m.log_file = 'magna.log'
    m.log('serial_number = %s' % m.serial_number)
    try:
        m.operational_mode(MODE_ROTARY)
        m.log('operational_mode = %d' % m.operational_mode())
        sleep(1)
        m.output_protection_clear()
        sleep(5)
        m.operational_mode(MODE_REMOTE)
        m.log('operational_mode = %d' % m.operational_mode())
        sleep(5)
        #m.rst()
        m.output_state(False)
        m.log('output_state = %d' % m.output_state())
Beispiel #9
0
        self.write(cmd)
        time.sleep(0.5)
        line = self.readline()
        LEDs = line.split(" ")
        if LEDs[0] < LEDs[1] > LEDs[2]:  
            return True
        else:
            return False

    def IsBLUE(self, Chan):
        cmd = 'getrgbi0%s\r\n' % str(Chan)
        print cmd
        self.write(cmd)
        time.sleep(0.5)
        line = self.readline()
        LEDs = line.split(" ")
        if LEDs[0] < LEDs[2] > LEDs[1]:  
            return True
        else:
            return False
        

if __name__ == "__main__":
    print 'connect'
    feasa_usb_sn = 'EA3A'
    import ttyusb
    feasa_port = ttyusb.find_tty_usb_sn('0403', '6001', feasa_usb_sn)
    print feasa_port
    feasa = FEASA(feasa_port)
    feasa.Connect()
    
Beispiel #10
0
        #middle_index = number_of_points / 2
        #ap = [y[middle_index] / x[middle_index], 0]
        #error = 0.0
        #i = 0
        #while i < len(x):
            #v = numpy.polyval(ap, x[i])
            #e = math.fabs(v - y[i])
            #if e > error:
                #error = e
            #i += 1
        #print '# alterror =', error, '[V]  ', 100.0 * error / vnom, '%'


if __name__ == "__main__":
    tester.process_settings()
    fluke_port = ttyusb.find_tty_usb_sn('0403', '6001', fluke_usb_sn)
    fluke = fluke8845a.Fluke8845A(fluke_port)
    fluke.set_voltage_dc()
    #print fluke.get_read()

    k = keithley2220.Keithley2220(keithley_sn)
    k.output_state(False)

    usb_serial_numbers = [eng1_sn, eng2_sn, eng3_sn, eng4_sn]
    #usb_serial_numbers = [eng2_sn]
    ports = []
    for usb_sn in usb_serial_numbers:
        ports.append(ttyusb.find_tty_usb_sn('0403', '6001', usb_sn))
    ca = CalibAdc(fluke, k, ports=ports)
    ca.calib('tp24v', tp24v_mac, tp24v_channel, 24.0)
    ca.calib3p3('tp3p3v', tp3p3v_mac, tp3p3v_channel)
Beispiel #11
0
    #print_info(sn4)

    #port1 = ttyusb.find_tty_usb_sn('0403', '6001', eng1_sn)
    #eng1 = snapengine.SnapEngine(snap.SERIAL_TYPE_RS232, port1,
        #eng1_mac, addr='\x00\x00\x20')
    #port2 = ttyusb.find_tty_usb_sn('0403', '6001', eng2_sn)
    #eng2 = snapengine.SnapEngine(snap.SERIAL_TYPE_RS232, port2, eng2_mac,
        #addr='\x00\x00\x22')
    #port3 = ttyusb.find_tty_usb_sn('0403', '6001', eng3_sn)
    #eng3 = snapengine.SnapEngine(snap.SERIAL_TYPE_RS232, port3, eng3_mac,
        #addr='\x00\x00\x23')
    #port4 = ttyusb.find_tty_usb_sn('0403', '6001', eng4_sn)
    #eng4 = snapengine.SnapEngine(snap.SERIAL_TYPE_RS232, port4, eng4_mac,
        #addr='\x00\x00\x24')
    usb_serial_numbers = [eng1_sn, eng2_sn, eng3_sn, eng4_sn]
    #usb_serial_numbers = [eng2_sn]
    ports = []
    for usb_sn in usb_serial_numbers:
        ports.append(ttyusb.find_tty_usb_sn('0403', '6001', usb_sn))
    print ports
    eng = snapengine.SnapEngine(ports=ports,
        license_file=license_file,
        nvparams_file=nvparams_file
        )
    k = keithley2220.Keithley2220(keithley_sn)
    v = versaloon.Versaloon('0123456789ABCDEF00000000',
        vsprog=os.path.expanduser('~/vsprog/src/vsprog'))
    uut_port = ttyusb.find_tty_usb_sn('0403', '6001', s5_sn)
    print 'uut_port = ', uut_port
    aftester = AfTester(eng, k, v)
    aftester.start_loop()
Beispiel #12
0
        if full_scale:
            cmd = 'CURR:DC:RANG %s\r\n' % str(full_scale)
            #print cmd
            self.write(cmd)
            cmd = 'CURR:RANG:AUTO OFF\r\n'
            #print cmd
            self.write(cmd)
        else:
            cmd = 'CURR:RANG:AUTO ON\r\n'
            print cmd
            self.write(cmd)

    def get_read(self):
        self.write('READ?\r\n')
        line = self.readline()
        #print line
        return float(line)


if __name__ == "__main__":
    print 'open'
    fluke_usb_sn = 'AH0108P7'
    import ttyusb
    fluke_port = ttyusb.find_tty_usb_sn('0403', '6001', fluke_usb_sn)
    print fluke_port
    fluke = Fluke8845A(fluke_port)
    fluke.set_voltage_dc()
    print fluke.get_read()
    fluke.set_current_dc(10)
    print fluke.get_read()
Beispiel #13
0
                #m.update(content_file.read())
            #my_digest = m.hexdigest()
            #if my_digest != scb_firmware_md5sum:
                #raise Exception('Firmware checksum test failed')

        ports = []

        #ftdi_serial_numbers = []
        for usb_sn in ftdi_serial_numbers:
            ports.append(ttyusb.find_tty_usb('10c4', '8382'))
#            ports.append(ttyusb.find_tty_usb('067b', '2303'))
#            ports.append(ttyusb.find_tty_usb_sn('067b', '2303', ' '))
#            ports.append(ttyusb.find_tty_usb_sn('0403', '6001', 'FTG6RKT8'))
#            ports.append(ttyusb.find_tty_usb_sn('0403', '6001', usb_sn))
        for usb_sn in silab_serial_numbers:
            ports.append(ttyusb.find_tty_usb_sn('046d', 'c534', ''))
        print ports
        engine = snapengine.SnapEngine(ports=ports)
        #engine.retry = 0
        #engine.save_nv_param(11, 0)
        #try:
            #engine.call(eng1_mac, 'saveNvParam', 3, 0xbeef)  # network id
            #engine.call(eng1_mac, 'saveNvParam', 4, 7)  # channel
            #engine.call(eng1_mac, 'saveNvParam', 11, 0x11f)  # feature
            #engine.call(eng1_mac, 'reboot', 4, 0xbeef)
        #except:
            #pass
        #sleep(1)
        engine.save_nv_param(11, 0x100)
        #try:
            #engine.call(eng1_mac, 'saveNvParam', 3, 0xbeef)  # network id