fredrikhederstierna / fymodem

Free YModem implementation.
47 stars 17 forks source link

fymodem_receive needs to initiate file transfer #1

Open knor12 opened 6 years ago

knor12 commented 6 years ago

you need to insert __ym_putchar(YM_CRC); between lines 263 and 264 in fymodem.c

currently /* receive packets */ int32_t res = ym_rx_packet(rx_packet_data,

should be /* receive packets */ __ym_putchar(YM_CRC); int32_t res = ym_rx_packet(rx_packet_data,

per ymodem protocol, the receiver needs to send character 'C' to initiate ymodem transfer.

please refer to page 16 of XMODEM and YMODEM File Transfer Protocols by Chuck Forsberg. http://www.rogtronics.net/files/datasheets/micro_z80/xymodem.pdf

I tested the source code for receiving files sent using ymodem protocol using teraterm but it didn't work until i made the change specified above.

Noreddine Kessa

fredrikhederstierna commented 5 years ago

Thanks for comment, and sorry for long delayed answer :) The code to handle initial CRC is done by if (!first_try) { __ym_putchar(YM_CRC); } first_try = false; but this is only done once, maybe the RX FIFO should be flushed prior to initiating RX to avoid initial setup/sync issue with receiver... I will try test it, thanks again for comment.

mttbx commented 3 years ago

Any progress? Why there's first_try anyway?

fredrikhederstierna commented 3 years ago

Hi, I think this was fixed in last commit, there previously was an issue so change from (!first_try) to (first_try), and i think this CRC is only kicked-off once to initiate transfer. Thanks for checking this! BR Fredrik