Example #1
0
	def reset_internal_state_machine(self):
		bbc = BitBangController(self.vendor, self, product, 2)
		bbc.set_soft_reset_to_output()
		bbc.soft_reset_high()
		time.sleep(.2)
		bbc.soft_reset_low()
		time.sleep(.2)
		bbc.soft_reset_high()
Example #2
0
    def setUp(self):
        self.dbg = False
        self.vbs = False
        if "S1_VERBOSE" in os.environ:
            if (os.environ["S1_VERBOSE"] == "True"):
                self.vbs = True

        if "S1_DEBUG" in os.environ:
            if (os.environ["S1_DEBUG"] == "True"):
                self.dbg = True

        os.environ["S1_BASE"] = sys.path[0] + "/s1-pycontrol"

        self.bbc = BitBangController(0x0403, 0x8530, 2)
        return
Example #3
0
 def is_programmed(self):
     vendor = self.d.data[0]
     product = self.d.data[1]
     bbc = BitBangController(vendor, product, 2)
     self.d.data = bbc.read_done_pin()
     bbc.pins_on()
     bbc.set_pins_to_input()
     self.hrq.put(ARTEMIS_RESP_OK)
 def is_programmed(self):
     vendor = self.d.data[0]
     product = self.d.data[1]
     bbc = BitBangController(vendor, product, 2)
     self.d.data = bbc.read_done_pin()
     bbc.pins_on()
     bbc.set_pins_to_input()
     self.hrq.put(DIONYSUS_RESP_OK)
Example #5
0
	def setUp(self):
		self.dbg = False;
		self.vbs = False;
		if "S1_VERBOSE" in os.environ:
			if (os.environ["S1_VERBOSE"] == "True"):
				self.vbs = True

		if "S1_DEBUG" in os.environ:
			if (os.environ["S1_DEBUG"] == "True"):
				self.dbg = True

		os.environ["S1_BASE"] = sys.path[0] + "/s1-pycontrol"


		self.bbc = BitBangController(0x0403, 0x8530, 2)
		return
def program(vendor, product, serial_number, status=None):
    """
        Send a program signal to the Artemis

        Args:
            vendor (int): Vendor ID of the USB Device
            product (int): Product ID of the USB Device
            serial_number (int): Serial Number of the device
            status (Status Object): Status object, could be left blank if status is
                not needed

        Return:
            Nothing

        Raises:
            USBError

        """
    bbc = BitBangController(vendor, product, 2)
    bbc.set_pins_to_input()
    if status: status.Debug("Set signals to output")
    bbc.set_pins_to_output()
    bbc.program_high()
    time.sleep(.5)
    if status: status.Debug("Program low for .2 seconds")
    bbc.program_low()
    time.sleep(.2)
    if status: status.Debug("Program high for")
    bbc.program_high()
    bbc.pins_on()
    if status: status.Debug("Set signals to inputs")
    bbc.set_pins_to_input()
    def reset(self):
        """
        Send a reset signal to the board, this is the same as pressing the
        'reset' button

        Args:
            Nothing

        Returns:
            Nothing

        Raises:
            Nothing
        """
        bbc = BitBangController(self.vendor, self.product, 2)
        bbc.set_soft_reset_to_output()
        bbc.soft_reset_high()
        time.sleep(.2)
        bbc.soft_reset_low()
        time.sleep(.2)
        bbc.soft_reset_high()
        bbc.pins_on()
        bbc.set_pins_to_input()
    def program(self):
        """
        Send a program signal to the board, the FPGA will attempt to read the
        binary image file from the SPI prom. If successful the 'done' LED will
        illuminate

        Args:
            Nothing

        Returns:
            Nothing

        Raises:
            Nothing
        """
        bbc = BitBangController(self.vendor, self.product, 2)
        if self.s: self.s.Important("Set signals to input")
        bbc.set_pins_to_input()
        bbc.set_pins_to_output()
        bbc.program_high()
        time.sleep(.5)
        bbc.program_low()
        time.sleep(.2)
        bbc.program_high()
        bbc.pins_on()
        bbc.set_pins_to_input()
Example #9
0
	def program_FPGA(self):
		bbc = BitBangController(self.vendor, self.product, 2)	
		bbc.set_pins_to_input()
		#I don't know if this works
		bbc.set_program_to_output()
		bbc.program_high()
		time.sleep(.5)
		bbc.program_low()
		time.sleep(.2)
		bbc.program_high()
		bbc.set_pins_to_input()
