I face a problem with making custom PCB with STM32F103C8T6 FS CDC but whole story looked like this.

  1. I've made small test app using CubeMX and IAR on cheap PC from china with same MCU - in terminal on windows I was able to receive data. BTW I used 8MHz XTAL, 1k5 pull up to 3.3 on DP line no serial resistors.
  2. On custom board same code (which I can download to MCU without any problem) and I'm getting Unknown Device in HW Manager on win7.

Same MCU same application and clocks and two different behaviors - what I'm doing wrong?

  • 1
    \$\begingroup\$ Show us your Schematic & PCB layout. \$\endgroup\$ – brhans Feb 13 '18 at 22:12
  • \$\begingroup\$ I bet - probably the cheap board forces the enumeration which you do not and you are not ready to send the descriptors. It is a very common problem. \$\endgroup\$ – P__J__ Feb 13 '18 at 23:34
  • \$\begingroup\$ How both devices are powered? Via USB, or else? \$\endgroup\$ – Ale..chenski Feb 13 '18 at 23:58
  • \$\begingroup\$ Hello, thanks for attention. I will try to post schematics and PCB layout in the evening. Only difference I can find so far is that on China board there is a Micro USB connector with ID pin solder to GND and on my board I use USB_B without that pin and I'm powering board from USB. Can that change cause this effect? \$\endgroup\$ – kaziel Feb 14 '18 at 8:06
  • 1
    \$\begingroup\$ Common sources for this error: USB lines D+ and D- swapped, MCU clock or pin configuration incorrect. The error code 43 basically states that there is no USB communication besides the pullup on a data line. \$\endgroup\$ – Turbo J Feb 14 '18 at 11:15

One of typical mistakes in bus-powered USB devices is mismanagement of pull-up resistor. Your description says: " 1.5k pullup to 3.3", which means that the USB connect event (DP pullup) will be seen immediately upon plug in. So the host will start enumeration process in 100ms. Yet your MCU will take some time to boot, so it won't be ready with proper responses, and host inquiries will fail. By the time your MCU is ready to communicate, the host will declare the port as dead, and display error. When a demo board gets powered externally before connecting to USB host and is already up and running, the connection is fine.

To avoid this mishap, all reputable STM demo boards have the pull-up resistor controlled from GPIO pin, typically PB2 or PD2. Then the pull-up is set by code only when the USB stack is ready to respond.

The connection of ID pin on Micro-B receptacle on the USB device side is inconsequential, it is meant for USB OTG host, not for a plain device.

| improve this answer | |
  • \$\begingroup\$ Thanks for answer - I really appreciate it. Now I will have some clues to finally get this working. One more comment from my side - on a board on which USB CDC is working (same MCU) usb is done in same fashion only PU no HW PU control same code runs without problems (same clock). Anyway I will try few options and inform about outcome. \$\endgroup\$ – kaziel Feb 15 '18 at 13:01
  • \$\begingroup\$ @kaziel Did you get your STM32 USB running? \$\endgroup\$ – VladBlanshey Jul 30 '18 at 13:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.