-1

I'm using stm32l151 and I want to use usb peripheral in cdc mode. I used stm32 cubeMx to generate the project. however the function CDC_Transmit_FS() always return USBD_BUSY. can anyone help me?

Here is my code:

while (1)
{
    CDC_Transmit_FS(Buffer, 6);
    HAL_Delay(2000); 
}

I only added the above code to the project created by STM32cubeMX but it didn't work.

Bence Kaulics
  • 7,066
  • 7
  • 33
  • 63
Mohammad
  • 79
  • 1
  • 2
  • 3

2 Answers2

0
  1. STM library is buggy and it stalls when you for example try to send many larger packets of data.
  2. There is a problem with the windows drivers and there are quite long delays between packets. So 12MB is quite difficult to archive - using CubeMx I could only have about 3-4Mb (12MB when packet is sent).
  3. Another problem I had - I needed to send some data to the device bofore I could transmit next packet (max 8kB in my case), otherwise it stalled randomly.
0___________
  • 60,014
  • 4
  • 34
  • 74
0

Fortunately, the problem is solved and I can receive data in the PC from the STM32. There was a problem in my terminal software. I used serial port manitor to monitor the received data from the serial port, however this serial monitor software do not open the serial port by itself and if any other software opens the serial port and receives the data, it monitors data receptions. I didn't know that. Thanks

Mohammad
  • 79
  • 1
  • 2
  • 3