cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 USBD CDC-MSC Combination Device Class CDCtransmit-FS() Sending Issue

1350280419
Associate

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:

111111.jpg

 

 

 

 

2 REPLIES 2
FBL
ST Employee

Hello @1350280419 

Would you please share your project to reproduce the issue? Which L4 board are you using?

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thanks,I am developing STM32L4R7VIT6 on my circuit board.How can I deliver this whole project to you.

Now, I am using USBD_LL_Transmit() instead of CDC_Transmit_FS() to send messages,it works.

I'm not sure if there are any issues with directly using the lower sending function, but the fact is that it can work normally.