All About USB-C: Example Circuits

In the six months that have passed after the last USB-C article has been released, I have thought up a bunch of ways that these articles could have been improved. It’s, of course, normal to have such a feeling — expected, even. I now believe that there’s a few gaps that I could bridge. For instance, I have not provided enough example circuits, and sometimes one schematic can convey things better than a thousand words.

Let’s fix that! I’ll give you schematics for the kinds of USB-C devices you’re actually likely to want to build. I’ll also share a bunch of IC part numbers in this article, but I don’t have an exhaustive collection, of course – if you find more cool ICs that work for USB-C purposes and aren’t mentioned here, please do let us all know in the comments!

Continue reading “All About USB-C: Example Circuits”

All About USB-C: Replying Low-Level PD

Last time, we configured the FUSB302 to receive USB PD messages, and successfully received a “capability advertisement” message from a USB-C PSU. Now we crack the PD specification open, parse the message, and then craft a reply that makes the PSU give us the highest voltage available.

How did the buffer contents look, again?

>>> b
b'\xe0\xa1a,\x91\x01\x08,\xd1\x02\x00\x13\xc1\x03\x00\xdc\xb0\x04\x00\xa5@\x06\x00<!\xdc\xc0H\xc6\xe7\xc6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

The zeroes at the end might look non-significant, and they indeed are not with 99.99% certainty – that said, don’t just discard the entire tail end; one of the bytes in the beginning encodes the length of the message. We’ll read those bytes first, and then read only exactly as much as we need, making sure we aren’t reading two messages and interpreting it as one, and that we’re not discarding zeroes that are part of the message.

Today, we will write code that parses messages right after reading them from the FIFO buffer – however, keep this message handy for reference, still; and if you don’t have the hardware, you can use it to try your hand at decoding nevertheless. If you wanna jump in, you can find today’s full code here!

Continue reading “All About USB-C: Replying Low-Level PD”

All About USB-C: Talking Low-Level PD

In this USB-C series, we’ve covered quite a bit of USB-C – things that are well known, things that should beĀ  better known, and a couple things that just appeared online for the first time. We’ve covered almost everything in some depth except USB Power Delivery. I’ve described the process a bit in the “Power” article, but that was mostly about how to use PD by simply buying the right solution. However, that’s not enough for a hacker. Let’s see if we can make our own PD trigger board. Continue reading “All About USB-C: Talking Low-Level PD”

All About USB-C: Manufacturer Sins

People experience a variety of problems with USB-C. I’ve asked people online about their negative experiences with USB-C, and got a wide variety of responses, both on Twitter and on Mastodon. In addition to that, communities like r/UsbCHardware keep a lore of things that make some people’s experience with USB-C subpar.

In engineering and hacking, there’s unspoken things we used to quietly consider as unviable. Having bidirectional power and high-speed data on a single port with thousands of peripherals, using nothing but a single data pin – if you’ve ever looked at a schematic for a proprietary docking connector attempting such a feat, you know that you’d find horrors beyond comprehension. For instance, MicroUSB’s ID pin quickly grew into a trove of incompatible resistor values for anything beyond “power or be powered”. Laptop makers had to routinely resort to resistor and one-wire schemes to make sure their chargers aren’t overloaded by a laptop assuming more juice than the charger can give, which introduced a ton of failure modes on its own.

When USB-C was being designed, the group looked through chargers, OTG adapters, display outputs, docking stations, docking stations with charging functions, and display outputs, and united them into a specification that can account for basically everything – over a single cable. What could go wrong?

Of course, device manufacturers found a number of ways to take everything that USB-C provides, and wipe the floor with it. Some of the USB-C sins are noticeable trends. Most of them, I’ve found, are manufacturers’ faults, whether by inattention or by malice; things like cable labelling are squarely in the USB-C standard domain, and there’s plenty of random wear and tear failures.

