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

0 Members and 1 Guest are viewing this topic.

Offline peter-hTopic starter

  • Super Contributor
  • ***
  • Posts: 4624
  • Country: gb
  • Doing electronics since the 1960s...
How important are the two 5.1k resistors on USB-C?
« on: April 07, 2025, 06:08:19 pm »


I've just done a prototype for something and left a track off which connected the "GND" junction of the two resistors to GND, so there was just 10.2k across A5-B5.

But it all works fine.

Due to the way the connector is reversible, there are actually no resistors visible at all.

Can anyone explain it? I've googled and find only fairly meaningless explanations.

My device is a client and draws about 200mA. It has no OTG capability. The client device is a STM 32F417 USB FS. The Host device is various types of USB hub, some USB2 and some USB3.
« Last Edit: April 07, 2025, 07:45:23 pm by peter-h »
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 12014
  • Country: us
    • Personal site
Re: How important are the two 5.1k resistors on USB-C?
« Reply #1 on: April 07, 2025, 07:59:24 pm »
They are important if you use C-to-C cable, since this is how orientation is determined.

If you use C-to-A cable, you won't see a difference, since CCx signals are not even going to make to the A side.

And they are also important if you use e-marked cables.

But if you only use USB2 signals, then behavior depends on the specific host. Some may not care, others may care and not work.
« Last Edit: April 07, 2025, 08:02:47 pm by ataradov »
Alex
 
The following users thanked this post: peter-h

Offline peter-hTopic starter

  • Super Contributor
  • ***
  • Posts: 4624
  • Country: gb
  • Doing electronics since the 1960s...
Re: How important are the two 5.1k resistors on USB-C?
« Reply #2 on: April 07, 2025, 08:07:25 pm »
Quote
If you use C-to-A cable, you won't see a difference, since CCx signals are not even going to make to the A side.

Yes that's a great point. That's all I am using right now. So my client must not draw > 500mA (or 100mA from an unpowered hub or many laptops).

I ought to test it with a C-C cable and a C-output USB charger.

Are there any laptops with a USB-C port? Never seen one.
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Offline asmi

  • Super Contributor
  • ***
  • Posts: 2923
  • Country: ca
Re: How important are the two 5.1k resistors on USB-C?
« Reply #3 on: April 07, 2025, 08:16:28 pm »
I ought to test it with a C-C cable and a C-output USB charger.
Also make sure you try e-marked cable as they have some peculiarities.

Are there any laptops with a USB-C port? Never seen one.
Seriously? Now it's getting harder to find laptop with ports other than USB-C.
« Last Edit: April 07, 2025, 09:06:20 pm by asmi »
 
The following users thanked this post: peter-h

Offline peter-hTopic starter

  • Super Contributor
  • ***
  • Posts: 4624
  • Country: gb
  • Doing electronics since the 1960s...
Re: How important are the two 5.1k resistors on USB-C?
« Reply #4 on: April 07, 2025, 08:45:51 pm »
I found nothing "e-market". It is "e-marker" :)
https://www.amazon.co.uk/Cablecc-10Gbps-Marker-Tablet-Laptop/dp/B07VZ4V115

and a USB-C power supply
https://www.amazon.co.uk/gp/product/B0CXPFZBF8

Last laptop I bought was an XPS13 :) Win10.
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Offline chrono68

  • Contributor
  • Posts: 15
  • Country: us
  • Electronics Technician
Re: How important are the two 5.1k resistors on USB-C?
« Reply #5 on: April 07, 2025, 09:40:50 pm »
Quote
If you use C-to-A cable, you won't see a difference, since CCx signals are not even going to make to the A side.

Yes that's a great point. That's all I am using right now. So my client must not draw > 500mA (or 100mA from an unpowered hub or many laptops).

I ought to test it with a C-C cable and a C-output USB charger.

Are there any laptops with a USB-C port? Never seen one.

Hell not only do laptops come with mostly USB-C ports, but most laptops come with a USB-C charger.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 16356
  • Country: fr
Re: How important are the two 5.1k resistors on USB-C?
« Reply #6 on: April 07, 2025, 10:39:49 pm »
With a real USB-C host, this is not just for orientation (which usually doesn't matter if you strictly use the D+/D- pairs, which are themselves supposed to be paralleled on your device in 99.99% of the cases), but primarily to make the host detect your device as a USB device. Otherwise, it won't even care to enumerate it. In theory, you could do with using only one of them on either CC1 or CC2, except that "standard" USB-C to USB-C cables only have one wire for CC (which is precisely made to enable orientation detection, when it matters), so that if you put only one of these resistors in your device on either CCx, it will only work in one orientation as the host won't see the device as a device in the other orientation.

So omit those two resistors, and your device won't work when connected to a real USB-C port. And omit one of them, and cables will work only in one orientation: nice way to irritate your customers! That may not be widely available on typical desktop computers yet, but most laptops do now and some don't even have USB-A ports anymore. So you really don't want to play with that. It won't feel nice.
« Last Edit: April 07, 2025, 10:42:47 pm by SiliconWizard »
 
The following users thanked this post: samofab

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 4100
  • Country: us
Re: How important are the two 5.1k resistors on USB-C?
« Reply #7 on: April 07, 2025, 11:57:15 pm »
I found nothing "e-market". It is "e-marker" :)
https://www.amazon.co.uk/Cablecc-10Gbps-Marker-Tablet-Laptop/dp/B07VZ4V115

Any super-speed cable or cable that can carry alternate modes (displayport/thunderbolt) are e-marked.  As are any cables that can carry > 3 amps.  Unmarked cables are always USB 2.0 speed only, 3 amps max.

A USB type-C host or power supply will not even turn on VBus until it detects Rd.  So if your device is bus powered, it will not even power up when used with common charger.
 

Offline peter-hTopic starter

  • Super Contributor
  • ***
  • Posts: 4624
  • Country: gb
  • Doing electronics since the 1960s...
Re: How important are the two 5.1k resistors on USB-C?
« Reply #8 on: April 08, 2025, 06:25:03 am »
I've ordered that USB-C power supply. Maybe I should borrow a new laptop also :)

The current product is micro-USB and is all fine, but I've modded the PCB with USB-C so testing it now.

How much current is guaranteed to be available via USB-C if using just the 5.1k? I know USB2 is 500mA (unless unpowered hub; then it is 100mA). USB3 PC/laptop connectors are 900mA but you are supposed to negotiate (TPS2511 etc).
« Last Edit: April 08, 2025, 11:11:51 am by peter-h »
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 12014
  • Country: us
    • Personal site
Re: How important are the two 5.1k resistors on USB-C?
« Reply #9 on: April 08, 2025, 01:47:46 pm »
USB3 devices default to 900 mA maximum. And you can't passively request more. On the device side resistors always remain 5.1 kOhm. Those resistors form a divider with pull-up resistors in the host and depending on the voltage after the division host will advertise capability to deliver 1.5 A or 3 A. If host advertises higher current and you sensed it, then you can consume that much.

Before enumeration the same 100 mA limit applies and that 900 mA limit only applies to devices that actually enumerated as USB3 via USB3 pins. Not just devices using USB3 connectors, but enumerating over USB2 pins (like in this case). The power indication is in the descriptors and descriptors have different meaning when communicated over USB2 vs USB3.
« Last Edit: April 08, 2025, 01:49:43 pm by ataradov »
Alex
 
The following users thanked this post: pardo-bsso, peter-h, pastaclub

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 16356
  • Country: fr
Re: How important are the two 5.1k resistors on USB-C?
« Reply #10 on: April 08, 2025, 04:12:48 pm »
Yes. One "simple" way of determining if you can draw more than 500 mA in this case is sensing CC1/CC2 voltages on the device side. Note that even if you do this, it means that once enumerated, you *can't* draw more than 500 mA until you have determined that the host can deliver more (by sensing CC1/CC2). So your circuit must handle this and not draw the max current right from power-on. It can't even draw more than 100 mA *before enumerating* either, as ataradov mentioned, something that some USB devices fail to respect (and while that may "work on your own machine", that will make some computers, especially laptops, pretty unhappy).

All that means that your device must have power switches and/or current limiting as appropriate and control these from your microcontroller.

Sensing CC1/CC2 will just require 2 ADC inputs, and the standard voltages should not exceed about 2V IIRC - but you may still want to add some protection between that and the ADC inputs to avoid frying the MCU just in case.
 
The following users thanked this post: pastaclub

Online ataradov

  • Super Contributor
  • ***
  • Posts: 12014
  • Country: us
    • Personal site
Re: How important are the two 5.1k resistors on USB-C?
« Reply #11 on: April 08, 2025, 04:51:16 pm »
You technically don't need to sense them at all in either case. Before enumeration you consume less than 100 mA, then in the first step of enumeration you tell the host how much you want to consume in the descriptor. This is where USB2 tops out at 500 mA. USB3 uses units of 150 mA, so you can request a lot more. The host then may decline the enumeration if requested current is higher than host capability.

Whether any hosts actually look at the requested power - no idea.
Alex
 

Offline peter-hTopic starter

  • Super Contributor
  • ***
  • Posts: 4624
  • Country: gb
  • Doing electronics since the 1960s...
Re: How important are the two 5.1k resistors on USB-C?
« Reply #12 on: April 08, 2025, 07:53:37 pm »
Years ago I looked at the USB2 laptop sort of current limiting and there didn't seem to be any at 100mA. I've been selling USB powered products for about 20 years, which have the MOSFET power switching, 90mA current declaration, FTDI chips with on-chip and separate EEPROMs, all done properly, etc. But there is no evidence it is needed. What certainly does exist (USB2) on laptops is a cutoff (a trip) > 500mA.

This product, USB-C, draws 350mA max. But it does have a few uF of caps on the 3.3V rail, which is derived from VBUS with a R1191H033B regulator. I chose that reg because you can OR the outputs of multiple ones, with no current going back into any of them.

Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Offline bson

  • Supporter
  • ****
  • Posts: 2574
  • Country: us
Re: How important are the two 5.1k resistors on USB-C?
« Reply #13 on: April 08, 2025, 08:18:22 pm »
Whether any hosts actually look at the requested power - no idea.
Realistically you can draw the full "passive" 900mA from the moment you're plugged in.  Otherwise if there's nothing to enumerate and you're only using it as a power socket you could never get past 100mA without putting some token device on the bus.  And the vast majority of USB-C power supplies I'm sure will never enumerate, either.  Are you sure this pre-enumeration limit wasn't a USB-2 thing that was retired in USB-3?  Because it makes no sense.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 16356
  • Country: fr
Re: How important are the two 5.1k resistors on USB-C?
« Reply #14 on: April 08, 2025, 09:35:43 pm »
You technically don't need to sense them at all in either case.

You do if you want to be able to draw more than 500 mA from a USB-C host (when it allows) while using only USB FS or HS, which is a pretty common use case these days. If you stick to max 500 mA, of course you don't need to.
But by sensing CC1/CC2 and in 99% of cases connecting to a USB-C port, you'll be able to draw up to 1.5A or even 3A, without the need to negotiate it. But unless you sense CC1/CC2, you won't know if you can. If you want more than this or over 5V for VBUS, then you'll need a USB-PD controller.
 
The following users thanked this post: pastaclub

Online ataradov

  • Super Contributor
  • ***
  • Posts: 12014
  • Country: us
    • Personal site
Re: How important are the two 5.1k resistors on USB-C?
« Reply #15 on: April 08, 2025, 10:15:30 pm »
you could never get past 100mA without putting some token device on the bus.
For USB2 there are 3 possible port types that devices technically need to detect:
1. Standard downstream port (SDP). Detected by standard host pull-up resistors on D+/D-. If you detect this port, you can't draw more than 100 mA before enumeration.
2. Charging downstream port (CDP). This can deliver up to 1.5 A even before enumeration, the detection procedure still applies, but it is not a full enumeration, just some combination of setting and reading back the levels.
3. Dedicated charging port (DCP). This is a basic power supply with no data connection. It is indicated by shorting D+/D- on the source side and need to be detected by the device. You are supposed to drive 0.6 V into one pin and read it back from the other.

The last two are part of the separate battery charging specification and not the main USB spec.

In practice the only time I've seen any of this implemented on the device side is with dedicated battery chagrining ICs, which do those negotiations. Standard bus powered devices just consume whatever and hope it works.

Are you sure this pre-enumeration limit wasn't a USB-2 thing that was retired in USB-3?  Because it makes no sense.
No idea what happened in USB3. Given that all high-current ports were not part of the main spec, all that could have been simplified.
« Last Edit: April 08, 2025, 10:19:25 pm by ataradov »
Alex
 
The following users thanked this post: splin, pastaclub

Offline gabiz_ro

  • Regular Contributor
  • *
  • Posts: 129
  • Country: ro
Re: How important are the two 5.1k resistors on USB-C?
« Reply #16 on: April 09, 2025, 06:53:13 am »
On USB-C host side or charger until something is connected and properly detected on CC pins for powering device, nothing works.
Most simple is with 5.1K resistor that will enable charger or host to provide 5V power to connected device

 

Offline peter-hTopic starter

  • Super Contributor
  • ***
  • Posts: 4624
  • Country: gb
  • Doing electronics since the 1960s...
Re: How important are the two 5.1k resistors on USB-C?
« Reply #17 on: April 09, 2025, 07:27:06 am »
I wonder how many USB-C chargers implement that? Let's face it - if they just put a 5V regulator (3A or whatever) onto the power pins, most users would not notice :)

I bought a genuine (to the extent that something on Amazon is genuine) Samsung USB-C charger for this test. Hopefully it implements it right. Junk chargers will probably just do what I describe above. Just like chinese POE injectors which just put 48V across the little resistors in your non-POE RJ45 ;)
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 
The following users thanked this post: bson

Offline 5U4GB

  • Frequent Contributor
  • **
  • Posts: 790
  • Country: au
Re: How important are the two 5.1k resistors on USB-C?
« Reply #18 on: April 09, 2025, 11:54:11 am »
They are important if you use C-to-C cable, since this is how orientation is determined.

If you use C-to-A cable, you won't see a difference, since CCx signals are not even going to make to the A side.

If you are going to use USB-C for power, please take the time to set it up right.  There are large numbers of incorrectly-configured devices out there with USB-C sockets that were only ever tested with USB-A to C cables that then glitch (typically only glitch, never fail obviously and fully) with a USB C to C cable.  This can lead to days or even weeks of debugging (depending on how intermittent it is) trying to track down the problem.

We really need a non-multi-thousand-dollar device that you can plug in upstream that'll tell you whether your USB-C device is configured correctly, in the same way that now-ubiquitous USB-C cable testers dealt with the slew of garbage USB-C cables in the past.
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 4100
  • Country: us
Re: How important are the two 5.1k resistors on USB-C?
« Reply #19 on: April 09, 2025, 01:37:13 pm »
I wonder how many USB-C chargers implement that? Let's face it - if they just put a 5V regulator (3A or whatever) onto the power pins, most users would not notice :)

I'm sure there is non compliant junk out there but I would expect any reputable brand to do this correctly.  Higher end chargers that support more than 15 watt charging are going to implement PD.  Those  are almost certainly going to work this way.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 16356
  • Country: fr
Re: How important are the two 5.1k resistors on USB-C?
« Reply #20 on: April 09, 2025, 01:51:57 pm »
I wonder how many USB-C chargers implement that? Let's face it - if they just put a 5V regulator (3A or whatever) onto the power pins, most users would not notice :)

Yes they would. Just connect two such "chargers" with a USB-C to USB-C cable and enjoy the fireworks. That would be completely unacceptable. That's something that wasn't an issue with older chargers with USB-A connectors, unless the user *made* or found a cable that isn't commonly available, that is USB-A to USB-A. Something manufacturers could reasonably not expect.

Yes, USB-C is complicated and can quickly become a rabbit hole. Switching to it has consequences and is not painless.
 

Offline bson

  • Supporter
  • ****
  • Posts: 2574
  • Country: us
Re: How important are the two 5.1k resistors on USB-C?
« Reply #21 on: April 10, 2025, 12:07:02 am »
Just like chinese POE injectors which just put 48V across the little resistors in your non-POE RJ45 ;)
Ahhhh!  So THIS is why my biasing resistors keep going up in smoke...  |O
I thought it was me, but no... it's you, cheap Chinese PoE switch!!!  Well, that's one mystery less in my life... :)
 

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 9766
  • Country: fi
Re: How important are the two 5.1k resistors on USB-C?
« Reply #22 on: April 10, 2025, 05:24:52 am »
Yes they would. Just connect two such "chargers" with a USB-C to USB-C cable and enjoy the fireworks. That would be completely unacceptable. That's something that wasn't an issue with older chargers with USB-A connectors, unless the user *made* or found a cable that isn't commonly available, that is USB-A to USB-A. Something manufacturers could reasonably not expect.

Yes, USB-C is complicated and can quickly become a rabbit hole. Switching to it has consequences and is not painless.

Maybe most importantly, the era of simplicity is over and people deal with it. Chinese technology is very different to what it was 15 years ago. China is now full of decent engineers, even software engineers. 15 years ago it was obvious that the lowest-cost Chinese option fails at meeting every requirement and spec. Not so much anymore, with huge economy of scales and good availability of well educated engineers they can meet the same price goal while doing things correctly and within spec.

Chinese simply can design a complicated USB-C power management / communication IC from scratch, fabricate it, design chargers, devices and cables around it, following the specs, and still sell the product for $2 at Aliexpress.

Cheap non-compliant crap of course still exists, but it's not an obvious default anymore.
 

Offline asmi

  • Super Contributor
  • ***
  • Posts: 2923
  • Country: ca
Re: How important are the two 5.1k resistors on USB-C?
« Reply #23 on: April 11, 2025, 01:36:20 pm »
Chinese simply can design a complicated USB-C power management / communication IC from scratch, fabricate it, design chargers, devices and cables around it, following the specs, and still sell the product for $2 at Aliexpress.
They don't even need to do that, as most vendors in the power space has already designed such ICs a while ago and now offering them for peanuts (in volume).

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 9766
  • Country: fi
Re: How important are the two 5.1k resistors on USB-C?
« Reply #24 on: April 11, 2025, 02:36:39 pm »
They don't even need to do that, as most vendors in the power space has already designed such ICs a while ago and now offering them for peanuts (in volume).

That is thanks to competition; they know that unless they offer them for peanuts, Chinese will make a fully-Chinese equivalent no problem.

Gone are the days of having to buy some $5 Linear Technology IC to do some trivial thing. High quality, well engineered and well documented, for sure.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 16356
  • 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: 9383
  • 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: 4100
  • 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: 4624
  • 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: 790
  • 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: 4624
  • 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: 4624
  • 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
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 16356
  • 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

Offline asmi

  • Super Contributor
  • ***
  • Posts: 2923
  • 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: 2574
  • 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: 9383
  • 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: 4624
  • 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: 4100
  • 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

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 16356
  • 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: 4624
  • 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: 4100
  • 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: 4408
  • 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: 2574
  • 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: 4100
  • 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: 2574
  • 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: 4624
  • 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