mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-04-25 01:19:20 -04:00
Switch to using included binaries
* production test: Update message format * test_txrx_touchpad: Retry if device communications fail * production test: put all binaries in binaries/ folder * binaries/top.bin: replace broken binary
This commit is contained in:
parent
b38610d2a1
commit
b420ad787e
hw/boards/mta1-usb-v1/test
BIN
hw/boards/mta1-usb-v1/test/binaries/main.uf2
Normal file
BIN
hw/boards/mta1-usb-v1/test/binaries/main.uf2
Normal file
Binary file not shown.
BIN
hw/boards/mta1-usb-v1/test/binaries/usb_device_cdc.bin
Normal file
BIN
hw/boards/mta1-usb-v1/test/binaries/usb_device_cdc.bin
Normal file
Binary file not shown.
@ -14,15 +14,15 @@ import shutil
|
||||
file_locations = {
|
||||
'iceprog':'tillitis-iceprog',
|
||||
'chprog':'chprog',
|
||||
'app_gateware':'app_test/top.bin',
|
||||
'ch552_firmware':'../ch552_fw/usb_device_cdc.bin',
|
||||
'app_gateware':'binaries/top.bin',
|
||||
'ch552_firmware':'binaries/usb_device_cdc.bin',
|
||||
'ch552_firmware_injected':'/tmp/ch552_fw_injected.bin',
|
||||
'pico_bootloader_source':'/home/lab/ice40_flasher/bin/main.uf2',
|
||||
'pico_bootloader_source':'binaries/main.uf2',
|
||||
'pico_bootloader_target':'/media/lab/RPI-RP2/main.uf2'
|
||||
}
|
||||
|
||||
def enable_power():
|
||||
"""Enable power to the mta1-usb device"""
|
||||
"""Enable power to the TK-1"""
|
||||
d = hid_test.ice40_flasher()
|
||||
d.gpio_set_direction(7, True)
|
||||
d.gpio_put(7, True)
|
||||
@ -32,7 +32,7 @@ def enable_power():
|
||||
return True
|
||||
|
||||
def disable_power():
|
||||
"""Disable power to the mta1-usb device"""
|
||||
"""Disable power to the TK-1"""
|
||||
time.sleep(.1)
|
||||
d = hid_test.ice40_flasher()
|
||||
d.gpio_set_direction(7, True)
|
||||
@ -50,7 +50,7 @@ def measure_voltages(device, samples):
|
||||
return adc_vals
|
||||
|
||||
def voltage_test():
|
||||
"""Turn on the device, delay, measure 3.3V 2.5V, and 1.2V voltage rails, then turn off the device"""
|
||||
"""Measure 3.3V 2.5V, and 1.2V voltage rails on the TK-1"""
|
||||
enable_power()
|
||||
|
||||
d = hid_test.ice40_flasher()
|
||||
@ -70,7 +70,7 @@ def voltage_test():
|
||||
return True
|
||||
|
||||
def flash_validate_id():
|
||||
"""Read the ID from the flash, and verify that it's not all 0's or 1's (which would indicate a communications issue)"""
|
||||
"""Read the ID from TK-1 SPI flash, and verify that it's not all 0's or 1's"""
|
||||
result = run([
|
||||
file_locations['iceprog'],
|
||||
'-t'
|
||||
@ -90,7 +90,7 @@ def flash_validate_id():
|
||||
return (result.returncode == 0)
|
||||
|
||||
def flash_program():
|
||||
"""Program and verify the SPI flash with the application test gateware"""
|
||||
"""Program and verify the TK-1 SPI flash with the application test gateware"""
|
||||
result = run([
|
||||
file_locations['iceprog'],
|
||||
file_locations['app_gateware']
|
||||
@ -100,7 +100,7 @@ def flash_program():
|
||||
return (result.returncode == 0)
|
||||
|
||||
def flash_check():
|
||||
"""Verify the SPI flash is programmed with the application test gateware"""
|
||||
"""Verify the TK-1 SPI flash is programmed with the application test gateware"""
|
||||
result = run([
|
||||
file_locations['iceprog'],
|
||||
'-c',
|
||||
@ -111,7 +111,7 @@ def flash_check():
|
||||
return (result.returncode == 0)
|
||||
|
||||
def test_extra_io():
|
||||
"""Test the RTS, CTS, and GPIO1-4 lines by measuring a test pattern generated by the app_test gateware when RTS is toggled"""
|
||||
"""Test the TK-1 RTS, CTS, and GPIO1-4 lines by measuring a test pattern generated by the app_test gateware"""
|
||||
enable_power()
|
||||
|
||||
time.sleep(.1)
|
||||
@ -175,7 +175,7 @@ def inject_serial_number(infile, outfile, serial):
|
||||
of.write(f)
|
||||
|
||||
def flash_ch552(serial):
|
||||
"""Flash an attached CH552 device (in bootloader mode) with the USB CDC firmware, injected with the given serial number"""
|
||||
"""Flash an attached CH552 device with the USB CDC firmware, injected with the given serial number"""
|
||||
|
||||
print(serial)
|
||||
inject_serial_number(
|
||||
@ -242,7 +242,7 @@ def ch552_program():
|
||||
return True
|
||||
|
||||
def test_txrx_touchpad():
|
||||
"""Test UART communication by asking the operator to interact with the touch pad"""
|
||||
"""Test UART communication, RGB LED, and touchpad by asking the operator to interact with the touch pad"""
|
||||
description = {
|
||||
'vid':0x1207,
|
||||
'pid':0x8887,
|
||||
@ -259,7 +259,7 @@ def test_txrx_touchpad():
|
||||
for i in range(0,5):
|
||||
# Attempt to clear any buffered data from the serial port
|
||||
s.write(b'0123')
|
||||
time.sleep(0.1)
|
||||
time.sleep(0.2)
|
||||
s.read(20)
|
||||
|
||||
try:
|
||||
@ -279,14 +279,14 @@ def test_txrx_touchpad():
|
||||
return True
|
||||
except ValueError as e:
|
||||
print(e)
|
||||
return False
|
||||
continue
|
||||
|
||||
print('Max retries exceeded, failure!')
|
||||
return False
|
||||
|
||||
|
||||
def program_pico():
|
||||
"""Load the ice40 flasher firmware onto an rpi pico in bootloader mode"""
|
||||
"""Load the ice40 flasher firmware onto the TP-1"""
|
||||
print('Attach test rig to USB (times out in 10 seconds)')
|
||||
for trys in range(0,100): # retry every 0.1s
|
||||
try:
|
||||
@ -304,7 +304,7 @@ def program_pico():
|
||||
|
||||
|
||||
def sleep_2():
|
||||
""" Sleep for 2 seconds """
|
||||
"""Sleep for 2 seconds"""
|
||||
time.sleep(2)
|
||||
return True
|
||||
|
||||
@ -401,21 +401,23 @@ def run_tests(test_list):
|
||||
if __name__ == '__main__':
|
||||
last_a = 0
|
||||
|
||||
print('\n\nTillitis TK-1 and TP-1 Production tests')
|
||||
|
||||
while True:
|
||||
print('\n\n')
|
||||
|
||||
options = []
|
||||
|
||||
print('Test sequences')
|
||||
print('=== Test sequences ===')
|
||||
i = 1
|
||||
for name, tests in test_sequences.items():
|
||||
print('{:}{:}. {:}{:}({:})'.format(ANSI['bold'], i, name, ANSI['reset'], ', '.join([test.__name__ for test in tests])))
|
||||
print('{:}{:}. {:}{:}: {:}'.format(ANSI['bold'], i, name, ANSI['reset'], ', '.join([test.__name__ for test in tests])))
|
||||
options.append(tests)
|
||||
i += 1
|
||||
|
||||
print('\nManual tests')
|
||||
print('\n=== Manual tests ===')
|
||||
for test in manual_tests:
|
||||
print('{:}{:}. {:}{:} ({:})'.format(ANSI['bold'], i, test.__name__, ANSI['reset'], test.__doc__))
|
||||
print('{:}{:}. {:}{:}: {:}'.format(ANSI['bold'], i, test.__name__, ANSI['reset'], test.__doc__))
|
||||
options.append([test])
|
||||
i += 1
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user