Skip to main content
txmsszd
Associate II
June 16, 2016
Question

stm32 usb cdc Device Descriptor Request Failed

  • June 16, 2016
  • 33 replies
  • 11046 views
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.
    This topic has been closed for replies.

    33 replies

    slimen
    Visitor II
    June 17, 2016
    Posted on June 17, 2016 at 11:03

    Hi,

    Could you please precise which versions of CubeMx and firmware are you using ?

    Regards

    txmsszd
    txmsszdAuthor
    Associate II
    June 18, 2016
    Posted on June 18, 2016 at 04:20

    Hi,

    CubeMx Version: 4.15.1,and the firmware is downloaded by Cube itself,should be the latest.

    txmsszd
    txmsszdAuthor
    Associate II
    June 18, 2016
    Posted on June 18, 2016 at 04:36

    Thanks

    I have noticed this discussion before my post,I checked the points the topic referred.But it help less to my problem

    txmsszd
    txmsszdAuthor
    Associate II
    June 18, 2016
    Posted on June 18, 2016 at 14:54

    update..

    I found that it frequently goes into HAL_PCD_IRQHandler,typed as ESOF,which means Expected Start Of Frame.And when I try to send some data via CDC_Transmit_FS function,the hcdc->TxState is always busy state.

    I have tried sevral ways to work it out,but problem remains.

    Need help.

    txmsszd
    txmsszdAuthor
    Associate II
    June 18, 2016
    Posted on June 18, 2016 at 16:52

    Some inforamtion about configuration foe USB CDC.Generated by CUBEMX

    Basic Parameters:

    USBD_MAX_NUM_INTERFACES (Maximum number of supported interfaces) 1

    USBD_MAX_NUM_CONFIGURATION (Maximum number of supported configuration) 1

    USBD_MAX_STR_DESC_SIZ (Maximum size for the string descriptors) 512

    USBD_SUPPORT_USER_STRING (Enable user string descriptor) Disabled

    USBD_SELF_POWERED (Enabled self power) Enabled

    USBD_DEBUG_LEVEL (USBD Debug Level) 0: No debug message

    Class Parameters:

    USBD_CDC_INTERVAL (Number of micro-frames interval) 1000

    Device Descriptor:

    VID (Vendor IDentifier) 1155

    LANGID_STRING (Language Identifier) English(United States)

    MANUFACTURER_STRING (Manufacturer Identifier) STMicroelectronics

    Device Descriptor FS:

    PID (Product IDentifier) 22336

    PRODUCT_STRING (Product Identifier) STM32 Virtual ComPort

    SERIALNUMBER_STRING (Serial number) 00000000001A

    CONFIGURATION_STRING (Configuration Identifier) CDC Config

    INTERFACE_STRING (Interface Identifier) CDC Interfac

    slimen
    Visitor II
    June 21, 2016
    Posted on June 21, 2016 at 10:40

    Hi,

    Are you using CDC example from Cube package ?

    Could you please give me the DeviceClass and DeviceSubClass values ?

    Regards

    txmsszd
    txmsszdAuthor
    Associate II
    June 23, 2016
    Posted on June 23, 2016 at 15:53

    Hi,these code was generated by CUBEMX automaticly.

    I am new to USB CDC,I  find no DeviceSubClass item in my project.What I found is listed below,I don't know if it is the DeviceClass you mentioned.

    Thansk.

    __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =

      {

        0x12,                       /*bLength */

        USB_DESC_TYPE_DEVICE,       /*bDescriptorType*/

        0x00,                       /* bcdUSB */  

        0x02,

        0x02,                        /*bDeviceClass*/

        0x02,                       /*bDeviceSubClass*/

        0x00,                       /*bDeviceProtocol*/

        USB_MAX_EP0_SIZE,          /*bMaxPacketSize*/

        LOBYTE(USBD_VID),           /*idVendor*/

        HIBYTE(USBD_VID),           /*idVendor*/

        LOBYTE(USBD_PID_FS),           /*idVendor*/

        HIBYTE(USBD_PID_FS),           /*idVendor*/

        0x00,                       /*bcdDevice rel. 2.00*/

        0x02,

        USBD_IDX_MFC_STR,           /*Index of manufacturer  string*/

        USBD_IDX_PRODUCT_STR,       /*Index of product string*/

        USBD_IDX_SERIAL_STR,        /*Index of serial number string*/

        USBD_MAX_NUM_CONFIGURATION  /*bNumConfigurations*/

      } ; 

    slimen
    Visitor II
    June 24, 2016
    Posted on June 24, 2016 at 12:42

    Hi, 

    May be you should try with compatibility mode settings for windows 7/8 .

    Regards
    pieter239955_st
    Associate
    October 20, 2016
    Posted on October 20, 2016 at 10:25

    Did you manage to fix it, i have the same problem and i can't figure it out. 

    ricardomadera
    Associate II
    December 11, 2016
    Posted on December 11, 2016 at 00:05

    I fixed this by changing my usbd_conf.c file to disable vbus sensing

      hpcd_USB_OTG_FS.Init.vbus_sensing_enable = DISABLE;

    Jerry Hancock
    Associate III
    December 11, 2016
    Posted on December 11, 2016 at 01:22

    I've tried this as well as 100 other tips to no avail on several boards.  I have my STM32F407 disco and STM32F469 working but can't get my STM32F429 or the STM32F746 working.  I have spent hours and hours on this problem.  For all the boars that are out there and the percentage of boards that need to talk to a PC thru USB, your would think there would be 1) better examples; 2) Examples that work; 3) consistency across examples that work.  For instance, I can take the same Cube parameters and setting on the F407 and F469 and they work, and when I say work, I mean they plug into the PC USB and get enumerated as a CDC VCP port.  If you are lucky, you might get the invalid device descriptor error.  Generally, the biggest problem with that error is the clock which has to be set to 8Mhz with HSE_VALUE=8000000 and PLL_M to 8 , PLL_N to 336 and PLL_Q to 7.  This gives the correct clock for the FS devices but doesn't work even with the external PHY devices for some reason.  I've found where the external PHY clock doesn't always get turned on, but this doesn't fix my problem. Why do some boards get enumerated when VBUS is disabled where others do not?   Why do clock settings fix some boards? This is borderline crazy and I have been working with just about every computer known to man since 1976 and this one kicks my butt.  The other issue I have found is that if I use the GCC CDT compiler and startup code, my F429 will enumerate but the same code on the openstm  compiler won't work.  Something is very subtly wrong here with alignment, etc. that I can't find.  

    So if your board won't enumerate, here's the hints all in one place:

    1) Use HSE_VALUE = 8000000 or 25000000 for the F746 which has a 25Mhz crystal with either PLL_M = 8 for the 8Mhz and PLL_M=25 for the other.  Use PLL_Q = 7 and PLL_N = 336.  This should give you a 48Mhz USB clock.

    2) Make sure you stack is and heap are like 0x2000 though this never fixed anything for me.

    r

    3) Remember that in order to attach to a PC you need to be in device mode otherwise the STM board is expecting devices to attach to it.  I think you can have the board in both modes but never got it working.  This point I'm not really sure of but it makes sense to me.  It won't enumerate if it is waiting for devices as a Host.

    4) Check to ensure you are using the correct mode for the USB connector.  Some are FS and some are HS and some are HS in FS mode.  

    5) Some boards use an external PHY which means the clocking shouldn't matter.  I stick with the clock settings in (1) above until it works.

    6) Make sure your PC drivers are installed.  If you question the drivers, use one of Tilen's precompiled codes on stm32f4-discovery.com site.  By the way, he has a ton of knowledge and has shared it all.

    7) Make sure your cable is good.  I was traveling and didn't have a spare and spent a week in a hotel fighting a cable problem I didn't know I had until I got home.

    8) I've had the best luck with HAL.

    9) Some people have had good luck turning off VBUS sensing.

    10) One person in particular wrote about not trying to send prior to having initialization done.  But if you think about it, his board must have been enumerated by the PC already to get to that point.

    Lastly, before starting a project with any of these boards, make sure the board exposes the features you need.  I spent a lot of time on a F429 before finding out that one of the DAC lines is used for the display.

    So I am about 50% there.  Two of the 4 boards work as enumerated CDC VCP devices.  One of the remaining boards works fine as an HID.  I can't get the F7 board to connect for nothing.

    Jerry