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 11, 2016 at 19:38

Also don't buy these boards on ebay as they are way over priced.  Cheapest is Mouser in the US.

Jerry Hancock
Associate II
Posted on December 11, 2016 at 20:11

For the STM32F429 board, as I found this morning, the cubemx settings that work are as follows:

1) clear all pinouts

2) RCC - select crystal/ceramic resonator

3) select usb, HS, internal FS Phy, device only, to set HS in FS mode

4) In Middlewares, select USB_device , class for HS IP, Communications device Class

In Clock, and I don't know if this matters, set the cystal to 8Mhz, PLL_M to 8, N to 336, Q to 7 with HCLK 168 and this should set the 48Mhz clock coming off Q to 48.  Since we are using the FS Phy, this shouldn't matter but play with it on your own.

Generate code, with stack 0x4000 and heap 0x2000 compile with openstm and I get an enumerated device.  Could have sworn I did this before about 10,000 times and it didn't work.  Try trimming stack and heap down after it works.  Try bumping the clock up to 180Mhz after it works since the external Phy should have its own clock but I haven't checked the schematic.

Or use the tried and try DLP devices that work every time!

Now if only I could get the F7 working.

Jerry

Posted on December 11, 2016 at 19:34

The 32F429 discovery as listed above works in FS in HS mode using Tilen's code from stm32f4-discovery.net.  It doesn't work using the cubemx generated hal code.

Jerry Hancock
Associate II
Posted on December 12, 2016 at 00:10

Just to be complete, this morning I made three projects.  HS, HS in FS, FS.  In each I set the heap at 0x2000 and stack 0x4000.   I used clock at 25MHz (remember the crystal on the F7 board is 25Mhz) with M=25, N=336 and Q=7.  This gave me the proper 48Mhz clock. None of the projects caused any reaction on the attached PC. 

I am going back to the schematics to see what is going on since in HS mode it should be enabling the external Phy.  The funny thing is that in HID mode it works so I don't think there is an electrical problem. I've been trying to avoid getting the logic decoder and scopes out.  I don't have a USB analyzer (yet).

I would like to see a sample project from ST that worked with this board.  CDC VCP in device mode.

Thanks.

Jerry

Posted on December 12, 2016 at 00:33

Jerry - have you seen this post ?

https://github.com/pellepl/verisure1512/tree/master/ext-libs/STM32Cube_FW_F7_V1.2.0/Projects/STM32756G_EVAL/Applications/USB_Device/CDC_Standalone

 

- This application runs on STM32F756xx/STM32F746xx devices.

  - This application has been tested with STMicroelectronics STM327x6G-EVAL RevB     evaluation boards and can be easily tailored to any other supported device      and development board.

/**

* @brief System Clock Configuration

* The system Clock is configured as follow :

* System Clock source = PLL (HSE)

* SYSCLK(Hz) = 216000000

* HCLK(Hz) = 216000000

* AHB Prescaler = 1

* APB1 Prescaler = 4

* APB2 Prescaler = 2

* HSE Frequency(Hz) = 25000000

* PLL_M = 25

* PLL_N = 432

* PLL_P = 2

* PLLSAI_N = 384

* PLLSAI_P = 8

* VDD(V) = 3.3

* Main regulator output voltage = Scale1 mode

* Flash Latency(WS) = 7

* @param None

* @retval None

*/

Would you have the same target evaluation board for testing ?

Jerry Hancock
Associate II
Posted on December 12, 2016 at 01:48

I don't have the eval board for testing.  I have the 746 disco.  I think this is the same code that distributes with the STM7 firmware.  I remember looking at it and wondering why there wasn't an equivalent in the 746 disco library.  I'm looking at it now and will post if it works.  I remember trying to compile that code and realizing that the board support firmware was different or something.

I found a note saying your should run the board from external 5v if you are using OTG.  I just went thru the trouble to confirm this didn't help.

