
On Tue, Feb 06, 2024 at 09:05:33PM +0800, jihongbin wrote:
It may be that there are relatively few people using this function, or the length of the transmitted data is less than 128byte * 255 byte, so the triggering conditions for the above problems are not encountered;
I actually discovered this problem during testing. Continuous transmission always fails at block 255.
The following is the protocol's definition of blk cblk, cblk = 255 - blk The original content of the agreement (https://www.menie.org/georges/embedded/xmodem_specification.html) is as follows: -------- 3. MESSAGE BLOCK LEVEL PROTOCOL Each block of the transfer looks like: <SOH><blk #><255-blk #><--128 data bytes--><cksum> in which: <SOH> = 01 hex <blk #> = binary number, starts at 01 increments by 1, and wraps 0FFH to 00H (not to 01) <255-blk #> = blk # after going thru 8080 "CMA" instr, i.e. each bit complemented in the 8-bit block number. Formally, this is the "ones complement".
<cksum> = the sum of the data bytes only. Toss any carry.
Please repost the patch with these kind of details in the commit message, thanks.