Send file in Xmodem
I have the same problem like that here: http://logmett.com/forum/viewtopic.php?f=2&t=354
I think/hope Yutaka Hirata understand the problem well.
In the Link was the problem wile synchronize with "c" what means CRC check. BUT i have to syncronize with 0x15 (NACK). With means without CRC. The patch shown in the Link helps only with the "c" sync.
I prefere flush the input buffer before calling XSendPacket(maybe only before sending the first packet). Because the extenden Xmodem transfer allowes to sync with some other characters than "c" or NACK.
In fact while sending (the first) packet, no character has to be placed in the input buffer BEFORE the packet was transfered complete.
Alternately add all allowed sync chars like in the patch from link. But this is not usefull for future!
There are many issues found in internet about this. But mostly the problem is not recognised correct why.