From 4398d7ecdf432a2211a9d93deaedb721648dbb15 Mon Sep 17 00:00:00 2001 From: Paul Selkirk Date: Thu, 23 Feb 2017 16:58:17 -0500 Subject: Speed up file upload enormously. We need to start with a long serial timeout, in order to catch the reboot messages for a firmware upload (this has to be done through the bootloader). But once we start sending the file, cut the serial timeout to 1ms. (I've tested it down to 1us, but that may not work for everyone, and it doesn't improve performance in a statistically significant way.) This brings the time to upload a 4.5MB bitstream from 38:23 to 1:25. --- projects/hsm/cryptech_upload | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/hsm/cryptech_upload b/projects/hsm/cryptech_upload index b41f25b..b6d2554 100755 --- a/projects/hsm/cryptech_upload +++ b/projects/hsm/cryptech_upload @@ -181,6 +181,7 @@ def send_file(src, size, args, dst): print("Device did not accept the upload command (got {!r})".format(response)) return False + dst.timeout = 0.001 crc = 0 counter = 0 # 1. Write size of file (4 bytes) @@ -284,7 +285,7 @@ def main(): print "Uploading {} from {}".format(name, args.firmware_tarball.name) print "Initializing serial port and synchronizing with HSM, this may take a few seconds" - dst = serial.Serial(args.device, 921600, timeout = 2) + dst = serial.Serial(args.device, 921600, timeout = 1) send_file(src, size, args, dst) dst.close() -- cgit v1.2.3