@Andrew Neil Thank you for the suggestion to receive 1 byte at a time using HAL_UART_Receive_IT. I understand that this approach can add overhead, but it might work for my use case. However, I’m still unclear about how to determine the end of the file.
Since I will be receiving the file byte-by-byte, how can I know when I have received the complete binary file so I can proceed with writing the data to flash and jumping to the application?
I’m still unclear about how to determine the end of the file.
well, that's an entirely different question - nothing to do with the UART handling of the bytes!
As @Tesla DeLorean suggested, you will need some sort of protocol to handle that - X/Y/Z-modem are specifically designed for this very application, and are widely supported by terminal software.
I just wrote this program a few days ago. You should use DMA to receive data.Regularly query data and receive data for splicing。And my bin file transfer added crc check