def program(vendor, product, serial_number, status = None):
        """
        Send a program signal to the Dionysus

        Args:
            vendor (int): Vendor ID of the USB Device
            product (int): Product ID of the USB Device
            serial_number (int): Serial Number of the device
            status (Status Object): Status object, could be left blank if status is
                not needed

        Return:
            Nothing

        Raises:
            USBError

        """
        bbc = BitBangController(vendor, product, 2)
        bbc.set_pins_to_input()
        if status: status.Debug("Set signals to output")
        bbc.set_pins_to_output()
        bbc.program_high()
        time.sleep(.5)
        if status: status.Debug("Program low for .2 seconds")
        bbc.program_low()
        time.sleep(.2)
        if status: status.Debug("Program high for")
        bbc.program_high()
        bbc.pins_on()
        if status: status.Debug("Set signals to inputs")
        bbc.set_pins_to_input()
    def program(self):
        """
        Send a program signal to the board, the FPGA will attempt to read the
        binary image file from the SPI prom. If successful the 'done' LED will
        illuminate

        Args:
            Nothing

        Returns:
            Nothing

        Raises:
            Nothing
        """
        bbc = BitBangController(self.vendor, self.product, 2)
        if self.s: self.s.Important("Set signals to input")
        bbc.set_pins_to_input()
        bbc.set_pins_to_output()
        bbc.program_high()
        time.sleep(.5)
        bbc.program_low()
        time.sleep(.2)
        bbc.program_high()
        bbc.pins_on()
        bbc.set_pins_to_input()
Example #12
0
 def reset(self):
     vendor = self.d.data[0]
     product = self.d.data[1]
     bbc = BitBangController(vendor, product, 2)
     bbc.set_soft_reset_to_output()
     bbc.soft_reset_high()
     time.sleep(.2)
     bbc.soft_reset_low()
     time.sleep(.2)
     bbc.soft_reset_high()
     bbc.pins_on()
     bbc.set_pins_to_input()
     self.hrq.put(ARTEMIS_RESP_OK)
 def reset(self):
     vendor = self.d.data[0]
     product = self.d.data[1]
     bbc = BitBangController(vendor, product, 2)
     bbc.set_soft_reset_to_output()
     bbc.soft_reset_high()
     time.sleep(.2)
     bbc.soft_reset_low()
     time.sleep(.2)
     bbc.soft_reset_high()
     bbc.pins_on()
     bbc.set_pins_to_input()
     self.hrq.put(DIONYSUS_RESP_OK)
Example #14
0
class Test (unittest.TestCase):
	"""Unit test for Bitbang controller"""

	def setUp(self):
		self.dbg = False;
		self.vbs = False;
		if "S1_VERBOSE" in os.environ:
			if (os.environ["S1_VERBOSE"] == "True"):
				self.vbs = True

		if "S1_DEBUG" in os.environ:
			if (os.environ["S1_DEBUG"] == "True"):
				self.dbg = True

		os.environ["S1_BASE"] = sys.path[0] + "/s1-pycontrol"


		self.bbc = BitBangController(0x0403, 0x8530, 2)
		return

	def tearDown(self):
		del self.bbc

	def test_individual_direction(self):
		print ""
		print "reading inputs"
		#self.bbc.set_pins_to_output()
		prg = self.bbc.read_program_pin()
		srs = self.bbc.read_soft_reset_pin()

		print "Program Pin: " + str(prg)
		print "Reset Pin: " + str(srs)
		print "Program pins: " + hex(self.bbc.read_pins())
		print ""

		print "setting reset pin only to output"
		self.bbc.set_soft_reset_to_output()

		print "setting program pin low (shouldn't go low), reset high"
		self.bbc.program_low()
		prg = self.bbc.read_program_pin()
		self.bbc.soft_reset_high()
		srs = self.bbc.read_soft_reset_pin()
		print "Program Pin: " + str(prg)
		print "Reset Pin: " + str(srs)
		print "Program pins: " + hex(self.bbc.read_pins())
		print ""
		#self.assertEqual(prg, True)
		#self.assertEqual(srs, True)

		print "setting program pin high, reset low"
		self.bbc.program_high()
		prg = self.bbc.read_program_pin()
		self.bbc.soft_reset_low()
		srs = self.bbc.read_soft_reset_pin()
		print "Program Pin: " + str(prg)
		print "Reset Pin: " + str(srs)
		print "Program pins: " + hex(self.bbc.read_pins())
		print ""
		self.assertEqual(prg, True)
		self.assertEqual(srs, False)

		print "setting program pin only to ouput"
		self.bbc.set_program_to_output()

		self.bbc.program_low()
		prg = self.bbc.read_program_pin()
		self.bbc.soft_reset_high()
		srs = self.bbc.read_soft_reset_pin()
		print "Program Pin: " + str(prg)
		print "Reset Pin: " + str(srs)
		print "Program pins: " + hex(self.bbc.read_pins())
		print ""
		self.assertEqual(prg, False)
		self.assertEqual(srs, True)

		print "setting program pin high, reset low"
		self.bbc.program_high()
		prg = self.bbc.read_program_pin()
		self.bbc.soft_reset_low()
		srs = self.bbc.read_soft_reset_pin()
		print "Program Pin: " + str(prg)
		print "Reset Pin: " + str(srs)
		print "Program pins: " + hex(self.bbc.read_pins())
		print ""