I don’t know if the USB-C standard could’ve been simpler. I can tell for sure that plenty of mistakes are due to device and cable manufacturers not paying attention. Let’s go through the notorious sins of USB-C, and see what we can learn. Continue reading “All About USB-C: Manufacturer Sins”

All About USB-C: Pinecil Soldering Iron

As many people have pointed out, what matters with USB-C isn’t just the standard, it’s the implementations. After all, it’s the implementations that we actually have to deal with, and it’s where most of the problems with USB-C arise. There is some fault to the standard, like lack of cable markings from the get-go, but at this point, I’m convinced that the USB-C standard is a lot better than some people think.

I’d like to walk you through a few USB-C implementations in real, open-source, adjacent, and just interesting products. They’re all imperfect in some way – it can’t be otherwise, as they have to deal with the messy real world, where perfection is a rarity.

Today, let’s check out the Pinecil. A soldering iron by Pine64, released a few years ago, keeping the price low and quality high. It sports both a barrel jack and a USB-C port for its power input – a welcome departure from the Miniware iron strategy, where neither the barrel-jack-only TS100 nor the low-power proprietary-tip TS80 irons quite did it. And, given its design around TS100 T12-style tips, it’s no wonder Pinecil took a well-deserved spot in hobbyist world.

Can’t Just Pull The Trigger

Now, you might be thinking that Pinecil ought to be a simple device. The usual way to get high power out of a USB-C port is a Power Delivery (PD) trigger IC, and you could merely use that. However, if you’ve read the USB-C power article, you might remember the 45 W vs 60 W charger scenario, where such an arrangement would fail immediately. Overall, the configurability of trigger ICs is quite low, and when encountering a PD compatibility problem with some PSU, you can’t do anything about it except replace the IC with a slightly-different-logic IC- if a replacement even exists, and it usually does not. This is costly and limiting for a real-world use product. Continue reading “All About USB-C: Pinecil Soldering Iron”

All About USB-C: Framework Laptop

Talking about high-quality USB-C implementations, there’s a product that has multiple selling points designed around USB-C, and is arguably a shining example of how to do USB-C right. It’s the Framework laptop, where the USB-C expansion cards take the center stage.

Full disclosure – this article is being typed on a Framework laptop, and I got it free from Framework. I didn’t get it for Hackaday coverage – I develop Framework-aimed hardware as hobby, specifically, boards that hack upon aspects of this laptop in fun ways. As part of their community developer support effort, they’ve provided me with a laptop that I wouldn’t otherwise be able to get for such a hobby. By now, I’m part of the Framework community, I have my own set of things I like about this laptop, and a set of things I dislike.

This is not an article about how I’m satisfied or dissatisfied with the Framework laptop – there’s plenty of those around, and it would not be fair for me to write one – I haven’t paid for it in anything except having lots of fun designing boards and hanging out with other people designing cool things, which is something I do willingly. I’m an all-things-laptops enthusiast, and the reason I’d like to talk about Framework is that there is no better example of USB-C, and everything you can do with it, in the wild. Continue reading “All About USB-C: Framework Laptop”

All About USB-C: High-Speed Interfaces

One amazing thing about USB-C is its high-speed capabilities. The pinout gives you four high-speed differential pairs and a few more lower-speed pairs, which let you pump giant amounts of data through a connector smaller than a cent coin. Not all devices take advantage of this capability, and they’re not required to – USB-C is designed to be accessible for every portable device under the sun. When you have a device with high-speed needs exposed through USB-C, however, it’s glorious just how much USB-C can give you, and how well it can work.

The ability to get a high-speed interface out of USB-C is called an Alternate Mode, “altmode” for short. The three altmodes you can encounter nowadays are USB3, DisplayPort and Thunderbolt, there’s a few that have faded into obscurity like HDMI and VirtualLink, and some are up and coming like USB4. Most altmodes require digital USB-C communication, using a certain kind of messages over the PD channel. That said, not all of them do – the USB3 is the simplest one. Let’s go through what makes an altmode tick. Continue reading “All About USB-C: High-Speed Interfaces”