cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 USB CDC problem

mh2
Associate III
Posted on May 30, 2017 at 10:07

hi everybody

I'm using stm32l151 and I want to use usb peripheral in cdc mode. I used stm32 cubeMx to generate the project.

when I connect the boar to PC, I can see the VCP in device manager.however I can't sen any data to PC. 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.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
mh2
Associate III
Posted on May 31, 2017 at 08:37

I found the problem. It was my new terminal monitor software I used to monitor the serial port. it doesn't monitor the serial port unless the port to be read by a software. It just monitor when the port was opened by another software.

Thanks

View solution in original post

3 REPLIES 3
Imen.D
ST Employee
Posted on May 30, 2017 at 12:51

Hi

Hosseinzadeh.Mohamma

,

Are you using CDC example from CubeL1 package ?

You can start with a working 'CDC_Standalone' example available under STM32CubeL1 v1.7.0 and get inspired from the functions used todevelop your application.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
mh2
Associate III
Posted on May 30, 2017 at 13:03

Hi Imen

Thanks for your attention.

I don't use example project. I created a project using STM32CubeMX and then, I just used the function CDC_Transmit_FS() to send the word 'hello' to the PC, as in the example project of

STM32CubeL1 v1.6.0

. I checked in debug mode, and I understood that the first time

C

DC_Transmit_FS is called it does not return USBD_BUSY, but after that, it return USBD_BUSY.

I think that the transmission of the data, didn't complete.

mh2
Associate III
Posted on May 31, 2017 at 08:37

I found the problem. It was my new terminal monitor software I used to monitor the serial port. it doesn't monitor the serial port unless the port to be read by a software. It just monitor when the port was opened by another software.

Thanks