Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions components/utilities/ymodem/ymodem.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,13 @@ static rt_err_t _rym_do_fin(struct rym_ctx *ctx)
return -RYM_ERR_CODE;

_rym_putchar(ctx, RYM_CODE_ACK);
/*
* Character sticking / byte fusion: when the receiver sends ACK (0x06) and 'C' (0x43) back-to-back,
* if the gap between them is extremely short and the sender's UART driver has an improper timeout
* or interrupt handling, one of the two bytes may get swallowed (e.g. only 0x06 is read and 0x43 is missed).
* So add 40ms delay here.
*/
rt_thread_mdelay(40);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[建议] 请补充复现所用发送工具及版本、波特率,以及 40 ms 的选择依据,并确认连续文件和标准发送端在加入间隔后均能完成最后一个空包握手。这里对所有调用者固定增加一次延时,保留明确的兼容性测试条件有助于后续维护,避免仅用“字节粘连”解释发送端读取问题。

_rym_putchar(ctx, RYM_CODE_C);

code = _rym_read_code(ctx, RYM_WAIT_PKG_TICK);
Expand Down
Loading