How important are the two 5.1k resistors on USB-C? - Page 1
Forum section: electronics / general

author: peter-h
author_rank: Super Contributor
timestamp: April 07, 2025, 06:08:19 pm
content: 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.

author: ataradov
author_rank: Super Contributor
timestamp: April 07, 2025, 07:59:24 pm
content: 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.

author: peter-h
author_rank: Super Contributor
timestamp: April 07, 2025, 08:07:25 pm
content: QuoteYes 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.

author: asmi
author_rank: Super Contributor
timestamp: April 07, 2025, 08:16:28 pm
content: Quote from: peter-h on April 07, 2025, 08:07:25 pmAlso make sure you try e-marked cable as they have some peculiarities.Quote from: peter-h on April 07, 2025, 08:07:25 pmSeriously? Now it's getting harder to find laptop with portsotherthan USB-C.

author: peter-h
author_rank: Super Contributor
timestamp: April 07, 2025, 08:45:51 pm
content: I found nothing "e-market". It is "e-marker"https://www.amazon.co.uk/Cablecc-10Gbps-Marker-Tablet-Laptop/dp/B07VZ4V115and a USB-C power supplyhttps://www.amazon.co.uk/gp/product/B0CXPFZBF8Last laptop I bought was an XPS13Win10.

author: chrono68
author_rank: Contributor
timestamp: April 07, 2025, 09:40:50 pm
content: Quote from: peter-h on April 07, 2025, 08:07:25 pmHell not only do laptops come with mostly USB-C ports, but most laptops come with a USB-C charger.

author: SiliconWizard
author_rank: Super Contributor
timestamp: April 07, 2025, 10:39:49 pm
content: 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.

author: ejeffrey
author_rank: Super Contributor
timestamp: April 07, 2025, 11:57:15 pm
content: Quote from: peter-h on April 07, 2025, 08:45:51 pmAny 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.

author: peter-h
author_rank: Super Contributor
timestamp: April 08, 2025, 06:25:03 am
content: I've ordered that USB-C power supply. Maybe I should borrow a new laptop alsoThe 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).

author: ataradov
author_rank: Super Contributor
timestamp: April 08, 2025, 01:47:46 pm
content: 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.

author: SiliconWizard
author_rank: Super Contributor
timestamp: April 08, 2025, 04:12:48 pm
content: 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.

author: ataradov
author_rank: Super Contributor
timestamp: April 08, 2025, 04:51:16 pm
content: 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.

author: peter-h
author_rank: Super Contributor
timestamp: April 08, 2025, 07:53:37 pm
content: 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.

author: bson
author_rank: Unknown
timestamp: April 08, 2025, 08:18:22 pm
content: Quote from: ataradov on April 08, 2025, 04:51:16 pmRealistically 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.

author: SiliconWizard
author_rank: Super Contributor
timestamp: April 08, 2025, 09:35:43 pm
content: Quote from: ataradov on April 08, 2025, 04:51:16 pmYou 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.

author: ataradov
author_rank: Super Contributor
timestamp: April 08, 2025, 10:15:30 pm
content: Quote from: bson on April 08, 2025, 08:18:22 pmFor 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.Quote from: bson on April 08, 2025, 08:18:22 pmNo idea what happened in USB3. Given that all high-current ports were not part of the main spec, all that could have been simplified.

author: gabiz_ro
author_rank: Regular Contributor
timestamp: April 09, 2025, 06:53:13 am
content: 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

author: peter-h
author_rank: Super Contributor
timestamp: April 09, 2025, 07:27:06 am
content: 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 noticeI 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

author: 5U4GB
author_rank: Super Contributor
timestamp: April 09, 2025, 11:54:11 am
content: Quote from: ataradov on April 07, 2025, 07:59:24 pmIf 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.

author: ejeffrey
author_rank: Super Contributor
timestamp: April 09, 2025, 01:37:13 pm
content: Quote from: peter-h on April 09, 2025, 07:27:06 amI'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.

author: SiliconWizard
author_rank: Super Contributor
timestamp: April 09, 2025, 01:51:57 pm
content: Quote from: peter-h on April 09, 2025, 07:27:06 amYes 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.

author: bson
author_rank: Unknown
timestamp: April 10, 2025, 12:07:02 am
content: Quote from: peter-h on April 09, 2025, 07:27:06 amAhhhh! So THIS is why my biasing resistors keep going up in smoke...I thought it was me, but no... it'syou, cheap Chinese PoE switch!!! Well, that's one mystery less in my life...

