 All right, let's talk about schematics. Why? Because a lot of people in Chrome OS write firmware, and they need to look at schematics. They don't need to understand how exactly it works, but they just need all the walk of the design to understand how things connect from point A to point B. When you first look at a schematic, it's pretty scary. But actually, we're not designing rockets here. We're just making Chromebooks. And we've done this for, well, I mean Chromebooks, maybe like 10 years or so, but laptops we've been doing for a very long time. There's no science here, and you can kind of break down the problem into little parts. So really, what you're looking at is you have a source where you're starting to look at the schematic. There's some a lot of exciting stuff, and then the destination. You don't have to look at 50 pages all at once. You just have to look at one wire at a time. So let's start from the way beginning. You have a battery. The schematic symbol for battery looks like one of those two things. There's a positive end and negative end. And our dear friend Benji decided that we would follow the flow of positive charge out of the battery. Turns out he was totally wrong. And the real answer is we should be following electrons. And that's called the electron flow model. And that's what electricity actually does. But it turns out we actually don't care. We're electrical engineers. We don't care if we go from B to A or A to B. We just care that your light bulb turns on. So we actually follow the wrong way. And we denote the way, so to speak. The positive terminal is usually a red wire, and the negative terminal is a black wire. That is not true for your house wiring. Do not try this at home. You'll get very unhappy results. The ground symbol down there is usually what we refer to as ground. It's drawn like this in the schematic. It's totally wrong. We use the wrong grounding symbols, but that's just how we do it. XKCD talks about this at length. You can go read the comic one of these days. So here's a real Chromebook battery. This is from a AMD Lenovo Chromebook. You can actually see the little wires there. You've got two reds and two blacks. So you already know, oh, yeah, the red wire is positive. So charge comes out of the battery on the red wires and goes through the entire Chromebook and comes back through the black wires. And in case you're blind or color blind, there's a nice symbol plus and minus on the pack for you. Too quick. On the right, that's the schematic equivalent. It doesn't look like a battery at all, because we're not actually putting a battery in the schematic. We have a connector that connects to the battery. So this is the symbol for connector. And you can see we've got some ground wires connecting to the battery pack. And there's a whole bunch of exciting stuff we put on all our schematic symbols. So you'll see things like the manufacturer, the part number, the number of pins in case you can't count. We have a Google part number, which is a part number we use to track all this information in an extremely slow database at Google. We have this thing, the J14. It's called a reference designator. We'll talk about that in a second. We have the actual schematics symbol and then there's ground down there. What is a reference designator? There are so many parts on these designs we have to be able to track each individual one from the schematic all the way to the real manifestation of itself. So this header, as we call it, is called J14. And J14 has its place on the printed circuit board. And that's what it looks like right there. And in real life, if you were to take a picture of the connector, you would see, oh, this is where J14 is. OK. So as you're tracing problems, you have to use these reference designators to find out where you need to look on the board. That's all there are. There's a whole bunch of different designators. These are kind of some of the ones you'll see. There is sort of a standard, but not really. People will screw it up all the time. You don't get dock points if you do it wrong. You just people look at you funny. The ones you'll see the most are Q, U, J, D, C, and R. Sometimes you'll see Y. OK, so from our battery connector, I'm going to expand the schematic a little bit. So now there's a whole bunch of wires and a whole bunch of text. This text is what we refer to as a net name. Each wire we give a name, and that allows us to track where this wire goes as it travels from point A to point B. There's a whole bunch of numbers next to it, and that tells us which sheet this net name will appear. Because unlike code where we have unlimited space, we still print on paper, which is absurd, and it drives me insane, but there's no good solution yet. So we still draw on individual sheets. So for instance, if you look at 28 on the top net name, it says 28 and 23. So on page 23, you'll see there's the net name there. And on page 28, it's there in two other places. And that helps us flip sheets and figure out where to look for this stuff. I'm going to go back a little bit. The bottom net is actually in bold, and it starts with PP. That's your telltale sign that this is not a digital line. It's a power line. And we have a very loose set of rules to describe how we name power nets. PP or PN. I've never seen a PN in a Chromebook, so you can more or less ignore that one. PP is the positive voltage. And then right after that, we give you the voltage that it is in millivolts. Or if the voltage varies, we'll call it VAR. And then afterwards is domain. And I just put a bunch of text there, but the truth is there's absolutely no standard. We totally mess this up all the time. It's completely inconsistent between every project. So it's just you. So the only important two things is the first two parameters. You can ignore the last one. So here's an example. PP 5,000 always. It's positive. It's 5 volts, and it's always on. So back to our schematic, we have PPVAR, BAT. So positive power, variable voltage, and it's the battery. All right. And it makes sense because a battery, as you charge and discharge it, it's voltage changes. And this is why it's PPVAR and not PP some known number. OK. Let's expand the schematic a little bit. I added some stuff in the upper corner here. Now we have a new rail. It's PP3,000 H1 always. So H1's our security chip. And then this tells us, OK, it's a 3.2 volt rails to the security chip, and it's always on. Great. Now we have these Quiggly things. We refer to those as resistors. And really, their sole purpose in life is to slow down circuits so that we don't get fun sparks. And I'll show you a video of what happens if you don't do that. All right. No, bad. OK, I screwed up. I clicked the wrong buttons. All right. This guy talks a lot. So he's using a wrench, which has a really, really small R, and he's shorting a big car battery. So if you basically have no resistance, and you were to plug in a battery in our Chromebook, this is what you would get, which I would argue would be an awesome product, but probably not what we strive to achieve here. And the way that it does this is it converts extra energy into heat. So whenever you have a heating element at home, and it gets really hot, or like your toaster, it's basically a glorified resistor that heats up and grills your toast. So we have a whole bunch of text next to the resistors as well. You see the reference design there on top starts with an R that tells us it's a resistor, in case you can't see the resistor symbol for some inexplicable reason. The next value is the resistance in ohms. So this one is a 5,000 ohm resistor, essentially. For reference, our body, if we're super sweaty, we're about at a kilo ohm. And if we're on the verge of dying of thirst, we're around anywhere from 100 to a mega ohm, which is why if you touch an outlet and you're super thirsty, you'll probably live. But if you touch an outlet and you just finish a marathon, you'll definitely feel the outlet. So the percent tells us how far off of that resistance we are, because we live in the real world, it's impossible to get an exact resistor. So this tells us that in this family, this is 1% error rates on the value of this resistance. And then the one below, the number below is 0201. That's the size of the resistor. And in electrical engineering, we use completely nonsensical measures. We use mills, which is 1,000th of an inch. So this is 2,000th of an inch by 1,000th of an inch. So it's pretty small. We have smaller, but I don't like to torture myself that way. And the last parameter is the wattage. It's how much heat it can dissipate without self-destructing. Typically, we don't show that in the schematic because the package size has a standard wattage rating for it. Now, asterisks, that's not always true, but for the sake of Chromebooks it is. And if, oh yeah, not quite there yet. Okay, so let's do a simple example. I have a battery, I have a resistor. Ohm's law, the super smart guy, figured out that the voltage across the resistor that will be burned as heat is equal to the current through times its resistance. So you can extrapolate that for power is the amount of heat it generates is the voltage times the current. So if we put a simple problem, you have five volts and one ohms in a 0201 package. You do the math, you end up with 25 watts of heat. Now, if you ever touched 100 watt light bulb, you know it's really hot. But 25 watts at 0201, you'll get this. This is what happens. And in other words, I get fired, right? So this resistor was, it's a quarter of a watt resistor and it was attached straight to on 20 volts. So this is what happens. So don't do this at home, folks. Come on, there it is, yeah. Okay, all right, so let's revisit this problem. Instead of one ohm, let's do 100K ohms, right? You do the math and you end up with 25 milliwatts of heat. That's way better. You don't get a chrome boy that goes on fire. Everyone's happy. All right, one more thing about resistors. We use this rule all the time and pretty much all the math I learned in college, I forgot, this is the only thing I use every day. It's the voltage divider. If you have two resistors and you have an input voltage at the top, you can figure out what the voltage is between those two resistors is going to be and that's the equation. I'm not gonna derive it for you. So suppose we have five volts, a two kilo ohm and a one kilo ohm, you do the math and in the middle there on V out, you'll get 1.66 volts, always. Okay, back to our schematic. Why do we have a zero ohm there? Why do we bother putting a resistor that has no resistance? This is absurd. Well, we work with printed circuit boards and printed circuit boards, you can't change them. So we get a printed circuit board and imagine I had to cut that line right there. Well, I get out an exacto knife and I very carefully cut and that's very painful and I cut myself and it takes a while. So we just put resistors everywhere that are zero ohm and then we can remove them and now we can rewire the printed circuit board. So you'll see a lot in the schematic, this DNS on there, that means do not stuff. In other words, don't put the part on. So yeah, I put it on the schematic but I actually don't put it on the printed circuit board when you make the printed circuit board. There's other names for this, do not populate, do not install and other ones that I haven't imagined yet. There's no standard here, so. Oh, I've seen asterisks, that's another one. Okay, so now let's expand our view a little bit here. There's these little bar looking things down there. Those are capacitors, the sole purpose in life is to store energy for later. So again, reference design here, it starts with the C and then some number. The values in Farads, the package size, this is 0402 so it's slightly bigger. 50 volts is the maximum you can put through this capacitor before it explodes and the temperature coefficient is something you can completely ignore, it's totally relevant. So if you go over 50 volts, this is what happens. Now it's worth noting that there's a whole bunch of different capacitors out there and they all fail in magically different ways. This is an electrolytic capacitor and it makes a lot of smoke and that's by design, it's called venting. The alternative is having it explode, like for real like a grenade and that's way worse. So the venting is as catastrophic as it looks, it's way better than the alternative. All right, so now we know about resistors and about capacitors, let me talk about the only filter you'll ever see in a Chromebook. This is called a low-pass filter also referred to as a step response of an RC. There's a fancy equation there, you can forget it. The only thing that's important is that it slows down how quickly electricity goes into the capacitor and it's a known, calculatable amount. So over time what will happen with a circuit like this is as your voltage will slowly ramp and the amount of current will start high and then slowly come down as the capacitor fills up. So in this schematic here that we're working on I expanded our view a little bit and look at that. There's an RC filter right there. Also yeah, low-pass filter. It's drawn a little differently, right? The power's on top, the resistor is vertical and the capacitor is vertical but that's exactly what that is. Okay, so now we've got these super complicated shapes done here, those are MOSFETs. This is a transistor and that's pretty much without transistors we can't do a whole lot. Asterix, we can talk about that later. Okay, the part on the left is called the gate. That's the control signal that turns your transistor on and off. The bottom part is called the source and the top one's called the drain. That arrow points into the gate and that tells us that the polarity of the MOSFET there's different types. You can almost always forget all kinds of polarities. The only one we ever deal with is NMOS, Asterix. We do deal with PMOS but you can ignore those. And those two lines connected together tells us where the source is in case the text isn't there. So again, transistor is the reference and it starts with a Q. The part number, there's the drain to source maximum voltage before the part lights on fire. The ohm value, we'll talk about that in a minute. There's a drain current, the amount of charge you can put through the part before it explodes and lights on fire. And then the package size is a whole different world that we won't get into. You can ignore it, it doesn't matter. These two parameters are fun because if you don't do that, so this is a 60 volt MOSFET and it's being overvoltaged with 120 volts from the utilities. This one decided to light on fire. Sometimes they explode like popcorn and it makes a popcorn sound. Does not smell nearly as good. MOSFETs are very complicated. They have a ton of parameters and the data sheets are pretty dense. But for the sake of just walking through schematic, the only thing that matters is the gate to source voltage, the resistance between the drain and the source. And this is always given in a data sheet for a part. And you can see that on the graph, I have my gate to source voltage and the horizontal axis and my resistance in the vertical axis. So the transistor has a very, very high resistance when the gate to source voltage is zero and as I increase the voltage, it precipitously drops and essentially becomes one ohm. So really what we have here is a voltage controlled resistor. The more I apply voltage to the gate to source, the lower the resistance. Okay, so let's apply this principle in practice. So here I drew a little circuit. I have an input on the left and my output's on the right. It's connected to a 1.8 volt rail to the EMMC storage device and its power is in S0, which means when the whole processor is up. It's connected to 100k ohms. Okay, so suppose I have zero volts on my input. The gate to source voltage, so the voltage between the zero and the source which is at the bottom here is zero. They're the same voltage, they're all zero. So I'm gonna call my resistance three mega ohms. What do we have here? We have a voltage divider. So let's do a voltage divider math. Turns out that our output is 1.74 volts. Awesome. Now if I put 1.8 volts on the input, my resistance goes down because I have a voltage controlled resistor. So let's say it's four ohms. You do the voltage divider stuff. You end up with 71 microvolts and putting this in a tabular form. If I give it zero, I get 1.7 volts. If I get 1.8 volts, I get essentially zero volts. I have an inverter. So the voltage I give it, it gives me the opposite on the way out. It could be useful stuff. And turns out we have an inverter right here. The battery pack has a resistor inside of it. We actually kind of annotate this form of schematic. We call these open drains and we'll actually change the net name to have an OD at the end of it. So whenever you see OD, you know, okay, it's got that kind of setup in there. And yeah, I won't go into why we call it open drain other than that's the drain we're referring to when we call it open drain. Okay, I kind of didn't talk about this little symbol guy, but let's talk about them now. This is a diode. It's called the body diode. Let's talk about diodes before we talk about body diodes. Diodes let current go towards where the arrow is pointing and blocks current when the arrow is not pointing. So if I have a 3.3 volt on one side and 1.8, the diode will turn on. And if I have the reverse, the diode will block that. Diodes, the reference business starts with a D. They have a maximum forward current. They have a reverse blocking current. And if you don't respect those, these are fun. They explode like grenades. They do not smell good either. Okay, so diodes in a perfect world would just do this and they wouldn't consume any power, but we don't live in a perfect world. So like a resistor, it'll convert some of that energy into heat and that causes the voltage to change from the inputs of the diode to the output. And we call that the forward voltage. So like as a contrived example, this is a little more involved. If we were to always pull one milliamp, the way that you look at these graphs is you have one milliamp, you go to the vertical axis, you find one milliamp, you come across, you come down and that'll tell you, okay, my forward voltage is 1.5 volts. So if I have five volts and I have a forward voltage of 1.5, if I were to take a multimeter and measure across the diode, I would see 1.5, which means on the other side, I would get 4.85 volts and the rest is lost as heat. So with our knowledge of resistors and diodes, let's look at this circuit. So I have 3.3 volts and I have a resistor and my inputs are on the left. If I give 3.3 volts on both of the inputs on the left, the diodes will block it because the voltages are the same. So all my energy is gonna come from the top and it's gonna go to the output and I get 3.3 volts. All right, I'll put that in the table. We'll keep track of that. All right, so now I'm gonna make the bottom diode. The input's gonna be at zero volts. What happens here is the top one gets blocked. The bottom one will conduct across and will develop a forward voltage. So my output now is gonna have the forward voltage. So I'm gonna put that in a table. The reverse, the same thing happens and then if I put all the zero, the same thing happens again. So I don't write code, but if I were to write code and my forward voltage was 0.15 volts, I could say if any voltage is above 2.7 volts, let's make this a high and if it's below one volt, let's make this a low. So I'm gonna convert this table into highs and lows and what do I get? I get an and. This is the world's cheapest AND gate and this is why we use it all the time. So this is a three input AND gate right here. We actually, in this particular case, you'll see an underscore L and this means that the signal is normally high and then when we do exciting stuff to it, it goes low and this is called active low hence the underscore L and we actually mix these together. So here we have an open drain active low signal. So we put ODL on it. Okay, back to our MOSFET, body diodes. It's an accidental result of the way that we make MOSFETs. Basically it's there, I won't go into the details. It's a terrible diode. If you, here it says if you apply three amps, you'll get a forward voltage drop of 2.5 volts which is awful. So we don't really use them as diodes, but we do cheat. This is an extremely common configuration and we use the body diode to make this work. So suppose, okay, let me take a step back. This is the end channel MOSFET because the arrow is pointing towards the gate. This tells us where the source is so now we know where all our good stuff is, drain source gate. Okay, inputs on the left, outputs on the right. Suppose I put 1.8 volts here. I have a gate to source voltage of zero because I have 1.8 of the gate. My resistance here is extremely high. We have yet another voltage divider and most of the energy is gonna go to the output and because my output is 3.3 volts, I have 3.3 volts on the output. If I put zero here on the input, my transistor will turn on. My resistance is very low. I have the voltage divider in the opposite direction so I get zero on the output. Okay, really what we have here is a level shifter. If I, my signal's a ground, the output's a ground. If I give 1.8 volts, I have a 3.3 on the output. We use this kind of level shifting all the time. Now, this is actually kind of a cool circuit because you can flip the input and the outputs. So if I do 3.3 volts here, it gets blocked by the diode. Ah, I knew the diode was useful. Okay, so then we get the output at 1.8 volts. So we level shifted the other way. If I do zero volts here, things get a little complicated. The body diode will first turn on because it has 1.8 volts on the one side and zero on the output, right? We develop a forward voltage here. That means that our gate to source voltage will be 1.8 volts minus the forward voltage, which means that the transistor's starting to turn on, which means the resistance of the transistor is starting to turn on, starting to decrease, sorry. And now we apply Ohm's law. We know that the voltage is equivalent to the current times the resistance. So if my resistance goes down, my voltage goes down. So now instead of forward voltage, I have the voltage across that resistor on the MOSFET, which means that my gate to source voltage is going up, which means that resistance is going down and this keeps going forever until the transistor's fully turned on and then we have zero volts on the output. Basically, we have zero volts and now we have a bi-directional level shifter, right? I can consider the A or the B side of the inputs and then the outputs will be level shifted. So hey, now we can look at a really complicated schematic and see, oh look, there's a level to shifter here, there's a level shifter here, there's a level shifter here. And we can look at even the other one and we see everything that we've talked about. We have a level shifter here, we have an inverter here, we have a low pass filter here, we have another inverter here, we have an AND gate here, a level shift and an AND gate. See, not so hard. Now you're gonna walk schematics. Congratulations.