2017-09-18 06:52 AM
A brief introduction to this problem:
STM32F7 is configured for USB Device FS. USB interface is used to transmit a large array of data from MCU to computer. If, by any chance user closes the Virtual Com Port of MCU, next time user opens com port, MCU will send remains of the data it was transmitting to computer, creating a lot of troubles.
I want to flush TX buffer of USB Device mode or abort transmition progress whenever VCP is opened/closed in the computer.
#cdc #stm32 #hal #usb #vcp2024-03-29 12:16 AM
Hi, did you ever find a solution to this? I have the exact same problem (STM32L4).
If the computer closes the VCP, when it re-opens, it receives the last packet that the STM32 tried to previously transmit. I want to know how to clear the USB TX buffer.
I tried: USB_FlushTxFifo(hpcd->Instance, 0x10U); which would have been exactly what I need, but when I look at the code in USB_FlushTxFifo() in stm32l4xx_ll_usb.c it doesn't do anything, but it has a message: NOTE : - This function is not required by USB Device FS peripheral, it is used only by USB OTG FS peripheral. - This function is added to ensure compatibility across platforms.
How do we cancel a pending transmission?