author: Siwastaja
author_rank: Super Contributor
timestamp: April 10, 2025, 05:24:52 am
content: Quote from: SiliconWizard on April 09, 2025, 01:51:57 pmMaybe 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.

author: asmi
author_rank: Super Contributor
timestamp: April 11, 2025, 01:36:20 pm
content: Quote from: Siwastaja on April 10, 2025, 05:24:52 amThey 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).

author: Siwastaja
author_rank: Super Contributor
timestamp: April 11, 2025, 02:36:39 pm
content: Quote from: asmi on April 11, 2025, 01:36:20 pmThat 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.

author: SiliconWizard
author_rank: Super Contributor
timestamp: April 11, 2025, 04:31:32 pm
content: There are way more chinese USB-PD controllers available these days than western counterparts. They absolutely don't need any of the latter.

author: NiHaoMike
author_rank: Super Contributor
timestamp: April 12, 2025, 03:25:13 am
content: 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.

author: ejeffrey
author_rank: Super Contributor
timestamp: April 12, 2025, 04:57:32 am
content: Quote from: NiHaoMike on April 12, 2025, 03:25:13 amWhy do you want to do that?

author: peter-h
author_rank: Super Contributor
timestamp: April 12, 2025, 07:22:20 am
content: 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

author: 5U4GB
author_rank: Super Contributor
timestamp: April 12, 2025, 11:03:56 am
content: Quote from: ejeffrey on April 12, 2025, 04:57:32 amAnd 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.

author: peter-h
author_rank: Super Contributor
timestamp: April 12, 2025, 09:02:58 pm
content: 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.

author: krho
author_rank: Regular Contributor
timestamp: April 14, 2025, 05:23:00 am
content: 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

author: peter-h
author_rank: Super Contributor
timestamp: April 14, 2025, 06:02:19 am
content: 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.

author: SiliconWizard
author_rank: Super Contributor
timestamp: April 14, 2025, 01:23:43 pm
content: Quote from: peter-h on April 14, 2025, 06:02:19 amNo.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.

author: asmi
author_rank: Super Contributor
timestamp: April 14, 2025, 04:23:08 pm
content: Quote from: SiliconWizard on April 14, 2025, 01:23:43 pmYep, 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).

author: bson
author_rank: Unknown
timestamp: April 14, 2025, 07:09:13 pm
content: 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).

author: NiHaoMike
author_rank: Super Contributor
timestamp: April 15, 2025, 10:50:21 pm
content: Quote from: ejeffrey on April 12, 2025, 04:57:32 amDetect that the device is plugged into USB 3 with an A to C cable and can have 900mA to work with instead of 500mA.

author: peter-h
author_rank: Super Contributor
timestamp: April 16, 2025, 03:34:56 pm
content: CleverThis 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.

author: ejeffrey
author_rank: Super Contributor
timestamp: April 16, 2025, 07:40:11 pm
content: Quote from: NiHaoMike on April 15, 2025, 10:50:21 pmWell, 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.

author: SiliconWizard
author_rank: Super Contributor
timestamp: April 16, 2025, 08:28:28 pm
content: 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.)

author: peter-h
author_rank: Super Contributor
timestamp: April 16, 2025, 08:44:00 pm
content: QuoteIt'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 resistorsEspecially ones supplied purely for powering some device and included in the box.QuoteFWIW (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 anenumeration dependenttrip or limit.

author: ejeffrey
author_rank: Super Contributor
timestamp: April 16, 2025, 11:18:33 pm
content: Quote from: peter-h on April 16, 2025, 08:44:00 pmI'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.QuoteSure. 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.

author: westfw
author_rank: Super Contributor
timestamp: April 21, 2025, 07:53:05 pm
content: QuoteI 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?

author: bson
author_rank: Unknown
timestamp: April 21, 2025, 08:02:56 pm
content: Quote from: westfw on April 21, 2025, 07:53:05 pmThe 900mA limit is with resistors on the CC pins.

author: ejeffrey
author_rank: Super Contributor
timestamp: April 22, 2025, 08:01:02 pm
content: Quote from: westfw on April 21, 2025, 07:53:05 pmAs 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.

author: bson
author_rank: Unknown
timestamp: April 23, 2025, 09:41:54 pm
content: Quote from: ejeffrey on April 22, 2025, 08:01:02 pmSure, 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.

author: peter-h
author_rank: Super Contributor
timestamp: April 24, 2025, 06:15:41 am
content: Maybe one needs a time delay between sensing the voltage and drawing the extra current.