Skip to content

Uploader speed-up tip. #12

@ole00

Description

@ole00

Hi,
thank you for sharing your excellent library JTAG library. I'd like to share the following tip that can improve uploading speed.

I managed to get some significant upload speed-ups by sending the very first data chunk a little bit bigger than requested. As a result some extra bytes are probably held in OS buffers reducing reaction time to the new data request coming from the MCU.
The change in Uploader.py is as follows:

--- Uploader.py.orig	2024-03-31 10:15:34.578022226 +0100
+++ Uploader.py	2024-03-31 10:07:41.720332743 +0100
@@ -101,6 +101,10 @@
             argument = line[1:]
             if command == 'S':
                 num_bytes = int(argument)
+                if bytes_written == 0:
+                    num_bytes = num_bytes + 48
+                    if  num_bytes > self._file_size:
+                        num_bytes = self._file_size
                 xsvf_data = fd.read(num_bytes)
                 bytes_written += len(xsvf_data)
                 self.update_hashes(xsvf_data)

The value 48 was selected experimentally (when S63 is sent from Arduino UNO), higher values seem to cause upload issues, but even a size as small as 16 bytes can improve the upload speed. Here is an example of sending an erase .xsvf sequence of 23126 bytes to ATF1504ASL device (115200 baud rate):
Original code: 3.39 seconds
New code: 2.47 seconds

This was tested on Ubuntu 20.04 uploading to Arduino UNO. The player code looks like this:

PlayXSVFJTAGArduino p(Serial, SERIAL_RX_BUFFER_SIZE, 12, 2, 4, 3, 10, false);

I don't know whether the trick would work on Windows OS though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions