Author Topic: How important are the two 5.1k resistors on USB-C?  (Read 4127 times)

0 Members and 1 Guest are viewing this topic.

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 16388
  • Country: fr
Re: How important are the two 5.1k resistors on USB-C?
« Reply #25 on: April 11, 2025, 04:31:32 pm »
There are way more chinese USB-PD controllers available these days than western counterparts. They absolutely don't need any of the latter.

 

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9390
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: How important are the two 5.1k resistors on USB-C?
« Reply #26 on: April 12, 2025, 03:25:13 am »
I wonder if there's a simple way to detect that the USB3 pins are connected to a host without implementing an actual USB3 controller, maybe something like some RF diodes to rectify the signal and switch on a transistor? With USB A and B, it can be done by checking if the USB 3 ground is actually connected to ground, but that doesn't work for USB-C.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 4111
  • Country: us
Re: How important are the two 5.1k resistors on USB-C?
« Reply #27 on: April 12, 2025, 04:57:32 am »
I wonder if there's a simple way to detect that the USB3 pins are connected to a host without implementing an actual USB3 controller, maybe something like some RF diodes to rectify the signal and switch on a transistor?

Why do you want to do that?
 

Offline peter-hTopic starter

  • Super Contributor
  • ***
  • Posts: 4639
  • Country: gb
  • Doing electronics since the 1960s...
Re: How important are the two 5.1k resistors on USB-C?
« Reply #28 on: April 12, 2025, 07:22:20 am »
There is a big political risk with China.

Re Linear Technology, nobody with any sense uses/used their overpriced stuff unless cost really doesn't matter :)
« Last Edit: April 12, 2025, 07:25:54 am by peter-h »
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Offline 5U4GB

  • Frequent Contributor
  • **
  • Posts: 803
  • Country: au
Re: How important are the two 5.1k resistors on USB-C?
« Reply #29 on: April 12, 2025, 11:03:56 am »
I wonder if there's a simple way to detect that the USB3 pins are connected to a host without implementing an actual USB3 controller, maybe something like some RF diodes to rectify the signal and switch on a transistor?

Why do you want to do that?

And as a followup question, asked because I've never worked with USB-C at this level, if there are cheap Chinese controllers available wouldn't it be easier/cheaper to just drop one of those in rather than investing time and money into a bodge that sort of works some of the time?  Hacks that pretend to do it right sound even more difficult to diagnose when things go wrong than implementations that just do it wrong.
 

Offline peter-hTopic starter

  • Super Contributor
  • ***
  • Posts: 4639
  • Country: gb
  • Doing electronics since the 1960s...
Re: How important are the two 5.1k resistors on USB-C?
« Reply #30 on: April 12, 2025, 09:02:58 pm »
I may be misunderstanding you, but ISTM that if you just want to get power (under 500mA) from a USB-C device (charger, or a computer) while talking to it via USB FS, the 2x 5.1k is actually all that is needed.

If you want to get more out of USB-C e.g. the high power options, that's very different. The complexity is similar to POE, which I also looked at recently, actually for a similar product.
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Offline krho

  • Regular Contributor
  • *
  • Posts: 225
  • Country: si
Re: How important are the two 5.1k resistors on USB-C?
« Reply #31 on: April 14, 2025, 05:23:00 am »
A lot of newer STM32 have the PD controller embedded in them. Otherwise you can buy an external one. They are pretty cheap. the Microchip newest ones are 1€ in 1QTY
 

Offline peter-hTopic starter

  • Super Contributor
  • ***
  • Posts: 4639
  • Country: gb
  • Doing electronics since the 1960s...
Re: How important are the two 5.1k resistors on USB-C?
« Reply #32 on: April 14, 2025, 06:02:19 am »
Is there any scenario where you would need a power controller if drawing < 500mA and a USB FS/HS client?

I looked up the Microchip PD controllers. They seem to do the higher power stuff.
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 16388
  • Country: fr
