2021-06-10 03:16 PM
Hello all,
I am trying to set up usb virtual port to transmit data to pc.
MCU:STM32F405RG
STM32CubeIDE: usb device fs checked, VBUS unchecked
usb device: communication device class
heap size: 0x200
stack size :0x400
When i plug usb cable to pc directly (not through the debugger), it can not be recognized. In device manager, it shows Device Descriptor Request Failed. ST VCP driver(the latest stsw-link009) installed. and the firmware on the board was updated. The ioc file is attached. The value of hpcd after initialization is also attached. I went through the sw and it looks ok. I have spent almost a whole week debugging it. Please help!
Wendy
2021-06-11 07:19 AM
Hello @WTang.2 ,
Please make sure to follow this article USB device not recognized, with the solution is to either increase the heap size, or configure the USB library to use static allocation.
Please keep me informed about your update on this issue.
When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.
Imen
2021-06-11 08:57 AM
@WTang.2
First of all, check if the connections are OK. Then, check if you have placed the 22 ohm resistors in between. Next, check if your PC can identify the UC USB in bootloader mode. Finally, check the heap size of the application.
2021-06-12 04:32 PM
Hello
Sysclck seems too low . (directly from HSI?)
Increased to maximum and recheck it.
2021-06-22 05:30 PM
I'm not sure if it helps, but I had to implement the fix documented here in usbd_cdc.c : https://community.st.com/s/question/0D50X00009XkfnjSAB/problem-solved-with-usb-cdc
I'm using cubemx 6.1.2 and had to insert the following memset at approx line 461 just after the malloc in function USBD_CDC_Init( )
hcdc = USBD_malloc(sizeof(USBD_CDC_HandleTypeDef));
if (hcdc != NULL) memset(hcdc,0,sizeof(USBD_CDC_HandleTypeDef)); // THIS LINE WAS ADDED TO FIX BUG WHEN PC WOULDN'T ALWAYS CONNECT
2021-07-01 04:35 AM
Hi @WTang.2 ,
Do you have still this problem to solve?
When your question is answered, please close this topic by choosing Select as Best. This will help other community members finding answers to their issues ;)
Imen