CDC_Transmit_FS is non-blocking and also it uses your buffer directly without copying it anywhere, so the data may get modified by your code before being transmitted. You can make a simple blocking wrapper like this:extern USBD_HandleTypeDef hUsbDevi...