 Hello, I'm Tyler, I am an electronics engineer and discovered when USB-C was first out, what's this interesting new port on my phone, let's fill it around and see what I can do and inadvertently I became kind of knowledgeable on USB-C, so I'll try and pass Sam that over to you. So for those that aren't super familiar with the USB-C connector, it actually does more than just USB, so that connector does your USB-A ports, your standard host ports you have had on your computers before, it handles your display output using the display port modes, it handles Thunderbolt, so you can talk to higher speed devices, it allows you to charge your devices at higher powers, it can be your audio interface, it can be the connector on your client devices and even be used to debug devices as well. Before looking into the USB-C connector itself, it's worth taking a look back at what is in the USB-A connector. So with USB-A, there was a distinct gender for the connectors, so you had the rectangular side on the host device and the square side on the client device. That way you always knew one end was a client, one end was a host. And within that, you've got two power pins and a pair of differential data pins which are used to communicate in both directions. For other devices, you'll have the micro connector. This is similar to the other client connector, but adds an additional ID pin. So that allows it to be both a host connector as well as a client connector and by in addition, later on, they added the ability to attach other resistors and other things that pin to put it into other modes including debug ports or audio adapters. And the other thing to note at this stage is USB-3 added an additional two differential data pairs that run at higher speed than the standard differential pairs. So in the A connector, they sort of added those on the front, so you just gained an additional five pins in addition to the four previously there. So let's introduce the USB-C connector itself. So it's a flippable connector, so you can plug it in either way up. In addition, there is no dedicated host end and client end, so the devices need to negotiate which one is which. So in order to get things going with the thing over, it's got four ground pins and four power pins. This allows it to be flipped up either way and the power pins connect to the same place and the ground pins connect to the same place. For the data pins, the solution is duplicate those as well. However, the slight difference with this one is the cable only uses one side, but the host uses both and connects them together. So that way, it doesn't matter which way you plug in the cable, it connects the pins on the host. For the super speed data pairs, we've got the four transmission pairs there, but also another four transmission pairs on the other side. These are used, like, usually you use one pair for USB 3, but for newer ones, you can use the other one. Exactly how they work, we'll get onto later in the talk. In addition, there are two new pins called CC, CC1 and CC2, again in a mirrored configuration, and just above them, two sideband use pins which use Pacific modes. So how does the device work out what's the host and what's the client? It does this using the CC pins, which are stand for the communications channel. So at the client side, it has two resistors to pull that down to ground and then it can monitor the CC pins itself to work out which way round is being connected, as a cable will contain one CC line from one side to the other, and the other one won't be connected. That way, whichever one gets pulled up by the host, which will use a pair of pull-up resistors, will let it work out the orientation. The host side is a little bit more complicated, so it uses two pull-up resistors, but notably, unlike the original A connectors, power is not connected by default because it might be connecting to another power source, so you don't want to connect two power sources together. Instead, the host has to monitor the CC pins to detect for the client being plugged in. What you end up with is a potential divider between the two, so they pull up on one end of one device and they pull down in another. At that point, you can monitor it and turn on the power. On the client side, you can actually get away without monitoring if you're using just simple modes, but many devices will need to monitor it. Probably the easiest way to go through that is to go through a walkthrough of a connection between two devices. We've got here our USB-C host device on one side and the client on the other. When we plug just a USB-C cable into one side, it connects to all the pins, but no actions will be triggered because the other side is floating, so it won't detect a pull-down from the other side. When we connect them together, you've now got a potential divider between the RP in the host and the RD in the client. However, it's worth noting that because the cable can be flipped at either end, you can actually end up with any of the CC pairs being connected together. In all these diagrams, I've always used CC1 to CC1 for convenience, but in reality, anyone could be connected to either of the others. So once it has connected across the thing, it detects the pull-down and it can then enable the power connection. So in terms of cabling, all of the USB-C cables will contain these five pins, more complicated ones capable of other modes, such as USB3, DisplayPort, or that contain additional wires. So you'll always have at least these pairs connected, which is why detection will work for all devices. However, the badge here doesn't have a cable. It does something a little different. Because it can only connect to one CC pair on one side, it can be flipped itself, but it only has one pin. It only needs a single pull-down and the other one needs to be left floating. So now you have to wonder, if you can connect things together, what happens if you connect two host devices together? What happens there? So both hosts have got their pull-up resistors and they both have a high voltage left at their CC pins. So nothing is detected, they don't turn on their power, and nothing happens. There's a sort of similar situation for client devices, except that notably, neither of them are providing power or have the capability to provide power, so just nothing really happens and nothing senses anything. To enable compatibility with the original A and B ports, there is a series of adapter legacy cables, as they refer to in the specification. So those work by just embedding the resistor inside the cable and similarly in the other method, it includes the pull-down resistor if you're connecting to a micro or a B client device. As well as just signaling the presence, the other major method the CC communication challenge uses to communicate is what the current level is available over the port. So in default USB power, there are various methods to try and say, ah, this charger can support more power there, usually involves adjusting the value of the data pins or similar. USB-C still has support for those older methods, but also adds two new modes, a 1.5 amp and a 3 amp mode. It does this by the host choosing the appropriate pull-up resistor relevant to its current capabilities. So a host with only able to default USB power has a 56K pull-up and a host able to do higher current will say have a 10K pull-up. There was once like catch with this early on in the USB-C days though, is that companies went, ah, I've built an old USB-A to see that to cable and they've gone, well, I made my cable do 3 amp, so they put a 3 amp resistor in it. The problem is that's not really telling the client the cable can do 3 amp, it's trying to tell them the charger can do it. So you ended up with devices drawing 3 amp from chargers that were not rated for it. This has largely been solved now, but did cause some problems in the early days of USB-C. So you may have noticed that some devices can be both host and client, such as your phones. This was done in the older methods with the ID pin on the micro mini connectors. But for USB-C, the solution is, well, have both a pull-up and a pull-down resistor and you switch between them. If you end up connecting two dual-roll devices together, eventually they'll end up with a state where one is host and the other is client, and then they'll form their pairs correctly. In addition to signifying host and client, you can do some other methods by adding different sets of pins onto those CC pins. The example here is an analog audio adapter, designed to let you have actual headphone line-level data coming out of your USB-C port. So it signifies that by pulling both of the CC pins down with RA resistors. This is also the first device that uses the side-band use pins with two of the headphone channels being mapped to the USB-2 data pins and the other two onto the side-band use pins on the connector. In addition, there are also debug adapters that use a similar method, except they use two RD resistors in their pull-down configuration. This is somewhat defined by the spec, but crucially, the debug adapter doesn't define what the port actually does in this mode. So you can just have it connect to it in a different way or reconfigure the chip for USB mode. Equally, you could run JTAG over it or spew out whatever other debug information you want. Now we get onto the USB superspeed. Because you can flip the connector, your pairs can map up in different ways. For the USB-2 pins, which are fairly high-speed data, but not too high-speed, connecting both pairs together at the host end with a little stub of unconnected copper for the bit that doesn't get connected in the cable, isn't too much of an issue. When you're dealing with the speeds in USB-3, you can't just map to both ends of the connector because you'll end up with a lot of signal problems. So the solution is you run to a pair of MUX chips. And based on the orientation of the cable, you'll then switch whether you connect to the TX-NRX-1 pairs or the TX-NRX-2 pairs. Notably, it's worth noting that newer USB 3.2 devices can use both pairs simultaneously, and that means they can only get that speed over the USB-C connector. So in all these things, you notice there's only one wire connecting both sides. So surely you can take a shortcut and only use one pull-down resistor. If any of you've heard the story about the issues with charging power supplies on the first generation of the Raspberry Pi 4, this is what they did. So if you're to connect with a standard USB-C to C cable, everything looks fairly good there. The other CC pins are unconnected and it would charge as normal. However, there are also cables that have internal pull-down resistors. This, as we'll get them to later, these cables are used that to signify these are smart cables that can state their capabilities. You need this if you're dealing with Thunderbolt, USB 3, or the other high-power protocols, because the host needs to go, not only does the device at the other end support it, but does the cable support it? So you have these pull-down resistors. So the host sees on its CC2 pin, ah, I have an RA pull-down. And on the other CC pin, it sees a combination of RD and RA. So for those not familiar with electronics and how you add resistors together, two resistors in parallel end up with a resistor less than the smallest of those resistors. So what it ends up actually seeing is two RA resistors. We've seen that before. So what it ends up being is the Raspberry Pi was telling chargers that I'm an audio adapter and you don't supply power to audio adapters. In fact, they can supply power to the device for charging. So the power supply just turns off. So now we sort of covered the basic communications channel which is an analog voltage line. As you want to start to go into the more advanced features, you need to use something called USB power delivery. So even though it's a power delivery in the title, it's also the method used to negotiate video methods, data methods, and similar. So on the screen, we've actually got the communications between my phone and my charger that I captured and effectively the charger says to the phone over the CC line, I can do five volt at three amp or nine volt at two amp. The phone then requests the higher power option. The charger accepts that, does the transition, and then confirms. So, Missy, how do you then pack all this data over the existing analog line? Thing is, as it's not directly tied to positive or negative voltage on each end, you can superimpose a digital signal on top of it and that's how you do these communications. I mentioned previously about the cables with RA in them. So, they contain a small chip that also communicates on that CC line. And the RA tells the host to power the cable. Thing is, you've already got power at the top of the cable so why do we need to supply power somewhere else? The catch is that if you're doing power delivery negotiations, the voltage on there can go up to 20 volts. And to save you trying to put all of the voltage conversion gear in the cable to convert down from that, instead, most cables will instead draw the power over the other CC pin, which gets powered by the host when they announce themselves that way. So, that was the cables that were causing these issues with the Pi 4 specifically. What we can do here is we now have digital marker in the cable. So, we can ask the cable, it's like, ah, are you capable of USB 3? Are you capable of higher current charging? All USB-C cables need to support 3 amp. However, 5 amp is optional, so you need a query for that. We now also get on to the alternate modes. So, with alternate mode, you do a USB power delivery negotiation and say, you query the other device and see what it can do. So, in the case of a laptop and a laptop dock, they would go, ah, can you do DisplayPort video? And the other side would confirm that it can. At that point, you then restart repurposing some of the pairs on the connector. So, as before, we've got the muxes to handle the rotation of the connector. But now, we can also use the pins in different ways. So, in the case of DisplayPort or Thunderbolt, you can use one pair and still have USB 3. Or you can use two pairs and just have a USB 2 connection. So, you end up with a somewhat complicated collection of muxes to do the switching. You then end up with, to control that, your standard CC control to detect which way up the cable is and control the first muxes. And then a power delivery control to actually deal with the negotiation and choose which mode that's in. Often, a lot of this can all end up being wrapped into a single IC on the board. But equally, you can also do it with separate chips much of the time. So, in terms of alternate modes, you've got the Thunderbolt, which will do PCI Express over those pins. There is DisplayPort, which even if you've got like USB-C to HDMI, it's probably using DisplayPort and then converting. Despite the fact there's another alternate mode for HDMI itself, but that's not been widely adopted. But equally, you can also just create your own custom docking protocol over it. So, some of the older laptop docks had the big connectors at the bottom. You can just use this and go, you know what, I need to repurpose those pins to be an Ethernet connector or normal Thunderbolt-based PCI Express or I'm gonna feed analog audio out of the super speeds pairs and still maintain my USB-2 connection. These are obviously not gonna work with all devices, but if you pair a device and they're docked together, it'll enable you to fit a lot of other things that would have required separate connectors into this one connector. So, some various final thoughts on USB-C. So, it has a lot of capabilities you've seen and most of them are relatively simple to implement at the basic end, which is actually quite useful because if you're building a cheap client device, you can just get away with two pull-down resistors. However, as you go up in device complexity, adding super speed, power delivery, alternate modes, the complexity will also increase, but that's not too bad because the cost of the devices that use those features are also increasing. Whereas in a device, if you'd had to go and pack all the features of a Thunderbolt interface into everything available, then we wouldn't be having a badge with the USB-C connector on it for this event. Also, it turns out that discovering bugs in USB-C things in various products is a great way to generate a really massive traffic spike on your website and end up in lots of newspapers. I'm going to sort of hang around outside the stage after this talk for if people have got any other questions or want to discuss other bits about USB type-C. So, I think that's all from the talk and yeah, if you want to come and have a chat with me afterwards, come and find me just outside.