cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with USB device stack (VCP)

root
Associate II
Posted on October 25, 2011 at 22:23

Hello,

First I4m working on my own board, a product almost final on which I added USB. MCU is STM32F205RE and ''of course'' I used the HS USB port (using embedded PHY).

Now I'm trying to get it working and it is VERY twitchy ... first if I plug or unplug the USB cable while powered up => hard fault (did not check yet exactly why).

Then even if I start with USB cable, 90% of the time windows says the USB peripheral is unknown/did not work, and 10% of the time the driver installation starts with the right descriptor strings, fails and the device appear in the device manager with a yellow icon and error code 10 (device can't start).

My MicroB USB connector is directly connected to PB13 (VBUS), PB14 (DM) and PB15 (DP). VBUS is only for sensing and never for powering the board.

Any idea ?

Thomas.
14 REPLIES 14
root
Associate II
Posted on November 21, 2011 at 19:29

Back after ''some'' investigations ...

Read the whole USB speicification, etc, etc ... tried everything possible, no result.

At the end I tried, hopeless, to use the HSI (PLL) as the clocl source and ... WTF it works !!!!!!

I got it to enumerate, appears as HID device (using the HID demo project), etc, no problem !!!!

I'm usually using a MuRata CSTCE ceramic resonator as clock source, and never had problems, I'm using the USB 2.0 specific resonators.

How can I phyiscally check the sys clock of my MCU (I have no scilloscope at this speed)?

Using SysTick and output toggle is ok?

I REALLY don't get it ! Is the excel file to generate the clock parameters/init screwed ?

Thomas.
root
Associate II
Posted on November 21, 2011 at 19:57

No ... it still doesn't work ... more precisely it doesn't ''usually'' work.

You can plug/unplug, always not recognized, and once every about 50 tries, it works.

What really BOTHER me is that once it's recognized, communication works undefinitely (sending HID reports, etc).

It seems the problem really is related to low level enumeration.

Can somebody tell me if the 22 ohm resistors are really required???

I really had absolutely no help on this issue for now.

Thomas.
root
Associate II
Posted on November 22, 2011 at 18:52

So ... still investigating on USB mess ...

As I had no clue about the 22 ohm resistors, I bought a new USB micro-B cable and 2 resistors, soldered the resistors inside the cable and .... exactly the same thing.

But today, it's even different (a bit better ...) : if I plug the cable before powering up the MCU, it seems to work well each time.

But then device consumption is 50mA which is a lot ...

If I unplug the cable, consumption goes to a few mA (shows 0 on my lab supply), and I if I plug it back, nothing happens (still no consumption and failed enumeration).

If I start the device not plugged, it goes 50mA for a few seconds (like 2s) then 0, and no enumeration.

I didn't change the firmware from yesterday (yes, exactly the same as yesterday that didn't enumerate except once in a while, now enumerate each time if plugged before power up ...), so it's still on the HSI oscillator.

What is interesting is that I changed the main loop code to while(1) __nop() so I guess when it goes to no consumption, it's in hard fault or something, and the 50mA is when working as expected (full MCU usage, no WFI, hence a lot of mA).

And why yesterday it didn't enumerate and today it does ?

Is it going to sleep or deep sleep when not connected (and doesn't wake up as expected ?

Thomas.
hbliek2
Associate II
Posted on November 24, 2011 at 12:32

Reading your posts, it seems you're doing a lot of poking around in the dark!

I suggest you get yourself a decent scope so you can check on actual signals, price is not an excuse anymore these days.

Even more useful is an USB anaylyzer. Ideally a hardware analyzer, but these are still a bit pricey. However, using a software analyzer can provide quite some insight too; try

http://www.usblyzer.com/

 for example. They have an evaluation period of 33 days
root
Associate II
Posted on November 24, 2011 at 12:54

Hello,

In fact I'm using USBLyser for a few days, but the problem was even before the first data packet was sent.

It seemed to be linked to the powerdown feature. It was enabled even if not needed (bug in the stack), and even before anything really happened, the device was going to sleep, hence not working as expected.

I disabled all powerdown features and now it seems to work pretty much ok (can receive data in HID mode and added code to enable data sending - host to unit - which is not handled by the ST stack ...).

I think it worked better with builtin oscillator because of the additionnal delay for the HSE switch and PLL lock when using external oscillator (hence entering power down mode faster).

Anyway, now if my main loop is while(1) __nop() it works, but if I go to while(1) __WFI() it doesn't work anymore ...

I don't really want to spend that much time on nops ... my firmware is based exclusively on interrupts.

Thomas.