diff --git a/hw/boards/mta1-usb-v1/test/hid_test.py b/hw/boards/mta1-usb-v1/test/hid_test.py index f384b6d..ddadc1b 100644 --- a/hw/boards/mta1-usb-v1/test/hid_test.py +++ b/hw/boards/mta1-usb-v1/test/hid_test.py @@ -9,8 +9,11 @@ USB_VID = 0xcafe class ice40_flasher: def __init__(self): + self.dev = None for dict in hid.enumerate(USB_VID): self.dev = hid.Device(dict['vendor_id'], dict['product_id']) + if self.dev is None: + raise IOError("Couldn't find any hid device with vendor id 0x%x" % (USB_VID)) def close(self): self.dev.close() diff --git a/hw/boards/mta1-usb-v1/test/requirements.txt b/hw/boards/mta1-usb-v1/test/requirements.txt new file mode 100644 index 0000000..0987a4e --- /dev/null +++ b/hw/boards/mta1-usb-v1/test/requirements.txt @@ -0,0 +1,4 @@ +hid==1.0.5 +numpy==1.23.4 +pyserial==3.5 +pyusb==1.2.1 diff --git a/hw/boards/mta1-usb-v1/test/reset.py b/hw/boards/mta1-usb-v1/test/reset.py index 3bc9511..bd23fdc 100755 --- a/hw/boards/mta1-usb-v1/test/reset.py +++ b/hw/boards/mta1-usb-v1/test/reset.py @@ -2,12 +2,15 @@ import hid_test import time -def reset_mta1(): - """ Manipulate the GPIO lines on the MTA1-USB-CH552 Programmer to issue a hardware reset to the MTA1 """ + +def reset_tk1(): + """Manipulate the GPIO lines on the MTA1-USB-CH552 Programmer to issue a + hardware reset to the TK1. The result is that TK1 again will be in firmware + mode, so a new app can be loaded.""" d = hid_test.ice40_flasher() d.gpio_set_direction(14, True) d.gpio_put(14, False) d.gpio_set_direction(14, False) d.close() -reset_mta1() +reset_tk1()