USB CDC flushing TX buffer
I'm using STM32Cube v1.16.0 and this is working for me:

#include "stm32f4xx_ll_usb.h"

...

PCD_HandleTypeDef *hpcd = hUsbDeviceFS.pData;
USB_FlushTxFifo(hpcd-&gt;Instance, 0x10U);


Flag 0x10U means "Flush all Tx buffers". See stm32f4xx_ll_usb.c for details.