3
\$\begingroup\$

I am designing a USB full speed board around the STM32F103xx MCU and was wondering how to physically position the 1.5 kΩ pull-up resistor on D+. Should it be next to the MCU or close to the receptacle or what? Does it even make a difference? I have attached a snapshot of the layout below.

Layout

\$\endgroup\$
5
  • \$\begingroup\$ Is that resistor directly connected to 3.3V? You might not want that. The USB ID pin is grounded. Most likely you don't want that either. \$\endgroup\$
    – Justme
    Commented May 27, 2020 at 16:38
  • \$\begingroup\$ @Justme It is connected directly to +3V3 because the datasheet says "the USBDP (D+) pin should be pulled up with a 1.5 kΩ resistor to a 3.0-to-3.6 V voltage range." Am I missing something here? Why might I not want that? Thanks. \$\endgroup\$
    – jm567
    Commented May 27, 2020 at 17:43
  • 2
    \$\begingroup\$ The datasheet is correct about the voltage, it just does not mention that you might actually want a switchable pull-up, instead of it being always connected to 3V3. The PC requests enumeration as soon as DP is pulled up. Most likely you want to avoid problems, and let the MCU pull the DP line up with an IO pin, when the MCU is actually running firmware, initialized IO pins and peripherals, and is ready for USB communications. Otherwise, the PC may think that there is an unrecognized USB device and never tries to re-enumerate again. There are tons of F103 boards with this issue, just search. \$\endgroup\$
    – Justme
    Commented May 27, 2020 at 18:29
  • \$\begingroup\$ Thank you for the GPIO-driven pullup tip. It makes a lot more sense that way. \$\endgroup\$
    – jm567
    Commented May 28, 2020 at 1:19
  • 1
    \$\begingroup\$ aren't your D+ and D- too thin? Did you match their differential impedance to be 90 ohms? \$\endgroup\$ Commented Oct 6, 2022 at 12:14

2 Answers 2

9
\$\begingroup\$

The placement may not be that critical, but it never hurts to apply what application notes usually suggest for USB designs.

  • Since the R3&R4 are the termination resistors to match impedance, the 1k5 pull-up resistor should be on the connector side of R4, not on the MCU side.

  • USB terminating resistors R3&R4 should be close to the chip, within 200 mils, not close to the connector.

  • 1k5 pull-up should be controllable by the MCU, as it could take more time to boot the STM32 firmware than the host tolerates for enumeration

  • Stubs should be avoided. The trace from the differential pair to R5 basically forms a stub, even if it is very small. The resistor pad could be just in-line with the trace without stub. Smaller size resistors would have smaller pads. The stub length is well within recommendations.

  • It is not suggested to connect USB shield directly to ground plane and shorting to USB GND, but via capacitor.

  • VBUS and/or GND are sometimes filtered with ferrite beads.

  • Don't put more than the allowed 10uF capacitance on VBUS

  • Don't draw more than the allowed 100mA until MCU has completed enumeration to request more current from host, and the host has allowed it

  • USB DP/DN is a differential pair whose impedance should be 90 ohms

  • Avoid traces that run in parallel near USB traces. There should be 20 mil gap to non-periodic low speed signals, or 50 mil gap to clock signals.

  • If you don't pass EMI testing, you might need to add a common-mode choke near the connector. The ESD protection should be located between connector and common-mode choke.

  • Match trace lengths to within 150 mils. Looks fine.

\$\endgroup\$
1
  • \$\begingroup\$ Wow, thanks for all these design guidelines. Immensely helpful & corrective! \$\endgroup\$
    – jm567
    Commented May 27, 2020 at 20:19
0
\$\begingroup\$

In my experience the placement is not critical, but be aware of some MCUs have an internal 1.5k pull up resistor already on the USB data line. Please double check the data sheet.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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