Also, the clock settings above should work because in HS as HS on the 746 disco, it uses the microchip USB PHY so the clock shouldn't matter.  I put my scope on the PHY clock, it is 24Mhz as it should be and the NRESET, I assume is not_reset, is high, which would enable it.  It's interesting that they have the flash latency up at 7.  I'll give that a shot but I am at 5 with a slower clock.

Thank you, everyone, for the help.

Jerry

Jerry Hancock
Associate II
Posted on December 12, 2016 at 20:22

I am still futzing with this problem on the F7.  I've traced them (working/non-working) side by side.  The F7 never goes into the OTG_FS_IRQHandler routine that I can see. I put a breakpoint on it, if that is possible.  I had one interrupt that could have been spurious but otherwise nothing.  I see there is a 'weak' symbol override created by cube, I tried taking that out to see if it made a dif, didn't, so I am still stuck.  

I'm going back to make sure the interrupts stay enabled.  

Jerry Hancock
Associate II
Posted on December 14, 2016 at 07:14

I think I am out of ideas.  I've been staring at the HID code that works and the CDC code that doesn't and other than the class, I can't find any difference.  I have since found WinUSB hitch would allow me to use this board in HID mode.  I would have to change my communications routines, no big deal, but it should work.  I have the HID code working and it numerate correctly.

i can't see the board entering any interrupt routines in the debugger in CDC mode.  Tomorrow I am going to see if I can get it to stop in HID mode in an interrupt.

I ordered two F7 nucleo boards today to see if they share the same problem.

any other ideas?  Is there anyone from ST on the board that can try creating a device CDC on the 746 discovery with cubeF7?  I realize this project isn't that large, maybe a 1000 chips, but it is big for me!

thanks

Mon2
Senior III
Posted on December 14, 2016 at 11:41

Oh oh.

According to AN4731 STM32CubeF7 examples document - the CDC examples are not compatible with the STM32F7 DISCO boards. See Table 1. On this note, the HID examples ARE compatible with the STM32F7 DISCO boards.

Your pending STM32F7 Nucleo boards are also not marked as compatible with the CubeMx generated code for USB CDC but HID examples will work.

0690X00000605rtQAA.png
Posted on December 14, 2016 at 11:12

 ,

 ,

Hi Jerry. You have more patience than I.

1) Have you contacted ST using the Technical support ticket system on this topic ? We found them to be quite responsive.

2) To view your case and to expand our knowledge, ordered the STM32F746G-DISCO board from Mouser. This kit should arrive today. We have the Beagle 5000 V2 Ultimate (baby cakes !!) tool and will have happy to place under test using the HID and CDC code generated by the CubeMx tool. No promises on a resolution but can at least log the traffic for these 2 projects and post later today or tomorrow. Today we must first confirm if the USB ROM DFU bootloader is operational on the STM32F070F6P6 to move forward. Then can log these projects.

To confirm, HID works using CN13 on the STM32F746G-DISCO but fails if using CDC code - both auto-generated by the latest CubeMx tool ?

What is the wiring of the USB cable from CN13 to your PC ?

Since the CDC device will not be a host but a device, you will want to remove the Vbus connection for the USB cable to the PC. This is so the evalkit does not send +5 volts to the PC. CN13 is an OTG port so it is intended to act as a host and respectively, power downstream USB widgets. Suppose if you are 100% sure that the load switch @ U16 remains off, you will be also fine. Check the status of pin 4 ( ♯ ENABLE) on U16. This pin 4 should remain HIGH for HID and CDC examples else can be an issue.

Does LD6 turn on (over current) for any of these examples ?

====

Edit:

Or are you using CN12 which is mated with the Microchip USB 2.0 PHY (U15) ?

Same comments apply for the Vbus on CN12. HID works on this CN12 connector but fails with CDC project ?

Review the ENABLE pin 4 on U17 (Vbus load switch is Active High) which should remain LOW to keep this part disabled. Does LD3 turn on to denote a FAULT condition ?