Example #1
0
 def on_board_change(self, index):
     log.debug('%d, %s', index, self.ui.cbo_roach.itemText(index))
     roach = self.ui.cbo_roach.itemText(index)
     if self.fpga and self.fpga.is_connected():
         log.info('Disconnect from %s:%d' % self.fpga.bindaddr)
         self.fpga.stop()
         self.fpga = None
     if self.timer_id != 0:
         self.killTimer(self.timer_id)
         self.timer_id = 0
     log.info('Connecting to %s', roach)
     self.fpga = katcp_wrapper.FpgaClient(roach)
     time.sleep(0.1)
     if not self.fpga.is_connected():
         msg = 'Can not connect to %s' % roach
         log.warn(msg)
         self.fpga.stop()
         QtGui.QMessageBox.critical(self, 'Error', msg,
                                    QtGui.QMessageBox.Ok, 0)
         return
     # katadc.chip_init(self.fpga, 0)
     # katadc.chip_init(self.fpga, 1)
     self.retrieve_board_level_entries()
     self.retrieve_unit_level_entries()
     rb_unit = self.ui.rb_unit0 if self.unit == 0 else self.ui.rb_unit1
     rb_unit.setChecked(True)
     if self.timer_id == 0:
         self.timer_id = self.startTimer(1000)
Example #2
0
import sys
import time
import os.path
import katcp_wrapper

roach_board, ext = os.path.splitext(os.path.basename(sys.argv[0]))
fpga = katcp_wrapper.FpgaClient(roach_board)
time.sleep(0.1)
if fpga.is_connected():
	print('Connected to %s:%d' % fpga.bindaddr)
Example #3
0
        lh = log_handlers.DebugLogHandler()
        logger = logging.getLogger(roach)
        logger.addHandler(lh)
        logger.setLevel(10)

        parser = argparse.ArgumentParser()
        parser.add_argument('-s',
                            '--skip',
                            action='store_true',
                            default=False,
                            help='Skip programming FPGA')
        args = parser.parse_args()

        print('Connecting to server %s on port %i... ' % (roach, katcp_port)),
        fpga = katcp_wrapper.FpgaClient(roach,
                                        katcp_port,
                                        timeout=10,
                                        logger=logger)
        time.sleep(0.1)

        # '''
        if fpga.is_connected():
            print('ok')
        else:
            print('ERROR connecting to server %s on port %i.\n' %
                  (roach, katcp_port))
            exit_fail()

        print('-' * 20)

        if not args.skip:
            print('Programming FPGA with  %s ... ' % bitstream),
Example #4
0
               "e.g. {0:s} r1745 0").format(os.path.basename(sys.argv[0])))
        exit()

    log = init_logger()

    roach = sys.argv[1]
    katcp_port = 7147
    unit = int(sys.argv[2]) if len(sys.argv) > 2 else 0
    if not unit in (0, 1):
        log.critical('Invalid unit number %d', unit)
        exit()

    try:
        log.info('Connecting to server %s on port %i ... ' %
                 (roach, katcp_port))
        fpga = katcp_wrapper.FpgaClient(roach, katcp_port, timeout=1)
        time.sleep(0.1)
        if not fpga.is_connected():
            log.error('ERROR connecting to server %s on port %i.\n' %
                      (roach, katcp_port))
            exit()

        app = QtGui.QApplication([])

        setup_gui(roach + ' - {:d}'.format(unit))
        plot_anim(unit)

        timer = QtCore.QTimer()
        timer.timeout.connect(lambda: plot_anim(unit))
        timer.start(1000)