2024-03-01 04:58 AM
Hi,
I'm currently working on file transfer through the XMODEM protocol, and I want to implement the logic in STM32CubeIDE. If anyone has already implemented it, please share the source code. It would be helpful for me.
Thanks
2024-03-07 04:51 AM
@pvall.1 Of course you can use any adapter from the TTL UART of the STM32 to a PC. For a modern PC that does not have RS-232 ports, TTL to USB adapter is the best choice. If compatibility with RS-232 is needed, use a passive TTL to RS-232 adapter.
2024-03-07 08:02 AM
If on the other side you're using TeraTerm, I suggest to develop your MCU counterpart from TeraTerm source code.
Remember: from the TeraTerm serial connection, you always receive a stream of bytes in open chain, so you have to write your own parser to scan the received bytes and detect XMODEM packets. I remark this since I don't know your experience with pure UARTs, maybe you're expecting to receive something structured, i.e. like an udp datagram.
2024-03-13 04:20 AM
Hi,
I utilized the above code and changed it as per requirements. I am able to receive one packet correctly with a matching CRC value. However, when I send an ACK or NAK from the receiver end, the sender is not sending the second packet. What could be the possible reason?
2024-03-13 04:25 AM
Your ACK or NAK must be incorrect in some way.
Try capturing the traffic from a "good" transfer, and compare with a failing one ...
Does the sender give any error details to help?
Have you tried with any other sender(s)?
2024-03-13 05:44 AM
The sender didn't provide any details like EOT or CAN. It's timing out and the X-Modem send popup disappears. After timing out, I'm able to see the NAK sent by the receiver in the command Prompt.
2024-03-13 06:18 AM
Have you seen one of Ymodem examples from ST? they have Ymodem-1K in several examples and demo apps for several MCU models: IAP, SBSFU... It works well with latest Teraterm. Xmodem is older simpler protocol.