Skip to main content
Visitor II
March 12, 2024
Question

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

  • March 12, 2024
  • 1 reply
  • 988 views

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

 

 

 

 

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    March 12, 2024

    Hello @1350280419 

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

    Visitor II
    March 12, 2024

    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.