I'm trying to implement an XMODEM file transfer through the USB CDC Interface on an STM32L4 processor in Full-Speed and seem to be having issues with XMODEM 132 byte packets getting split up and one of the middle packets getting resubmitted. I need to be able to NAK/ACK the XMODEM packets to keep the transfer going but this seems to sometimes mess up the submitting of the sub-packets causing me to get invalid data. Is there anyway to only trigger the CDC_Receive_FS function once all 132 bytes are received at the end point? Handling the separate packets from within the CDC_Receive_FS is causing problems because sometimes the broken up packets are being sent multiple times and there is no easy way of detecting a repeat.
I generated my code using the latest STM32 firmware for STM32CubeMX and am working in Keil.