cancel
Showing results for 
Search instead for 
Did you mean: 

VCP device in FS mode only works with some USB connections

E P
Associate III
Posted on March 26, 2015 at 17:32

Hi all,

I've got an STM32F427 and am using the onboard HS USB PHY in FS mode using the CDC/VCP firmware generated by CubeMX (v4.7.0).  I've been doing a lot of configuration and testing and though slow (I'm not very good at it) I've got a 3/4 functioning USB connection with Windows (transmit to Windows is done; haven't tackled receiving yet).

I realized this morning that there's a little hitch: I've been plugging my board into a cheapo USB2 hub, and that seems to work fine.  But if I plug directly into the computer, it shows up as an unknown device (Device Descriptor Request Failed).  I also have a little USB isolator (which works with an older board I made, using an STM32F417 with the same USB pin configuration) and if that's inline, it doesn't work at all.

I assume that I'm missing some little hardware or software handshake that the cheapo hub ignores.  Possibly helpful information:

* I have the D+ pin pulled up to 3.3V (as one does in FS mode)

* When configuring the USB peripheral in CubeMX, I pointed out that it's Full Speed

* I've done the things that I've seen on this forum that generally make USB work, such as setting CDC_DATA_HS_MAX_PACKET_SIZE to 64

* The connection does work consistently if I use this particular USB hub, just not with any other connection that I've tried

* If I plug the board to the computer directly, after the computer fails to recognize the device if I plug it back in to the hub, nothing at all happens (though the program loop is still running) and I have to power cycle the chip to get USB back

* This is a custom board, not a devkit

... any hints on what I might be missing here?

Thanks!

#usb-vcp-stm32-cubemx
4 REPLIES 4
E P
Associate III
Posted on March 28, 2015 at 21:55

Wanted to give this one a little bump and see if anyone had any thoughts ... I've got a USB device (CDC - virtual comm port) that works when plugged into my computer but only if I plug in through a hub, otherwise it fails to enumerate.  Tried several hubs, all non-powered, and see the same behavior.  Tried plugging into a laptop and it failed to enumerate even with the hubs.  Does this ring any bells for anyone?  It's very weird.

Thanks!
Henrik Sandaker Palm
Associate II
Posted on January 07, 2017 at 18:47

Hi

Potter.Elliott

,

Did you ever solve this? I have a STM32F042G6 on a custom board that gives the same error message in device manager. I have not tried it in a cheap USB hub yet, hehe.

Posted on January 08, 2017 at 19:11

Hmm, a lot happened in the last couple of years. The USB interface in general seems to be a bit touchy.  Things that I've done at various points that seem to have helped:

* set up a USBD_CDC_LineCodingTypeDef with some serial port parameters and point to it in CDC_Control_HS (under case CDC_GET_LINE_CODING)

* If the your main program loop rate is over 30kHz or so, try slowing down the CDC_Transmit_HS and CDC_Receive_HS functions, e.g. by only running the function every 5th time around the main program loop or so.  This seems like it shouldn't be necessary but in my experience if you call those functions too quickly they get confused

* Double check your hardware to make sure lines are pulled the proper way.  I'm using an ADuM4160 USB isolator and found that it's worth staging that chip's power on so that the STM32 is ready to talk to it before it gets power on the isolated side.

* Scream and curse a lot.  I don't know how helpful it's been, but it's something I do a lot 🙂

I'll try to think about other things I've done.  USB does seem to work pretty reliably for me these days but it's been a long road.

Posted on January 08, 2017 at 19:38

Thanks for the tips! I did curse a lot and decided to check if I had wired D+ and D- correct. I hadn't, I had them switched. 

Haven't managed to break it yet