#		self.assertEqual(prg, True)
#		self.assertEqual(srs, True)





	def test_individual_pins(self):
		print ""
		print "reading input"
		prg = self.bbc.read_program_pin()
		srs = self.bbc.read_soft_reset_pin()

		print "Program Pin: " + str(prg)
		print "Reset Pin: " + str(srs)
		print "Program pins: " + hex(self.bbc.read_pins())
		print ""


		print "setting pins to output"
		self.bbc.set_pins_to_output()

		print "setting program pin low, reset high"
		self.bbc.program_low()
		prg = self.bbc.read_program_pin()
		self.bbc.soft_reset_high()
		srs = self.bbc.read_soft_reset_pin()
		print "Program Pin: " + str(prg)
		print "Reset Pin: " + str(srs)
		print "Program pins: " + hex(self.bbc.read_pins())
		print ""
		#self.assertEqual(prg, False)
		#self.assertEqual(srs, True)

		print "setting program pin high, reset low"
		self.bbc.program_high()
		prg = self.bbc.read_program_pin()
		self.bbc.soft_reset_low()
		srs = self.bbc.read_soft_reset_pin()
		print "Program Pin: " + str(prg)
		print "Reset Pin: " + str(srs)
		print "Program pins: " + hex(self.bbc.read_pins())
		print ""
		#self.assertEqual(prg, True)
		#self.assertEqual(srs, False)

#		self.bbc.set_program_pin_to_input()
		print "Setting pins to input:"
		self.bbc.set_pins_to_input()
		prg = self.bbc.read_program_pin()
		srs = self.bbc.read_soft_reset_pin()

		print "Program Pin: " + str(prg)
		print "Reset Pin: " + str(srs)
		print "Program pins: " + hex(self.bbc.read_pins())
		print ""
Example #15
0
 def program_FPGA(self):
     bbc = BitBangController(self.vendor, self.product, 2)
     bbc.set_pins_to_input()
     #I don't know if this works
     #   bbc.set_program_to_output()
     bbc.set_pins_to_output()
     bbc.program_high()
     time.sleep(.5)
     bbc.program_low()
     time.sleep(.2)
     bbc.program_high()
     bbc.pins_on()
     bbc.set_pins_to_input()
    def reset(self):
        """
        Send a reset signal to the board, this is the same as pressing the
        'reset' button

        Args:
            Nothing

        Returns:
            Nothing

        Raises:
            Nothing
        """
        bbc = BitBangController(self.vendor, self.product, 2)
        bbc.set_soft_reset_to_output()
        bbc.soft_reset_high()
        time.sleep(.2)
        bbc.soft_reset_low()
        time.sleep(.2)
        bbc.soft_reset_high()
        bbc.pins_on()
        bbc.set_pins_to_input()
Example #17
0
 def reset_internal_state_machine(self):
     bbc = BitBangController(self.vendor, self.product, 2)
     bbc.set_soft_reset_to_output()
     bbc.soft_reset_high()
     time.sleep(.2)
     bbc.soft_reset_low()
     time.sleep(.2)
     bbc.soft_reset_high()
     bbc.pins_on()
     bbc.set_pins_to_input()