Re: How important are the two 5.1k resistors on USB-C?
« Reply #33 on: April 14, 2025, 01:23:43 pm »
Is there any scenario where you would need a power controller if drawing < 500mA and a USB FS/HS client?

No.

As I mentioned earlier though, you can draw up to 1.5A or 3A (if the host allows) without a PD controller either, by monitoring the CC1 and CC2 pin voltage with an ADC (still pulling them down to 5k1). The measured voltage will indicate what the host can provide. That's cheaper than using a PD controller. A PD controller is really needed only if you need to request a higher VBUS than 5V or a higher current, or combination thereof.

In both cases, keep in mind that the host may *not* provide what you expect (in which case you'll be informed, either from the CC1/CC2 voltage or from the PD controller), and your device will have to handle this "gracefully".
That again means that: if your device can't run with <= 100 mA before enumerating, and <= 500 mA after enumeration, only drawing higher once it has determined that the host can provide higher, then it's non-compliant and you'll have problems in the field, so whatever parts of your device can make it draw over 500 mA *must* be disabled until it has determined that it can switch them on.

A corollary of that is that just adding a PD controller is obviously not enough. Just because you request more current or voltage doesn't mean you'll get that.
 
The following users thanked this post: pastaclub

Online asmi

  • Super Contributor
  • ***
  • Posts: 2930
  • Country: ca
Re: How important are the two 5.1k resistors on USB-C?
« Reply #34 on: April 14, 2025, 04:23:08 pm »
A corollary of that is that just adding a PD controller is obviously not enough. Just because you request more current or voltage doesn't mean you'll get that.
Yep, which is why most of those "PD Sink solutions" have a way to provide some fallback in case that happens. Take a look at this one, for example: https://www.infineon.com/cms/en/product/universal-serial-bus/usb-c-charging-port-controllers/ez-pd-barrel-connector-replacement-lite-bcr-lite/ It's got two separate FET gate drivers for main power supply, and for a fallback 5V power so that your design can react appropriately to either case. Some designs use SEPIC-style up-down converter to provide the same output voltage regardless of input one, which usually makes PDS design simpler - for example, you can use "negotiated power ok" signal to keep the rest of PDS in a shutdown mode (think of FPGA/SoC board, which only powers the main device up if appropriate power is provided).

Offline bson

  • Supporter
  • ****
  • Posts: 2580
  • Country: us
Re: How important are the two 5.1k resistors on USB-C?
« Reply #35 on: April 14, 2025, 07:09:13 pm »
Note also that there are lots of supplies sold as 25W, 27W, or 30W that provide 5V 5A, 5.1V 5A, or 5V 6A - and do so with 56k CC pullups (if memory serves, it's easily checked with a DMM).  With something like a RPi 5 you need to tell it to ignore the limit and trust the supply, otherwise it will try to limit itself to 15W (5V 3A).
 

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9390
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: How important are the two 5.1k resistors on USB-C?
« Reply #36 on: April 15, 2025, 10:50:21 pm »
Why do you want to do that?
Detect that the device is plugged into USB 3 with an A to C cable and can have 900mA to work with instead of 500mA.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Offline peter-hTopic starter

  • Super Contributor
  • ***
  • Posts: 4639
  • Country: gb
  • Doing electronics since the 1960s...
Re: How important are the two 5.1k resistors on USB-C?
« Reply #37 on: April 16, 2025, 03:34:56 pm »
Clever :)

This made me think about how I would implement the MOSFET drive on my 32F417 project if I wanted to do the < 100mA until enumerated. There is no dedicated pin coming out so I would need to drive a GPIO from some code.

It's not that easy with a 168MHz chip to keep below 100mA. Fortunately the thing is not officially USB-powered; it is 12/24V DC powered and the USB then draws much less - 40mA. But it can be just USB powered and the basic draw is about 80mA. And you can't do the enumeration before winding up the PLL because the chip starts up at 16MHz but USB needs the internal 48MHz clock which is divided from the 168MHz.
« Last Edit: April 16, 2025, 03:40:02 pm by peter-h »
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 4111
  • Country: us
Re: How important are the two 5.1k resistors on USB-C?
« Reply #38 on: April 16, 2025, 07:40:11 pm »
Why do you want to do that?
Detect that the device is plugged into USB 3 with an A to C cable and can have 900mA to work with instead of 500mA.

Well, AFAIK that's not _technically_ allowed.  Those higher current limits are only available for superspeed devices operating in superspeed mode.  So I guess do whatever works, it's not going to be officially compliant anyway.

My understanding is that superspeed enumeration works by the host transmitting periodic pulses and looking for the termination resistor.  So you should be able to detect these pulses and know that you are on a superspeed port and have a superspeed cable.
 
The following users thanked this post: SiliconWizard

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 16388
  • Country: fr
Re: How important are the two 5.1k resistors on USB-C?
« Reply #39 on: April 16, 2025, 08:28:28 pm »
Yes. You can get up to 500 mA *once enumerated* as a USB FS or HS device and up to 900 mA only *once enumerated* as a SS device.
I don't recommend trying to play tricks.

I probably didn't detail enough my point on reading the CC1/CC2 voltages for those interested to look for more info about this by themselves, I don't know.
Again, if using USB-C, you don't need tricks. You just need to pull down the CC1 & CC2 pins with 5k1 resistors as everyone knows, and then read the voltages using your MCU to determine how much current the host can deliver via VBUS (at 5 V only), without the need for a PD controller. A host can advertise up to 3 A this way. It does that by connecting various values of pull-ups.

If you're using USB FS or HS, you have 500 mA max by default, and a USB-C host can optionally (but it's common) provide 1.5 A or 3 A, without the need for a PD controller, so without negotiation, but always after enumeration, and always at 5 V.
On CC1 or CC2 (depending on cable orientation, so you need to monitor both voltages), you'll read:

Default (500 mA in FS/HS) : 408 mV +/- 20 %
1.5 A : 918 mV +/- 8 %
3.0 A : 1.683 V +/- 8 %

If you use a USB-C to USB-A cable, of course, that depends on the cable. Most such cables should have an internal pull-up on one of CCx pins, its value may vary but to be compliant, it should not have anything that would advertise more than the default current to the USB-C device, since it can't known if the host connected to USB-A can deliver more. From experience, some of those cables don't even have a pull-up resistor, making them problematic for devices that read the CCx voltages. So from the device POV, if you read any voltage below 918 mV - 8 %, you should assume the default current (so, 500 mA max).

(There are possibly other ways by using "QuickCharge" but I absolutely don't recommend going that path unless you're explicitely designing a charger and want to support it. There is also USB-BC, which is only available on specific USB ports, as it's optional, so I wouldn't recommend it either for general purpose.)
« Last Edit: April 16, 2025, 08:30:25 pm by SiliconWizard »
 
The following users thanked this post: peter-h, pastaclub

Offline peter-hTopic starter

  • Super Contributor
  • ***
  • Posts: 4639
  • Country: gb
  • Doing electronics since the 1960s...
Re: How important are the two 5.1k resistors on USB-C?
« Reply #40 on: April 16, 2025, 08:44:00 pm »
Quote
depending on cable orientation, so you need to monitor both voltages

It's a pity one needs two ADC channels. It would be nice to use a couple of diodes and a single ADC channel. But it would be tricky to stay within the 8% band.

I would put money on many A-C cables not containing any resistors ;) Especially ones supplied purely for powering some device and included in the box.

Quote
You can get up to 500 mA *once enumerated* as a USB FS or HS device and up to 900 mA only *once enumerated* as a SS device.

FWIW (zero) about 7 years ago I was working on a little gadget (which never went into production) and tested a load of laptops, and found that USB2 ones had a trip above 500mA and USB3 ones had a trip above 900mA. That was with just the 2 wires connected. I can't remember the deviations but it looks like most hosts don't implement an enumeration dependent trip or limit.
« Last Edit: April 16, 2025, 08:48:45 pm by peter-h »
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 4111
  • Country: us
