STM32L4 USBD CDC-MSC Combination Device Class CDCtransmit-FS() Sending Issue
The STM32USB library calls the function CDC TransmitFS, which can only be sent in the CDC ReceiveFS loop and data in the main. The cdc ->TxState flag has always been 1, so only the USBD_cDC SetTxBuffer was successfully called. However, the USBD_cDC TransmitPacket, USBD_cDC DataIn, and subsequent CDC TransmitCplt cannot be called.
There are two solutions to watching the forum: 1. Place it in an interrupt with the same priority as USB and call CDC TransmitFS to send it. Only the call succeeds 2. 'Call this function EP0_RxReady before sending. But both methods can cause the program to freeze.
Both CDC_Receive_FS and CDC_Transmit_FS are implemented in usbd_cdc_if. c. Calling CDC_Receive_FS in CDC_Receive_FS can send and receive messages in a normal loopback.
The following is the implementation of two functions:

