cancel
Showing results for 
Search instead for 
Did you mean: 

stm32 usb cdc Device Descriptor Request Failed

txmsszd
Associate II
Posted on June 16, 2016 at 19:19

hi,I am tring to use usb virtual port to transmit data to pc.

MCU:STM32F373 100pins

cubemx: usb device fs checked

usb:communication device class

PC: windows 10

heap size: 0x200

stack size :0x400

when i plug usb cable to pc,it can not be recognised.In device manager,it shows Device Descriptor Request Failed. ST VCP driver installed. BTW, when I debug it, it could goes into USB_LP_IRQHandler after MX_USB_DEVICE_Init() excuted.

thanks.
44 REPLIES 44
Jerry Hancock
Associate II
Posted on December 14, 2016 at 16:36

Bhatia,

I thought that table listed what was provided in the libraries, didn't think it would apply to the 746 cubemx generated code.  What could possibly be preventing it from working?  I've tried with/without vbus sensing, etc.

I am going to download the diagrams for both boards (eval and 746) to see what the heck the electrical difference could be.  And yes, i've tried it in HS, HS in FS and FS only modes on all the connectors.  It looks like an interrupt isn't being generated at all for any USB CDC functions.   I put break points all over and they never get hit for CDC but HID they do. I don't understand how that can happen.  It's just firmware that we have almost complete control over, how can they prevent a software protocol stack from working?

Alternatively as I mentioned, I can download the 1GB WinUSB kit and code it in HID bulk mode I guess when I get back to my office.   I need this thing to transfer as fast as possible anyway. Traveling this week and the 1GB download would take forever at a hotel.

And thanks for the help, by the way.

Jerry

Posted on December 14, 2016 at 18:30

No faults or over current.  Somehow, I think, the interrupts aren't being generated.  Also, note dual core CDC is supported.  There is an example for it that I am going to test but I think it works in host mode.

Jerry Hancock
Associate II
Posted on December 18, 2016 at 03:56

I bought two more boards, 32F746 and 32F767 Nucleo boards.  Both worked without a hitch in USB OTG DEVICE  CDC modes.  Neither were listed as being supported on the table above.  So right now, the only board I can't get working is the 746 Disco, the board I want to work!  I spent a bunch more hours on it this week and got it generating interrupts when I pulled the cable from the connector.  I finally gave up and just recoded it to use the Stlink exposed uart, which works fine.  I don't know how fast it will go though, but for now it works.

Strange.

Jerry

Henrik Sandaker Palm
Associate II
Posted on January 05, 2017 at 11:29

Jerry,

Thanks for having the patience to both experiment and write about this. It's a very interesting read, especially since information on this particular subject is scarce.

I'm struggling with CDC VCP on STM32F042, which has crystal-less USB, getting the 'device descriptor request failed' error in Windows device manager. I won't ramble about it in your post but when I find out what's wrong I will also post here to help summarize CDC-errors and who knows, it might apply to F7 mcus too.

es131245
Associate II
Posted on March 16, 2017 at 18:31

If you change variable name from hpcd to hpcd_USB_FS you solve problem with stucking in USB_LP_IRQHandler function but USBstill not working

Wojciech Dera
Associate
Posted on March 27, 2017 at 16:22

I FOUND SOLUTION PEOPLE!!!!

USB HS IS WORKING AND SENDING VIA USB MESSAGES TO REALTERM

I spend all weekend on that but finally

:)

First:

You need to have working VP Drivers froms ST

Second:

1. Create new project in SMTCube. New Project>Board Selector>STM32F46-Disco

2. In Pinout section: RCC>HSE> Crystal/Ceramic Resonator

3. USB_OTG_HS >External Phy > Device Only

4. Clock Configuration Section: HCLK to 216 MHz

5.1 Configuration section: MiddleWares> USB_DEVICE> Class For HS IP> Communication Device Class (Virtual Port Com)

5.2 Open USB_HS Settings in Connectivity and change speed to: Device Full Speed 12MBit/s

6. Generate Project (for me to MDK-ARM V5 Keil)

7. Open Project and try to Build for first time

8. If ok, try to Load to the STM32f7 disco board.

(connect USB HS from board to PC. It should be workind. You should hear the connecting Windows sound.

9. Open Windows Device Menager in COM and LPT Section

10. There should be new STMicroelectronics Virtual Com Port (COMx) with '!' mark. That mean err code 10.

RESET STM Board.

Then:

11. Open main.c file

12. Open usbd_cdc.h file (or search for): change 

CDC_DATA_HS_MAX_PACKET_SIZE

to 64

13. 

Open usbd_def.h file (or search for): change 

USB_HS_MAX_PACKET_SIZE to 64

14. 

Open usbd_cdc_if

.c file (or search for): 

APP_RX_DATA_SIZE to 64

APP_TX_DATA_SIZE to 64

15. RESET STM32f7 Board. You should hear Windows connecting Sound and then in Windows Device menager should be new workind 

STMicroelectronics Virtual Com Port (COMx)

Then Try send something to RealTerm:

16. In main.c add 

#include 'usbd_cdc_if.h' // Plik bedacy interfejsem uzytkownika do kontrolera USB

17. Add some variables

/* Private variables ---------------------------------------------------------*/

uint8_t DataToSend[40]; // Tablica zawierajaca dane do wyslania

uint32_t MessageCounter = 0; // Licznik wyslanych wiadomosci

uint8_t MessageLength = 0; // Zawiera dlugosc wysylanej wiadomosci

18. in main loop add:

HAL_Delay(1000); // important

MessageLength = sprintf((char*)DataToSend, '%s%s', 'WOJTEK IS THE BEST','\r');

CDC_Transmit_HS(DataToSend, MessageLength);

HAL_Delay(1000);

19. Compile and send to STM32f7 Board. Reset Board

20. ITS WORKING!!!!

:)

I hope it will work with your boards! 

If this work click thump up

:)

Pozdrawiam

Wojciech PL

Posted on March 28, 2017 at 13:52

First of all cube projects does work with heap 400 and right connection.

Just check if you have internal USB PHY

Wanho Noh
Associate
Posted on April 06, 2017 at 04:54

Hi,

Please try this method.

I generated source code with STM32 Cube MX. (

F/W Package Version

STM32Cube FW_F4 V1.14.0

)

Add the following from there.

usbd_cdc_if.c

USBD_CDC_LineCodingTypeDef LineCoding =

 {

        115200, /* baud rate*/

        0x00,   /* stop bits-1*/

        0x00,   /* parity - none*/

        0x08    /* nb. of bits 8*/

 };

CDC_Control_HS ()

    Case CDC_GET_LINE_CODING:

          pbuf[0] = (uint8_t)(LineCoding.bitrate);

          pbuf[1] = (uint8_t)(LineCoding.bitrate >> 8);

          pbuf[2] = (uint8_t)(LineCoding.bitrate >> 16);

          pbuf[3] = (uint8_t)(LineCoding.bitrate >> 24);

          pbuf[4] = LineCoding.format;

          pbuf[5] = LineCoding.paritytype;

          pbuf[6] = LineCoding.datatype;

and change Stack/Heap Size to 0x1500 or higher.

I hope it helps.

Bill Lewis
Associate III
Posted on April 20, 2017 at 22:18

Mine worked only after I plugged directly into the PC without a powered hub.

Correction:  It worked because I unplugged the Ethernet cable.

So there's some sort of conflict between ETH RMII and USB FS.

Update:  The problem was insufficient stack/heap space, and the order of the

initialization calls affected it.

Ole Ho
Associate II
Posted on May 06, 2017 at 16:51

Hello, got the very same problem which killed a few past days.

My uc is STM32F407VGT on the developer board 'discovery'. VCP worked properly, but HID device throwed such errors of inconnectivity: 'Device descriptor request failed' - code 43 in windows.

Resulting problem: CubeMX corrupted settings of RCC. When you use automatic tool in clock configuration settings through the dialog of choosing another clock source(when it picks HSE with PLLs instead of HSI), it sets 'input frequency' at 25 MHz while the correct value for this board is 8 MHz. I honestly don't know how the rest of the project worked (may be not very good, but no desire to compare  at all).

So double-check RCC settings, generated by Cube.

Hope it will help someone.