Re: How important are the two 5.1k resistors on USB-C?
« Reply #41 on: April 16, 2025, 11:18:33 pm »
I would put money on many A-C cables not containing any resistors ;) Especially ones supplied purely for powering some device and included in the box.

I've never heard of one that didn't so I'd suggest you find evidence before spreading rumors.

The bigger issue was A to C cables that contained the wrong resistor, falsely advertising 3A current capacity.  This caused overloading of host ports or chargers if the cable was used with a supply that couldn't actually provide that much current.

Quote
FWIW (zero) about 7 years ago I was working on a little gadget (which never went into production) and tested a load of laptops, and found that USB2 ones had a trip above 500mA and USB3 ones had a trip above 900mA. That was with just the 2 wires connected. I can't remember the deviations but it looks like most hosts don't implement an enumeration dependent trip or limit.

Sure.  But everyone else here is talking about USB, as in the standard and what it says you need to do.  Not how particular devices and setups work, nor what crappy devices that have a USB-looking connector on them but are not actually USB devices might assume they can get away with.
« Last Edit: April 16, 2025, 11:26:22 pm by ejeffrey »
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4416
  • Country: us
Re: How important are the two 5.1k resistors on USB-C?
« Reply #42 on: April 21, 2025, 07:53:05 pm »
Quote
You can get up to 500 mA *once enumerated* as a USB FS or HS device and up to 900 mA only *once enumerated* as a SS device.


I thought the power negotiation (on CC) was entirely separate from the enumeration (on the USB Data lines), and you could set up the power before you got to the actual data communications?

 

Offline bson

  • Supporter
  • ****
  • Posts: 2580
  • Country: us
Re: How important are the two 5.1k resistors on USB-C?
« Reply #43 on: April 21, 2025, 08:02:56 pm »
Quote
You can get up to 500 mA *once enumerated* as a USB FS or HS device and up to 900 mA only *once enumerated* as a SS device.


I thought the power negotiation (on CC) was entirely separate from the enumeration (on the USB Data lines), and you could set up the power before you got to the actual data communications?
The 900mA limit is with resistors on the CC pins.
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 4111
  • Country: us
Re: How important are the two 5.1k resistors on USB-C?
« Reply #44 on: April 22, 2025, 08:01:02 pm »
Quote
You can get up to 500 mA *once enumerated* as a USB FS or HS device and up to 900 mA only *once enumerated* as a SS device.


I thought the power negotiation (on CC) was entirely separate from the enumeration (on the USB Data lines), and you could set up the power before you got to the actual data communications?

As explained several times above: If you sense the voltage on the CC line and it indicates a higher current limit, you can use it.  If you don't sense it, or the host uses a 56k pull up that indicates the "Default USB power" profile, which is as describe in the section you quoted.


 

Offline bson

  • Supporter
  • ****
  • Posts: 2580
  • Country: us
Re: How important are the two 5.1k resistors on USB-C?
« Reply #45 on: April 23, 2025, 09:41:54 pm »
As explained several times above: If you sense the voltage on the CC line and it indicates a higher current limit, you can use it.  If you don't sense it, or the host uses a 56k pull up that indicates the "Default USB power" profile, which is as describe in the section you quoted.
Sure, you can add some sort of comparator that drives a switch, and stay powered off until a sufficient current limit is sensed.  This causes some supplies to silently not work at all, for mysterious reasons.

Or you can use the current and have the supply or host shut you off if it can't supply it.  This causes some supplies to either not work at all for mysterious reasons, or work for a little while before shutting off - for equally mysterious reasons.

Either way, you end up needing a different supply for mysterious reasons.
 

Offline peter-hTopic starter

  • Super Contributor
  • ***
  • Posts: 4639
  • Country: gb
  • Doing electronics since the 1960s...
Re: How important are the two 5.1k resistors on USB-C?
« Reply #46 on: April 24, 2025, 06:15:41 am »
Maybe one needs a time delay between sensing the voltage and drawing the extra current.
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf