Here the main changes made to fix it (same as described for Ember in #1254):
When selecting option 1 (transfer file) from the bootloader menu, the update handler now waits until it receives a '0x43' (XModem ready) before starting the transfer. In the previous solution, there was only one sleep (1500) before the transfer was started.
In the transferFile method, the readChunk method is now called outside the inner do-while loop. The reason for this is that the inner do-while loop repeats sending the chunk data until it receives an ACK for it. In the current solution, the retry logic also calls readChunk again, which then reads the next chunk and makes 'forget' that the previous chunk was not acknowledged. With the new solution, you re-send the same data as long as it is not acknowledged.
After transferring the data of a single chunk, we now wait until we get a transfer response != '0x43' (XModem ready).
At the end of the file transfer we now repeat sending an ETO (End of Transfer) until we get an ACK.
This is the same problem as with the Ember dongle in #1254
These are some logs
Here the main changes made to fix it (same as described for Ember in #1254):
I will create a PR for it.