Example #18
0
class Test(unittest.TestCase):
    """Unit test for Bitbang controller"""
    def setUp(self):
        self.dbg = False
        self.vbs = False
        if "S1_VERBOSE" in os.environ:
            if (os.environ["S1_VERBOSE"] == "True"):
                self.vbs = True

        if "S1_DEBUG" in os.environ:
            if (os.environ["S1_DEBUG"] == "True"):
                self.dbg = True

        os.environ["S1_BASE"] = sys.path[0] + "/s1-pycontrol"

        self.bbc = BitBangController(0x0403, 0x8530, 2)
        return

    def tearDown(self):
        del self.bbc

    def test_individual_direction(self):
        print ""
        print "reading inputs"
        #self.bbc.set_pins_to_output()
        prg = self.bbc.read_program_pin()
        srs = self.bbc.read_soft_reset_pin()

        print "Program Pin: " + str(prg)
        print "Reset Pin: " + str(srs)
        print "Program pins: " + hex(self.bbc.read_pins())
        print ""

        print "setting reset pin only to output"
        self.bbc.set_soft_reset_to_output()

        print "setting program pin low (shouldn't go low), reset high"
        self.bbc.program_low()
        prg = self.bbc.read_program_pin()
        self.bbc.soft_reset_high()
        srs = self.bbc.read_soft_reset_pin()
        print "Program Pin: " + str(prg)
        print "Reset Pin: " + str(srs)
        print "Program pins: " + hex(self.bbc.read_pins())
        print ""
        #self.assertEqual(prg, True)
        #self.assertEqual(srs, True)

        print "setting program pin high, reset low"
        self.bbc.program_high()
        prg = self.bbc.read_program_pin()
        self.bbc.soft_reset_low()
        srs = self.bbc.read_soft_reset_pin()
        print "Program Pin: " + str(prg)
        print "Reset Pin: " + str(srs)
        print "Program pins: " + hex(self.bbc.read_pins())
        print ""
        self.assertEqual(prg, True)
        self.assertEqual(srs, False)

        print "setting program pin only to ouput"
        self.bbc.set_program_to_output()

        self.bbc.program_low()
        prg = self.bbc.read_program_pin()
        self.bbc.soft_reset_high()
        srs = self.bbc.read_soft_reset_pin()
        print "Program Pin: " + str(prg)
        print "Reset Pin: " + str(srs)
        print "Program pins: " + hex(self.bbc.read_pins())
        print ""
        self.assertEqual(prg, False)
        self.assertEqual(srs, True)

        print "setting program pin high, reset low"
        self.bbc.program_high()
        prg = self.bbc.read_program_pin()
        self.bbc.soft_reset_low()
        srs = self.bbc.read_soft_reset_pin()
        print "Program Pin: " + str(prg)
        print "Reset Pin: " + str(srs)
        print "Program pins: " + hex(self.bbc.read_pins())
        print ""
#		self.assertEqual(prg, True)
#		self.assertEqual(srs, True)

    def test_individual_pins(self):
        print ""
        print "reading input"
        prg = self.bbc.read_program_pin()
        srs = self.bbc.read_soft_reset_pin()

        print "Program Pin: " + str(prg)
        print "Reset Pin: " + str(srs)
        print "Program pins: " + hex(self.bbc.read_pins())
        print ""

        print "setting pins to output"
        self.bbc.set_pins_to_output()

        print "setting program pin low, reset high"
        self.bbc.program_low()
        prg = self.bbc.read_program_pin()
        self.bbc.soft_reset_high()
        srs = self.bbc.read_soft_reset_pin()
        print "Program Pin: " + str(prg)
        print "Reset Pin: " + str(srs)
        print "Program pins: " + hex(self.bbc.read_pins())
        print ""
        #self.assertEqual(prg, False)
        #self.assertEqual(srs, True)

        print "setting program pin high, reset low"
        self.bbc.program_high()
        prg = self.bbc.read_program_pin()
        self.bbc.soft_reset_low()
        srs = self.bbc.read_soft_reset_pin()
        print "Program Pin: " + str(prg)
        print "Reset Pin: " + str(srs)
        print "Program pins: " + hex(self.bbc.read_pins())
        print ""
        #self.assertEqual(prg, True)
        #self.assertEqual(srs, False)

        #		self.bbc.set_program_pin_to_input()
        print "Setting pins to input:"
        self.bbc.set_pins_to_input()
        prg = self.bbc.read_program_pin()
        srs = self.bbc.read_soft_reset_pin()

        print "Program Pin: " + str(prg)
        print "Reset Pin: " + str(srs)
        print "Program pins: " + hex(self.bbc.read_pins())
        print ""