Author Topic: Driving the 1K5 USB pull-up resistor on D+  (Read 15066 times)

0 Members and 1 Guest are viewing this topic.

Offline iggarpeTopic starter

  • Contributor
  • Posts: 13
Driving the 1K5 USB pull-up resistor on D+
« on: February 09, 2014, 09:03:42 pm »
Hi,

I'm designing a self-powered USB device based on a STM32 microcontroller. Since it is self powered I cannot just tie the 1K5 pull-up resistor on D+ to 3V3 because that would result in more than 400mV on the D+ line when the USB cable is disconnected from the host. No big deal but would not pass the USB compliance test.

So I must sense VUSB and connect the 1K5 pull-up only when power is detected. Fine. Now, in every schematic I've checked out the 1K5 pull-up resistor is driven by a (usually PNP) transistor controlled by a GPIO pin of the microcontroller, and that's how I've done it so far just to avoid putting any thought into it. Now this design is pretty crowded and I'm really having difficulty finding space for the extra transistor and resistors, so I figured why can't I just drive the 1K5 resistor directly from one of the STM32 GPIO pins.

I've read as much as I've found regarding this particular feature of the USB bus, but nowhere I found a requirement and would result in the need for using a transistor to drive the 1K5 resistor.

Am I missing something?
 

Offline abyrvalg

  • Frequent Contributor
  • **
  • Posts: 823
  • Country: es
Re: Driving the 1K5 USB pull-up resistor on D+
« Reply #1 on: February 09, 2014, 09:31:54 pm »
There should be no problem driving it with a pin directly (since pin is driven by transistors too). Btw, some STM32 devices have builtin pullup (check reg OTG_FS_DCTL bit SDIS).
 

Offline iggarpeTopic starter

  • Contributor
  • Posts: 13
Re: Driving the 1K5 USB pull-up resistor on D+
« Reply #2 on: February 12, 2014, 02:25:22 am »
Yep. I've been testing the design and so far works nice and solid. No probs. So I keep wondering WHY on earth if this is so obvious every reference design I see out there uses a discrete transistor.

Im using an SRM32F103 part which do not have an OTG port, so no integrated resistors.
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: Driving the 1K5 USB pull-up resistor on D+
« Reply #3 on: February 12, 2014, 02:42:32 am »
The designs that you see using the PNP BJT may be running their MCUs at 5V instead of 3V3.
 

Offline iggarpeTopic starter

  • Contributor
  • Posts: 13
Re: Driving the 1K5 USB pull-up resistor on D+
« Reply #4 on: February 15, 2014, 08:40:34 pm »
That's it. The device must never pull down D+. Never, even when it's unpowered.

I was aware I should not pull down D+ when not in connected state, which can be easily accomplished by configuring the pin as an input. But when the device is powered down the parasitic resistor to VCC would pull D+ down somewhat.

Thank you. Now it's clear. I knew I was missing something pretty obvious.
 

Offline michaeliv

  • Frequent Contributor
  • **
  • Posts: 260
Re: Driving the 1K5 USB pull-up resistor on D+
« Reply #5 on: April 28, 2016, 05:48:14 pm »
That's it. The device must never pull down D+. Never, even when it's unpowered.
Because it must not pull-down in the opposite state.

I've recently been looking into making my own STM32F103 board and wanted to do the D+ pull-up-to-GPIO thing but, same as the OP, I couldn't figure out why most designs use a transistor.
The "never pull-down" reason seems somewhat valid, except that when unpowered the pin tested to be floating, with a 33M+ resistance to ground. I guess that's not guaranteed and ST might re-design the chip later to not behave like that but that's not very likely.
Also, if using a PNP transistor, if we assume that the chip could pull down through the GPIO, then wouldn't you still be pulling down through the PNP diode junction + GPIO ?
Has anything come up in the meantime  since this post was originally made to explain why the pull-up-to-GPIO is not the most pervasively used one ?
PS: The GPIO pin has a 22R resistance when outputting logic 1 which doesn't seem like an issue.
« Last Edit: April 28, 2016, 05:52:57 pm by michaeliv »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf