STM32 PCB Design - Complete Walkthrough - Altium Designer & JLCPCB - Phil's Lab #41

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in a previous video on my channel i made a board design video with about three hours of length that's become quite popular regarding keycad and stm32 hardware design including the schematic design pcb layout and then actually ordering a glc pcb with assembly today i'd like to do an updated version of this video pretty much raw and unedited but also in altum designer this time so you can compare the design flows within keycad and altium this will be good for beginners looking into embedded systems and so forth i'll add sm32f4 based microcontroller usb connectors sensors and so forth so the whole design flow from start to finish i've previously made quite a lot of stm32 based boards for example the latest one here is this little brain board containing various sensors peripherals and a very small package i also have different videos on my channel regarding the firmware development for stm32 so hopefully this channel can give you a bit of an overview of what it's like to start with embedded system design here just a couple other boards that might include gps sd cards different modules and these are all boards i've designed for example this digital signal processing border here and a smaller version over here we'll be using glc pcb who are also the sponsor of this video we'll be using their parts library getting the board assembled and manufactured by them and i'll show you all the steps that we need to do remember this is but that this video will be pretty much unedited so i'm sorry for any speech mistakes and so forth but i hope this gives you a nice overview of how to design a board and of course i'll leave time strengths in the description thank you also to altium for sponsoring this video altium is actually offering a free trial version of autumn designer the software i'll be showing in this video it would help me out a lot if you go to altum.com yt phil's lab and i believe you can get a 30-day trial and i'll show you in this video what altum is all about so the parts that i've selected for this video if you go to jlcpc.com parts they actually have a huge parts catalog so let me just quickly show you that so everything you can pretty much need diodes passive components sensors and so forth and i've picked out a couple that i would like to put together on a board the first and kind of the heart of the pcb being this stm32f4 microcontroller now currently we have the global chip shortcut going on which is a bit of a pain in the rear end so oftentimes these parts will get out of stock quite quickly but basically the principle for these stm32 microcontrollers stays the same i've also to this time go for a qfpn package which is a bit more difficult to then root and layout because all of the pads and pins are underneath so maybe something different for this video in comparison to other one if we look at the data sheet we can actually see what this part can do for us so it's a cortex m4 core it has a floating point unit quite a lot of flash a fair bit of ram usb which is really nice because we can then flash it via usb we can use it as a virtual com port and loads of different peripherals i'll show you how to set up this stm32 microcontroller late in the video with stm32 cube id and we can use that then to get all of the pin out now actually choosing the microcontroller or the suitable microcontroller for your purpose is pretty much a topic for a whole other video i've just selected this one because it's fairly powerful at the moment it isn't too expensive at about six dollars and there's a fair amount of stock since then we have our heart of our pcb we want to maybe attach something interesting to it just having a microcontroller on a pcb is pretty boring i've opted to add an mpu6050 which is a sensor which contains accelerometers and gyroscopes and is typically called an inertial measurement unit and we'll hook this up to the microcontroller via i squared c and add all of the necessary peripherals and passive components around it to power the board we'll need some sort of linear regulator or we could use for example a switching regulator i'm using a linear regulator and ldo because it's pretty inexpensive it's much easier to root and it'll save us a bit of time in this video for the sake of efficiency you would probably usually want to go with a switching regulator of course this depends completely on the scenario if you need lower noise what frequencies you're running out what power requirements what input voltage you have output voltage and so forth the reason i'm choosing ldo versal because of simplicity but also because i'll actually be using a micro usb connector to power this board so it'll give us five volts at usb in and we'll step that down using this regulator to 3.3 volts to then feed our remaining circuitry which includes the sm32f4 microcontroller which can run at 3.3 volts or rather anywhere upon 1.7 to 3.6 volts and we'll use 3.3 volts to feed this mpu-6050 so this is our these are pretty much the main parts of our design we have the microcontroller we have a sensor for example we have a linear regulator so step down our voltage and we have a connector with usb the nice thing is if we use this usb connector we can also get power but also the data lines and we saw before that this stm32f4 microcontroller actually supports usb all right and at the end of this design we will then upload it to jlc pcb i'll show you how to order it and get it fully assembled and shipped to your home so let's move over to autumn designer and again you can use this link to get a free trial and kind of follow along for yourself even if you might not be using autumn design at the end of the day i hope this video will still be useful to show you some hardware and pcb design tips so in autumn designer the first thing we need to do is go to file new project uh depending on what version of outcome design i have you might have things like version control but i'm just going to click local project and give it a name and save it in a certain folder let me call this altium stm32 example pcb for example you can add some parameters if you want to make it a bit neater but i'm just going to click create you can see on the left hand side here i now have an empty project so the way it works in autumn is you actually have to add schematic files library files and so forth to it the first thing i'm going to do is right click and add new to project and schematic you can segment your schematic so two different pages one could be power one could be the sm32 microcontroller one could be for the sensors one it could be for connectors and so on for the sake of simplicity and because our design won't be that big i will just put it on one schematic on the right hand side here we can change the sheet size just to make it fit in essence you always want to make it as readable as possible so if other people check your design you don't want them having to look around okay where the hell is this part we have to save this so i click save and here i'll just give it a name i will just call it uh ltm stm32 schematic for example say that and it's added to the project later on we'll also need to add a pcb design file which we'll do later one thing that is different from altium to keycad is the way the library system works in keycad we have libraries pre-installed with standard footprints and so forth in altium that is a bit more complicated or different rather we had can add our own libraries where we have to create our own footprints and so forth and schematic symbols but there's also this manufacturer part search so i could type in something with like stm32 press enter and every time i see this little green chip symbol i can right click and place the part and add it to my schematic without having to draw the schematic symbol or the footprint so it takes a bit of getting used to if you started out with keycad but i kind of prefer the altum version these days i've also created my own footprint and symbol libraries and so i'll add that now so i've right clicked on here and clicked add existing to project i have my existing footprint and schematic symbol libraries which i'll just add to this design and i will make these publicly available in my github repo i'll leave a link to that in the description below so you can see i have now added some footprint and schematic libraries so the schematic library if i just double click on that and wait for it to open is a collection of parts or symbols that we then place on the schematic the way it works in altium then is that you have to link each of these individual schematic components to actual footprints and you can see for example the 3d view down here of that specific item i can add manufacturer ids part numbers any other parameters i want over here even ibis or various other models typically i will always add a manufacturer name and a manufacturer part number the way i've done it personally also is added just very generic components like capacitors of a certain size and a certain voltage rating same for resistors and so forth and any more specific components for example this this flash memory i will create my own schematic symbol and footprint i have a video on my channel that describes how to create footprints and schematic symbols and i'll leave a link to that in the description below and i hope you can check that out before we move on but going back to the scm32 schematic i will actually use the manufacturer part search over here going back to glc i simply have to copy the part number and then copy it in here so sometimes unknowingly altium doesn't want to do copy paste so i'm just going to type it in f41 cu ceu6 and luckily it has this little green symbol on it that means we can place it on the pcb schematic so right click place it'll download it from a server i just click and there we go we have it in our schematic another way of doing it is i've installed this plugin i think this is the symaxis pcb library and you can click on that and then there's basically um just a database you can type in the model name of an fcm32 microcontroller click search and in that way you could also add it to the schematic if you can't find it anywhere else usually i would recommend making your own schematic symbols and footprints using the data sheet because you can just be sure that you've done the right job hopefully okay so we have the stm32f4 microcontroller over here so let's add the other parts and later we'll figure out the pin out to get an stm32f4 microcontroller up and running we need a couple different things we need decoupling capacitors that connect to the power pins we probably need a crystal oscillator even though an stm32 microcontroller has internal crystal oscillators usually but for things like uart where the timing is critical it's preferable to have an external crystal oscillator there's one called the hse which over here is at pho and ph one the pins and that's the high speed external crystal this will probably be something like 16 or 24 megahertz we also have an an lse which is a low speed external oscillator which is this osc32 at pins pc14 and pc15 this is used for the real-time clock typically i most of my designs only have the hse oscillator in this particular case this package has some other pins as well including this v cap one pin and if we look at the datasheet for the specific device we will see that this pin needs to be connected to a 2.2 microfarad low esr electric series resistance capacitor um to make sure that this pin functions correctly essentially this is some sort of regulator input output internal to the die of this mcu and you will find all this information in the data sheet and this will depend on the package but most of the stuff i'm talking about here will carry over to all of the other sem32 microcontroller packages some larger devices like the sm32h7 might have more pins they might have some power management pins and so forth but again all the information is usually in a reference design or in the data sheets itself so moving on let's add some power symbols and an algorithm that's up here in the middle so i can right click and place for example a vcc power port if i click tab i move to the right side which is the properties window i'll be running this microcontroller at plus 3.3 volts so i'll type in as a name press enter and i can move it around on schematic now i place it using left click and i can use control w to draw a wire so i'm drawing a wire here i'm connecting it to v ref v bat vdd and all the vdd pins now vrf plus is actually i believe to do with the analog part of this mcu so this will be the reference reference voltage for the analog to digital converters because of the simplicity of this design i will just be connecting this straight to 3.3 volts for more sensitive applications i would suggest using some sort of filter so that might be a ferrite bead or a small inductor to the slightly decouple or low pass filter the voltage at the vrf plus pins or the vdda pins the v the v bat pin if not used should be tied to the 3.3 volts or rather the system supply voltage you can also connect a battery in case vdd is down so the other supply rails are down you can still run the real-time clock using the v-vap pin on the other side we have the ground pad and we have these vss pins and these are for a ground connection so right click up here again place ground port i don't like having the ground name show under the symbol i think that's fairly obvious so i'm going to press tab and click this i over here to get rid of the ground name or other does the designator so move it somewhere click to place again ctrl w and i can connect all of this up there we go now the first thing we need to do again for every supply pin we need to supply a 100 nano farad decoupling capacitor and later on this will be placed really close to the actual package itself this is to help the chip actually source current from the supply because the power supply might have some inductance it might have some resistance and it can't get the current into the package fast enough so we have some need to have some local energy storage in the form of decoupling capacitors to help the chip out so i will go over to components on the left here and then go to my library which i created which is schematic lib phil's lab in my case i can search i would like to search for capacitor which i've called cap and i have various sizes here i would typically like to go for o42 which is i believe is the smaller size jlc pcb assembles and then i also have a voltage rating now the voltage rating should be at least double that of the voltage that is going to be across the capacitor that is the dc voltage capacitors typically have a voltage derating so the higher the voltage across the capacitor the lower the capacitance will actually be from its nominal value so i will typically go let's say with a 16 volt just to be safe so i'll drag that in i can press space to rotate double click over here on the value field and i can just type in a hundred n that's a hundred nanofarads or 0.1 microfarads i can move it over control w to connect it up and i need one two three four five of these so let me just copy ctrl c ctrl v five of these there we go now i can just move this over here by clicking and dragging what i typically also like to do and what is recommended on stm32 application notes is to add a bulk decoupling capacitor this might be something like 2.2 microfarads 4.7 microfarads or 10 microfarads now this capacitor doesn't have to be close to any of the supply pins it just has to be fairly close to the package itself it's called a bulk decoupling capacitor so let me add a larger package because typically larger packages will be it'll be easier to find larger value capacitances so i'll go with o603 again 16 volts drag that in space and let me put in maybe a 2.2 microfarad capacitor there we go now i will just connect that up nicely let me just move that up ctrl w as usual to connect everything up and then i need to copy my ground connection so ctrl c and i'll just copy one over here and connect all of the capacitors up there we go all right so remember 1 and 100 nano farad decoupling capacitor for each of the power supply pins plus a bulk decoupling capacitor now i've chosen 2.2 microfarads because i'm actually going to be using this capacitor copying it over here to connect to the vcap1 pin some of sem32 microcontrollers might have two vcap pins some might have none in this case i've got one and that needs to be connected to a low esr i haven't had problems if i disregard the esr part 2.2 microfarad capacitor so note that the vcap pins do not connect to 3.3 volts to any other supply it's essentially i believe an output for an internal regulator an important point is net labels so all of these pins when we later go to the routing stage will have the name or the net name 3.3 volts because they're all connected to 3.3 volts similarly here these pins will all have the net name ground gnd however if i just connect something to a pin or any component and don't give it a name it'll have like a net name like net name c201 for example now i come to to to actually laying out or rooting the board that's really annoying because i would like to know what does this actually connect to the way you can fix that is by pressing p and then we do net label so pn if i tab i can change the name of that net i will just call it mcu underscore vcap1 i can place it on it this means this whole wire here or this connection is now called mcu underscore v-cap one this tells me later in layout and routing that it's not just pin 22 of some random package it tells me it's the microcontroller v-cap one pin this makes my life so much easier especially when the designs get more complicated later on to actually lay out and root this board all right so now we have our main decoupling capacitors and so forth connected the next thing we need to look at are these pins over here and you'll find them i believe in all sm32 packages the boot zero pin is essentially there as an input either high or low to tell the stm32 microcontroller at startup if it should load its internal bootloader the bootloader means it can be reflashed via for example usb uart i squared c whatever this specific device supports if boot 0 is low the bootloader is not enabled and it'll just run the code that you've flashed it to if boot 0 is high it'll enable the internal bootloader so we can flash it via usb uart and so forth but it won't run the internal code unless boot zero is pulled low again and a reset of the device has been performed so because in this example i will just be using serial wire debug and we'll come back to that later what that actually is i will pull the boot zero pin down permanently you can either connect it directly to ground but i almost never do that unless i have space constraints so let me search for a resistor and i'll set to a resistor and an o42 package and i'll make that a 10k value resistor i connect a resistor to the boot zero pin pulling it low to ground because maybe during a debugging phase or if i'm not happy with my choice of the boot zero pin i wouldn't have to cut up this trace with like a little pen knife i can simply either desolder the resistor or just tie this pad on the layout high to actually enable the boot loader so i would always recommend just putting a resistor there or a switch toggling between high or low don't forget we actually need to call this pin something or this net and i'll call it mcu underscore boot 0. always label your nets so let's make it a bit neater then we have this end reset pin and the end reset pin this n means it's inverted logic so this device will reset if this pin is brought low if this pin is brought high or left floating this device will not reset and you might want to perform a hard reset in some user applications if it's stuck or god knows what now in most packages and i believe almost all packages for sm32 microcontrollers the end reset pin has an internal pull-up and this is fairly weak a couple of tens of kilo ohms and that's usually fine and and you don't have to worry about that to prevent spurious resets i typically add a hundred nano farad capacitor to ground essentially forming a small filtering or debouncing circuit and just to strengthen that pull-up internally i will add an extra pull-up externally usually 10 kilo ohms this is just to help prevent spurious resets we will actually connect the n-reset pin up later to the serial wire or debug probe header so the capacitor was to help just debounce this and reset pin a bit prevent spurious resets and i'm adding external resistor just to 3.3 volts to make sure you know we can strengthen the internal pull up remember this external circuitry is actually actually not strictly required again i'm adding a net name mcu underscore and reset okay so now we've done pretty much the main circuitry and this is almost enough to get it up and running of course we're missing the power supply and things like that but if we had that in place this would actually pretty much boot up because we won't want to use things such that require a bit more precise timing other than the internal oscillators i'm going to connect up this phone ph1 pins which are the ones for the high speed external crystal oscillator let's go to the datasheet briefly so if you go to jlcpc.com you can actually always find the date sheet which is quite neat and if you control f so search for hse i want to see what speeds this oscillator can actually run out or what crystals it supports and just by a quick look we can see it's anywhere from 4 to 26 megahertz so going back to the schematic i'm going to search for crystal in my own library and i already have a 24 megahertz crystal in place so i'm just going to use that remember the data sheet set up to 26 megahertz so 24 megahertz is fine and i believe glc pcb has quite a lot of them in stock let me just verify that actually so if i just type in 24 megahertz nice check in stock so there we go it's i think we have quite a few to choose from okay so let's just go with the 24 megahertz crystal so this if this component is flipped or not it doesn't really matter the crystal is pretty much symmetric so let me connect this up again ctrl w rooting it there and this one going over here so this is not enough i'm afraid we actually have to add some extra circuitry to the crystal this is in the form of load capacitors and possibly a feed resistor so let's talk about in just a second so the crystal whichever one we choose will have some sort of load capacitance written on the data sheet so let's try actually find one um let me just find a certain crystal maybe this one there we go here we have crystal and it might have a term such as cl which might be six peak of farads i'm not sure which one this has this one has 10 picofarads now the way we would determine the load capacitors and these are essentially capacitors which we connect in this way let me just show you in one second one over here and one over here and these are connected like this and then the other side to ground now we need to calculate a value for these two capacitors and that depends on the load capacitance of the specific crystal essentially we take the load capacitance of the crystal so in this case if they believe it was 10 picofarads we subtract some sort of stray capacitance maybe two three four or five picofarads and then we multiply that number by two so we start with ten picofarads we take off for example five picofarads that gives us five picofarads and we multiply that number by two which gives us 10 picofarads so i know that was a pretty loose explanation there is actually an application note from st and if you simply google for stm32 oscillator design guide the first thing that pops up will tell you all about what you need to know how to actually properly choose these load capacitor values how to choose a feed resistor and so forth and here you can actually see the connection so this is internal to the microcontroller this is external i've added some load capacitors and you can also add this external feed resistor i won't do it in this case because i've never really had a problem without it this feed resistor together with a load capacitor forms a low pass filter which can filter out higher harmonics higher than the crystal fundamental frequency as well as it can reduce the dry strength of this crystal because if you overdrive the crystal if this circuitry is too strong if you overdrive the crystal you'll get harmonics and these harmonics could influence the timing accuracy of the device or maybe even not make it work i haven't had problems so far but maybe it's also good practice to just add a zero ohm resistor in series actually let's just do that so if i just cut up my connections here i will find a resistor a 402 package just drag that in and that needs to be connected to ask out and i'll double click give it a value of o r if my resistance values are below one kilo ohm so i can't write like 1k 2k so forth i'll always add a capital r to the end just to make sure people know this is a resistance so resistance series and then i route that off to my load capacitor and on the other side that doesn't need a feed resistor zero ohms is really nice because essentially it's a short and if i feel like okay or if i know if i can measure that my circuit has actually been overdriven or that i need to add some more low pass filtering i can change this to maybe a 10 ohm 22 ohm or different resistor zero ohm resistors or do not place resistors are really really useful in circuit design let me just add the ground connections to the other side and the crystal package i think on pins two and four also has ground connections now i can't forget to add net names so again p n i will call it mcu us in and mcu us out now because i have the zero ohm resistor in series here this net name is not mcus out and i will need to give it one so you can see actually if i click on it on the top right here the net name is net c question mark underscore two so not very nice so let me copy and let me just call it crystal in there we go and make sure you actually align it properly because if i keep my net name here it's just very hard to read so make sure it's always aligned and nicely visible okay so now we've done our decoupling capacitors we've done our main circuitry for the bootloader and reset pins and we've added a high speed external crystal the next thing we need to do is then add some other circuitry this could be our sensors our power supply and so forth we'll later at the end stages do the pin out of this device okay so the next device i would like to add is this inertial measurement unit and this will hook up then to our microcontroller so mc mpu6050 i can look at the data sheet and i've used this several times before it's a pretty standard accelerometer and gyroscope inertial measurement unit and it this one uses i squared c if you go through the data sheet you can typically find some sort of block diagram or hardware design description it's usually close to the end but i'm let's see if i can find it so for example here you can see some sort of connection diagram but i'm actually looking for a different one this will tell you how to hook up this device and here it is after some searching it's page 22 and this is the typical operating circuit so we have the mpu6050 and these are the essential components to make this chip function again we need some sort of bypass or decoupling capacitors various ground data connections power connections and so forth this will also run off 3.3 volts so basically you just need to copy over this schematic into altium so in altium again i'm going to use the manufacturer part search i'm going to type in mpu 6050 there we go it's got the little green icon again right click place it'll download it and i can just place it there one thing i have to say with these uh manufacturer part search parts is i don't really like the pin description of these so normally i would put my power pins right at the top i put my ground pin at the bottom and various other pins grouped logically so if you look for example this package again i have a power pin down here some ground pins down here and some some the pins not entirely logically spaced out that's the thing if you make your own components your own schematic symbols you can decide that for yourself what you think is the best okay so let me just hook this up as according to the data sheet all right so i've pulled up the windows side by side normally i have two screens so i have for example the schematic or the datasheet on one side and i'll jump on the other side to make it easier but for the sake of this video i'm afraid everything has to be on one screen so i'm going to start with my ground connections pop that over here again because it's a qfn package it has a center pad in the middle which is typically called ep which is connected to ground then what else do we have we have 13 which is our vdd pin which can connect to 3.3 volts copy that space to rotate and that needs a hundred nanofarad capacitor or they write it to 0.1 microfarads just copy that over there we go and that needs a ground connection okay um what else do we have we need pin 10 which is here the reg out pin which is not connected to any supply again it's some sort of internal regulator again and it's connected also to a 100 nano farad capacitor drag that down and hook it up again i'm going to give it a little net name so p p and n then i'm going to call it imu underscore reg out so this is nice because it lets you distinguish between different packages so initial measurement unit is imu and mcu is over here this will help me out tremendously when it comes to routing and layout later we have v logic which is pin 8 for look on the data sheet that's a 10 nano farad capacitor and that is then called connected to v logic the reason it's v logic and not vdd is that actually we can run this device as mpu 6050 at different voltages so for example if our microcontroller runs at 1.8 volts i would connect this to the logic to 1.8 volts because that's our interface logic voltage whereas vdd is the supply voltage for the remainder of this chip but since we're running everything at 3.3 volts it makes our life a bit easier and v logic will just be tied to 3.3 volts with this 10 nano farad capacitor so let me just change that to 10 n whoops that's not right that's one n ten n again drawing some wires v logic and 3.3 volts space to rotate and because it's tied to 3.3 volts i don't need to give it a net name the net name is 3.3 volts we also have cp which is 2.29 farads and that is also some sort of internal regulator because it's not connected to any of our voltages so let me just rearrange this a bit just to make it a bit neater and that's 2.2 nano farads so let's do 2 and 2 so i could write 2.2 n but the dot is typically harder to read especially if the schematic turns a bit small just imagine trying to read a dot there so typically i will always write 2 and 2 instead of 2 dot 2 i connect to cp out that up here this again needs a net name so double click imu underscore cp out okay there we go and i think that is all the essential circuitry then we of course you have all the data connections so i squared c has two lines that's a that's the data and that's the clock line now you can configure the mpu 6050 to do some extra funky stuff they have auxiliary connections for another i squared c slave they have clock inputs clock outputs but if you look at the data sheet you can leave those pins floating the way you tell altium that it shouldn't care about that pins when we do a design rule check is to place a erc directive or electrical rules check directive so press p go to directives and generic no erc that means algae won't complain at us for leaving this pin unconnected uh so we can connect all the not connected pins over here and actually i believe the frame sync and clock in pins can be tied to ground and if we actually look on the data sheet there is this pin out and signal description this is always really useful to look at so if you look at pin one which is clock in it says optional external reference clock input connect to ground if unused okay then fsync which is here frame synchronization digital input connected ground of unused and we also have this ad0 pin and oftentimes you'll have that in i squared c packages and this tells the chip if it's high or low this 80 pin what the least significant bit of the ice would see slave address will be so the least significant bit will be a zero if it's tied to ground or a one if it's tied to 3.3 volts i will just fix that to zero because i'm not running any other of these devices on the same i squared c bus if i for example had two mpu 6050s on the same i squared c bus i would have to tie one of the pins to 80 and the one from the other device the other ad 0 pin to high to make sure there's no bus collisions and so forth so clock in ground of unused fsync ground if unused and ad0 is the least significant bit of this device so for connected to ground i believe that i squared c address and hex is ox-68 uh yes so i think that's it let's have a look about the aux so auxiliary we can just leave those floating so again p v n let's leave those floating the reserve pins says do not connect and then we also have this interrupt pin this interrupt pin can be configured to do various different things usually i use interrupt pins from things like sensors to tell me when there's data ready this way i can then the mcu can do whatever it wants and as soon as this interrupt pin goes high i connect that to a gpo interrupt and that'll tell the mcu okay data is ready start the read transfer so i will actually connect that up we can see the interrupt digital output is either totem pole or open drain because there's totem pole and we can select it to be totem pole we don't need to pull up if it were only open drain we would need to pull up resistor so i will place a net label and i will call that imu underscore int or imu interrupt place it there ctrl w to connect that up to the pin on the other side we have the i squared c clock and data lines all right so let me place net labels let me just make this big again so if i do p n and then tab i go to the properties of our net label in out you can see there's this thing called justification that's essentially where the anchor point of this net label is on the right side i will put on the right if i have it left of the component i'll have it on the left there we go and tab again i will call that imu scl and i will call it imusda so the naming for this can be a bit difficult because essentially these clock and data connections from the i squared c will go directly to the mcu not via any sort of series resistors or anything so it's the question what do you call them do you call them ie imuscl or do you call them mcu-scl in this case for such a simple design doesn't really matter i'm just going to call them imu scl for now so hook them up over here we'll come back to this but i squared c is an open drain um bus so the drivers are both open drain on either side and we need to place pull up resistors on the bus once we do the pin out assignment for this microcontroller we will add the imu i squared c puller resistors i typically like to place the i switched to put our resistors closer to the host which in this case is the sm32 microcontroller that's why i haven't included them at the imu here so remember we'll we still need to remember the i squared c plus resistors but we'll come back to that later effectively this is now all the circuitry that's required for the mpu6050 if we connect this up and we you know remember to connect the power supply and so forth this will actually boot up and run given that we've connected properly to the mcu i've just noticed i also made a mistake here i said not to do 2.2 u it's to u2 because it's harder to read there we go to you too i'm glad i caught that okay so let's look at the next bits we have to add we've added the stm32 microcontroller we've added the mpu6050 now of course we need some sort of power supply because we're going to be using this molex usb connector which will supply both data and power to the board we need to step the 5 volts coming from the usb rail down to 3.3 volts and i'll use this it's a not the greatest regulator because it has quite a high dropout voltage but it can do up to 800 milliamps current which is complete overkill for this scenario but it's such an easy simple package and it's so readily available that you know why not so going back to altium again using the usual search ams1117 3.3 volt version we have the little chip icon here right click place there we go and this is our voltage regulator let me just if i drag my mouse and i can just move these components around just to organize them a bit nicer so we have that and the voltage regulator up here at the end when we're done with the schematic we'll actually draw some bounding boxes around these parts just to segment segment them a bit a bit better now our power input will actually be coming from this usb connector so i'm going to copy the part number let's hope it works of course it doesn't so four seven three four six 001 there we go luckily it's also green which means you can right click and place and we have a connector so the flow will be we have this usb connector we'll connect the power and ground to our circuitry and the data lines to the microcontroller so let's get started with the usb connector we have various mounting holes and these mounting holes depend on if you're using your device as a device a usb device or usb host now i would recommend if it's a usb host to connect the mounting holes uh to ground essentially the mounting holes are the shield if it's a device you typically i believe want to leave these floating so i'll do another directive telling altum to not care that i'm leaving these floating oops there we go so if it's a device leave the shield floating if it's a host ground the shield and there's various opinions on that on the internet but this is certainly well so far i'm connected ground to ground and my v bus is going to be roughly 4.5 to 5 volts so i can place a vcc port and i'll actually call that remember to click this little i to show it the name i will call that v bus just to indicate okay this is the raw voltage so to speak coming from the usb device the bus now the id pin as well we will leave that floating id pin is used in on-the-go applications so you can switch between hosts and device but since we're only going to be a device we don't need to connect this id pin now usb power supplies are pretty noisy so let's put in a pi filter which is essentially a capacitor resistor or inductor or therapeutic capacitor and this will clean up our power supply just a bit before we feed that into the regulator so let me go to components and look for a bead which is a ferrite bead so it's inductive up to a certain frequency then it's resistive over its intended frequency range and then it becomes capacitive so essentially it dissipates you could say noise energy very loosely speaking is heat typically and third bead choosing ferro beads is actually quite a complicated topic and i'll leave some links in the description of how to properly choose a third bead you want to size it for an appropriate dc bias current so the current that it's actually drawn from the supply you want to cover a specific frequency range and it's actually fairly difficult to choose it properly for the really simple applications like this you can get away with just using um i know 30 milli ohm 120 ohm uh ferrite bead connected like this and we'll make it into a pi filter by using these 2.2 microfarad capacitors either side connect it up like this and this will filter at least to a certain extent the voltage coming from our noisy supply rail from the usb line now typically with connectors you also want to provide some sort of esd protection and this could be in the form of some sort of tvs diodes so i have for example like a tvs died over here and you would place that before any other components and connect that for example between v bus and ground and you want to do that pretty much on all connectors and then place these components close to the connector as possible for the sake of simplicity i won't be doing it in this video choosing tvs diets is another whole video topic in itself and also keep in mind that a lot of these packages for example the sm32 microcontroller or some of these regulators will have a limited but they will have an amount of esd protection inside so far i haven't had any problems assuming you handle the boards the receive boards fairly fairly well with any esd damage or anything like that but i would always advise to add esd protection in this case i'm not doing it for the sake of time and because choosing esd devices does require a bit more time more than we have in this video but also to remember look at the specs for the esd protection of each of these devices and make sure you add them to connectors so i also want to add then a power flag so it's going to be plus 5 volts nominally after we filtered it so we get our v bus in we filter it using this pi network and we get 5 volts out and this 5 volts will then be fed into our low dropout linear regulator because we'll also be using a usb we will have to hook up these usb differential pair to our microcontroller later when we do the pin out but i can only give them a net name now so press p n tab change the anchor and i will call it usb d n now i'm doing underscore n and here i'm doing underscore p because that is one requirement to tell altium that this will be a differential pair another thing i have to do let me just move this over here is then add a directive so i can press p go to directives differential pair so i would just place one you can see the squeaky line means altum is not liking something and it means it hasn't found the other differential pair i need to copy it and put it over here so now autumn is happy and i've marked that this is a differential pair and we'll need that later when we do the routing another thing you can do and i typically do if i have many different differential pairs in my design for example usb 2. i might have some hdmi running and you can give them differential pair net classes so i might call it diff usb over here and then i'll copy that so they make sure they both have the same differential pair net class this is important because if i have many different types of differential data lines that need different characteristic impedances i can tell altium later on to say okay root this with 90 ohms root this with 100 ohms and so forth so that's pretty much our usb connector again esd protection when you're making proper so to speak designs so now we will feed that filtered five volts into our load dropout regulator let's just actually go to the data sheet for the ams-1117 let's go over here because we need to place input and output decoupling capacitors so you can see scan through the datasheet what is required and so forth it actually turns out that you need 22 microfarad capacitors there we go over here typically you need 22 microfarad tantalum capacitors at the input and at the output now tantalum capacitors are pretty nasty and they can light up in flames i guess fairly easily that's why ceramic ceramic capacitors are actually more than fine 22 microfarad is quite a large capacitance for small ceramic ceramic capacitors so using o603 or o42 isn't probably the right choice for 22 microfarads i typically go with at least 0-805 again i'm just going to choose 16 volts just to cover myself so i will change that to 22 microfarads so we connect that to 5 volts 22 microfarads of the input and 22 microfarads at the output there we go now i need to connect up all my grounds and that's it so our usb connector provides a differential data pair which will later hook up to the mcu we have a fairly noisy supply rail we filter using this pi network again it's quite involved to choose a pi network we get roughly five volts here feeding into our linear regulator which has a dropout voltage of 1.3 volts meaning the input voltage has to be at least 1.3 volts higher than the output so 3.3 plus 1.3 is 4.6 so we should be pretty much safe as long as the usb supply rail doesn't drop below that and we get 3.3 volts out here so finally we can hook up 3.3 volts to the output here there we go now what i like to do especially for like test and development boards is add a small led to show me okay there is some form of power at the output here so i will look for led and i like a green one to indicate that i have power so i'll hook the anob anode up to my 3.3 volts and i need a current limiting resistor on the other side and an 0402 resistor is just fine you have to make sure that the power rating is sufficient but i typically run my leds if i don't want them to burn my eyes out at about two milliamps or like one or two just a couple milliamps not something like 10 or 20 milliamps i think is very bright for these purposes again depends on the scenario so typically i will go with something like a killer ohm or 560 ohms and that is just to indicate okay once i plugged in usb do i get some sort of voltage at the output here of course this could be five volts it could be some some other voltage that doesn't make sure or doesn't mean that this regulator is necessarily working correctly but it's some sort of indicator that we have some form of power now a mistake would be just to leave it because this net does not have a name again i will press p n place a net name here and we'll call it led underscore power and that's k for cathode and i will make that small at about six just to make sure it fits a bit nicer and doesn't cover the led there we go this way when we come to layout and routing we can actually see what this thing does okay so now we are almost ready to actually figure out the pin out for our device so let's go over to scm32 cube ide so stm32 cube ide is my preferred software development tool to actually program or do the pin outs for sm32 microcontrollers it's really easy to get applications up and running i have various videos on my channel of how to use this program and i'll show you now how we can figure out a pin out for our microcontroller so where we want to place i squared c where we might have want to have gpios if you want to have some external memory we can use this to do the pin out planning of course you can also just use the data sheet of the device itself but this in my eyes is far easier so make sure you download it it's free i have it here so file new s7 32 project wait till that loads and then you'll get this screen here which is the target selector now you can either choose a board you can choose a particular example but what we want is the mcu mpu selector and we'll type in the mcu are using which is the sm32f411 so s32 f411 and i believe it's a ce now you can see we have we can see what package it is how much flash it is ram and so forth this looks like the right one it's a qfpn48 package so click on that click next then we need to just give it a project name we'll just do altium stm32 example target line language doesn't matter for now so you can just click finish then the project will just be initialized created and then we'll be able to select our pin outs i'm not sure if i just recorded that so let me just do it again i'll go to new sm32 project it'll initialize the target selector we need to choose the stm32f411 microcontroller which you type in here in the part number 411ce we want to choose the uqf ufqfpn48 package it's quite a mouthful then click next we give it a name altium stm32 this doesn't really matter for now just click finish and we get this initialize in device configuration tool and we're able to select the pin out in just a second so here we have this view of the package itself and this is really neat so we can see things for example like the the power pins over here we see the device specific pins such as the boot zero for the boot loader the reset pins and so forth so what we need to do we can either click on individual pins and we can see what they might be able to do gpr inputs analog pins oscillator pins maybe something like uart or timer channels and this is how we then can select our pin out another way of doing it is going over here on the left hand side and then going through various menus here so we can see if you click on connectivity the device can do all of these functions maybe not all of them at the same time and that's what you have to figure out if you have a more complicated product we will need i squared c and i will just go with i squared c one if i click on it choose i squared c and it'll choose these pins for me i can also control click on the pins and see alternate positions of these pins in case i'm not happy with the pin out i can move them around a tiny bit if i don't like where the i squared c pins are because maybe they're too close to the boot zero pin i can just choose a different i squared c bus for example here the pins are spread out a bit maybe i can move them and things like that so you can just have a bit of a play around but basically let's just stick with iso c1 for the sake of simplicity of course we have so this will hook up to our imu and of course we have a high speed external oscillator so if you go to rcc on the system core we go to high speed clock hse click and crystal ceramic resonator and this enables the pho and ph1 pins later on you will then go to the clock configuration tab over here type in your input frequency i believe for us that was 24 megahertz choose hse and then you can set up things for example the clock frequencies and so forth basically you can type in for example 100 click enter and it'll try and find a solution for you but this is later when we for example want to program this device it's not really necessary for pin configuration but it's nice to use this to verify that our clock or crystal frequency actually makes sure we can run at the desired speeds so back in the pin out in configuration we have configured the imu i squared c interface we have configured the the clock we also need our debug interface because i've pulled boot zero low meaning i've disabled internal bootloader we can only program this device unless we pull boot zero high via serial wire debug or jtag so in sys click on debug and i will enable trace asynchronous zero wire debug basically there's zero wire which enables these two pins which is the data pin and the clock pin for the debug probe or if i click on this one i get a third pin which is a trace output and this lets me plot variables and do other stuff typically it's okay just to have the zero wired dio and the clock pins but if you have the space you might as well root this one out as well okay so what else did we have in our design uh i think that's pretty much it um what else we need oh yeah the imu interrupt pin which should be an interrupt pin on the i'm on the microcontroller so ideally that should be close to the ice with c pins because i'm imagining the mcu is here the imu will be over here to keep the eye squat c lines short so let me put an interrupt pin for example i don't know we could do at pb8 pb8 i will choose as either an input but if i want to enable interrupts and able to fire them i have to click on gpio x i which is an external interrupt click on that i can also right click on these pins and enter user label and i will just call it imu underscore int this just improves the readability but does nothing really to the functionality just as a little tip you you also want to enable interrupts you also have to go to the interrupt controller and click this to enable the interrupts on that line so that's pretty much it what i like to do as well we could maybe include a little header or connector that root out roots out some of these other pins and these could be fairly random if you want to choose you could maybe choose some timer pins or or something else but basically i'm just going to make a little header and route them out to some pins down here just so you have a play with and you can see how you might be able to do that another thing i want to do is include some sort of debug led and i will just do that on pb13 chosen pretty much completely randomly i'll choose as a gpio output and i'll right click call it led i like to have at least one led on an mcu just when i first get the boards in first program that's the first thing i'll do i'll write a little program to just flash this led just to make sure at least okay the outside circuitry is somewhat working so now we have that we can transfer that over to altium so let me just do that so apologies for things being a bit small what we already have are these oscillator pins and that's over here we already have the boot zero the end reset what we need is the led let's start off with that so pb13 over here is the led again i search for led and how about a red one this time and again i need a current limiting resistor i will just choose 1k as well you need to make sure that the microcontroller can actually source or sync enough current that you need for led typically that's going to be a couple milliamps maybe five or eight milliamps max it depends on the device and on the pin so i typically just drive them with one or two milliamps and that's usually fine let me just create some space over here there we go and ground connection and hook that up to pb13 again ctrl w to make wires so let me just create some space for some net labels again press p n to create a net label i'll just call that mcu led cathode oh sorry that's the anode and i will call this the cathode again for the sake of rooting now these are overrunning everything so i am just going to change the font size to something like six or even smaller there we go this way we have a net label and we can this will help us out with layout and routing again current limiting resistor chosen fairly um large to make sure we're not over or drawing too much current from this pin which might destroy parts of the device okay so we have imu stuff over here so i can copy the labels from the inertial measurement unit these and move them to pb6 pb7 and pb8 which is on this side so i'll change the anchor just quickly all right 36 pb7 pb8 so pb6 was scl pb6 is scl pb7 is sda and pb8 is imu interrupt which is the input now remember i said i squared c is an open drain bus so we need to add pull up resistors and i wanted to do that on the host side so we can't forget that i'll look for some oh 402 resistors at a voltage of about 3.3 volts i typically go with 2.2 kilo ohm resistors both on the on the clock and on the data lines so let me just hook that up and this is sufficient also for i squared c fast mode in most cases you can try and go a bit higher if power consumption is an issue but this has worked fine for me so far so hook them up to 3.3 volts and that's it for the i squared c and for the imu parts now we also have the debug connections over here so that's pb3 let me just move that over here that's pb3 which is swo it's called so let's call it mcu underscore swo hook that up we have pa14 which is sw clock and that's over here again i have to change the anchor and that is going to be mcusw clock that was pa pa14 and we have pa 13 over here which is the data input output mcu underscore swdio okay that's just switched around so clock is 14 dio is 13. there we go all right so that is all the debug connections we have the crystal we have the imu and led i wanted to hook up just some random pins pretty much just to show you that you can just hook them up to a connector so i'll just choose pa4567 i think that should be fine and i will just press pn i type in mcu underscore pa4 and i can click and nicely enough if i have a number at the end of a net label altum will actually increment that number so pa 4 pa 5 pa 6 pa 7. there we go and of course the pin out depends entirely on your project depends on our timer needs and you might have to do some rearranging and mapping around i just want to show you a very very simple example of how you can select a pin out and how you can hook up some some really simple devices now we have some unconnected nets what i'll do is again p v n for the electrical rules check i'm just going to put that on the unconnected pins so let me just do that a bit boring okay and that is almost it what we're missing now is actually some way to access the serowire debug connections the way i do that these days instead of using always a dedicated connector or a header is use this tag connect footprint essentially it's a little adapter cable for the st link and the st link is this little programming adapter which plugs in via usb to your computer and you can then pop that in with the swd connections to your scm32 based board and that lets you program debug and so forth now instead of using a dedicated header on your board i use just these pads to save space it saves costs i don't have to pay for a connector the tag connect adapter cable is fairly expensive but i think it's worth it because you save on space you save on connector costs and so forth so in the long run it's worth it so i've made a little footprint already in altgem so if i just look for tc 2030 it's a tech connect uh solderless header i'll just drag that in and we just essentially have to connect up vcc which is our 3.3 volts we need to connect up ground and all of the zero wire debug connections so it's the clock the data this and you don't have to you can also connect up the end reset signal to perform a harder reset of the device and i typically always do that but essentially for debugging all you need is pretty much just ground and the dio and clock signals but for the sake of completeness i like to include everything you never know when you might need these other signals and this header is essentially our debug or programming header again if we change the settings for the boot zero pin we could use usb to connect and that reminds me we haven't connected usb so let's go to sm32 cube ide this is almost the main thing so we can go to usb undergo full speed it which is the physical layer inside the chip click on mode and click on device only and that enables p11 which is d minus and pa 12 which is data plus so p11 d minus let me copy that p11d minus p812 d plus there we go now we just have to hook that up so there we go remove the erc let me just double check p11 is d minus yes p12 is d plus okay who luckily spotted that and that's pretty much it now i said we have these connections here which you might want to connect up to a header i typically use these jstgh connectors which are clicking and locking fairly nice they're a bit hard to find these days but i have a footprint for it so let me just pop that in so jst it's a six pin header in altum if i hold it and drag i can press x to mirror and also uh why to mirror so i'll just move the designate over here i would advise to always place as many ground pins as there are signal pins but for the sake of time simplicity and because we have a low pin count i'm just going to provide one ground connection and one power connection to this connector but typically you always want some sort of return path for all your signals then i'll just copy this press x to mirror and then i can just connect it up and to change the anchor again as usual and then just place them and i can connect them to the visual pins what i could also do maybe to make a bit nicer neater is move the connector over here there we go and then just route that directly out and oftentimes this might be a neater way of then designing or rooting your schematics just to make sure you know okay instead of having this air jump from here down to here to connector i hook it up directly and i believe unless we've forgotten something that's pretty much it now you might want to provide series current limiting resistors between the mcu and this connector here just to prevent any short circuit or limit the short circuit current again you will want some sort of esd protection you might want to filter this 3.3 volt rail that any external noise isn't passed onto the board or vice versa but for the sake of time and simplicity i think we'll just leave it at this the next step is then to annotate the components so you can either do that manually by for example double clicking changing this to j1 j1 i'll get it right the third time let me just try j1 for example it's example therapy capacitor 1 capacitor 2 and so forth but you can also let altium do that for you the way to do that is to go to tools annotation and annotate schematics and then it'll propose a certain designator for each component you can choose the order of processing and so forth i typically prefer to just do it manually especially for smaller small schematic symbols i sometimes it can be messed up also in keycard it's a bit hard to get right the first time also how you've ordered your components on the page so i'm just going to do it manually for now so i've just updated all the i believe all of the component designators and we will see with an electrical rules check if i actually have an end so the next thing is to just clean up the schematic a bit i'll just do it pretty roughly now but it says you want to section things off for example there might be the power supply section that might be the imu there might be the mcu so i can just move this debug connector or the dark header down here just rearrange the schematic a tiny bit i don't think it'll look too pretty but let me just do a tiny bit then there's drawing tools in our trim so you can press p then drawing tools at the bottom and then line and then you can segment your schematics off a tiny bit so if i just click and draw it around and i can do this for all these individual sections and for the imu over here just fairly roughly you can also change line thicknesses and so on and for the mcu parts down here there we go okay another thing to do is maybe add some text so i'm just going to rearrange this there we go so we can do a press t and then text string and i can just type in for example usb connector and ldl regulator brackets plus 5 volts to 3.3 volts and this will just help me later on to say okay this section is all this uh the next section is doing this and so forth maybe make it a bit bigger you know you can spend quite a lot of time making it neat but it's oftentimes just worth segmenting your schematic making it look quite neat so microcontroller 1304 and let's say i know peripherals oh let's just no not peripherals okay and lastly we have the inertial measurement unit is the mpu6050 okay we might also depending on what needs you have i would typically also add the i squared c address and i believe for this device because we've pulled the address zero pin low it's ox it's eight so later when i get this board it's really easy or much quicker for me to just get started you know an sm32 cube id i don't need to read the data sheet again and figure out what the iso c address is and so forth i can also add other comments for example that the voltage here needs to be 1.3 volts higher than the output voltage or what the maximum current is of the device it's always useful just to provide as much detail as you can on the schematic because if other people want to read it or you haven't looked at it in five years you'll much be much quicker to realize what is actually going on of course i would also like to give this a title so i will just give this a title up here let's call it altium stm32 example board then make that large there we go you can see on the bottom right here we can also give the schematic a page name number title drawn by and so forth and that's of course good to fill out especially if you have multiple versions of this board if you have multiple schematic pages the way you do that is simply by adding a text string and you can say okay this is the altium just into the two example board i can say what the author was but you get the point so we're pretty much done with schematic the way to check it or perform an electrical rules check is to go to project and then right click and click validate now if no messages have come up we're probably pretty lucky but typically you would go to panels on the bottom right and click on messages there we go and this is essentially our electrical rules check you quite often will have warnings and errors things you've forgotten and maybe i have somewhere in the schematic which i haven't seen yet but for now the electrical rules check is looking quite good we just simply have a warning saying that the mcu boot zero pin has no driving source okay that's fair enough maybe it's defined as a as an input which it is by the looks of it and you know it's not being driven actively but you can ignore that because you know we know it's it's it's fine and other than that it's saying compile successful no arrows found which is great because we can move over to pcb layout and routing of course in the real world and when you're working on your own projects you should thoroughly check your schematic make sure the parts are right you've designated it right you've done the the the pin out correctly and so forth i haven't done it now because i'm doing this pretty much on the fly but make sure to check check check your schematics and every step you do so the next step then is to add the pcb document so we have a schematic but then of course you want to transfer all this onto an actual printed circuit board in altium we right click on the project add new to project and add pcb there we go and we get a blank pcb page we get various layers we have top bottom mechanical and overlay which is the top seal screen bottom overlay with bottom silk screen paste layers solder mask layers and so forth i of course need to save this file and i'm saving it in the same folder as everything else and calling it underscore pcb to make it easier to see there's some things i typically change if i go to project project options class generation i will turn off generate rooms and that's it there's a couple things we can do before we import all the components onto our pcb one of them is for example to define a board outline but the main thing is to set up our design rules and our layers and so forth so we go up here to design and rules and that'll load this document up here so we have various rules such as clearance if we can allow short circuits if we can check for incomplete connections and so forth and all of these you would pretty much import from your manufacturer so we'd go to glc pcb go to the capabilities section and then see okay what are the minimum drill holes i can use what i'm in the minimum via diameters the pad sizes the clearances and so forth all of that you would import into algum using this window over here i also just seen i need to change my units from mils to millimeters because i prefer working in millimeters at least when it comes to pcb layout so go to properties and click mm so going back to the design rules to start with the design rules i always say okay i want to check for incomplete connections i don't know why that's not default uh i don't want to allow short circuits clearance typically i will set everything to be about 0.2 and 0.2 millimeters gives me plenty of room from my actual clearances that i need according to jlc pcb um usually and that's usually fine but but i would i'd deeply advise just you know copy all the clearances over copy all all of these definitions over to altium or keycad or whatever you're using okay then i have things for example the width the routing width i will want my minimum and maximum widths to be 0.2 let's say that's far away from the manufacturer's capabilities and the maximum width at about one millimeter my preferred widths for signal traces is about 0.3 and i can add that in here so we also have differential pairs but we'll come to that a bit later because we're using differential pairs and we want to adhere to the usb 2 spec are we actually using a full layer board with impedance control to help me out with that this is this board is completely possible to root on two layers but i'd just like to show you how to do the power planes and so forth so that's why i'm going to do four layers and show you how to do uh impedance control as well there's polygon connect style so if we do power pause and ground pause i would like them all to be direct connect depending on your size or power ports and what connectors you're using using relief or thermal release can help with solder ability but for now i'm just going to leave that as a direct connect so i've done a really quick skim through all of these roots these design rules you should really take your time because this will determine the manufacturability of your pcb and how much it'll cost to manufacture and make sure you don't get caught out when you're about to order these boards we need to change this board to four layers the way you do that is design layer stack manager and wait for that to load and we want to choose a full layer board here we are on the layer stack manager i can go to tools and choose a preset of four layers then here we can actually have the ball definition so the stack up so we have the solder mask we have the type of surface finish we have what the copper is or the copper thickness on the layer one dielectrics and so forth if you're not particularly worried about it you can pretty much just leave it as it is if you're not doing anything like impedance control or anything this is probably fine if you're going to export the step model and you want a particular board thickness you will have to fill this out we will fill this out with what glc pcb offers as the impedance control boards so if i go to the control impedance pcb layer stack up wait for that to load i can see for this stack up this is what i need to import into altum so let me do this this is for a 1.6 millimeter board but let me just copy that over so we don't we only have one dielectric between the spaces the core is 1.065 millimeters thick the inner copper is a half ounce copper what else do we have we have 0.2 millimeter prepreg um i think that's about it we need to type in the dielectric constants of the material the core dielectric constant is 4.6 which is the core which is in the center and for the 7628 prepreg the dielectric constant is also 4.6 so let me just enter that here and this is useful then for calculating the impedances of the board so if i save that and go back to the ecb viewer you can see i now have four boards or four layers sorry now there is the type which is the plane layer in algium which in theory is a great idea the problem is that altium exports the gerbers as negatives for plane layers and i don't really like that one submitting that for gerber files so i will also make these signal layers and then draw my own planes on them let me just change that to half ounce copper there we go okay so now we have our board set up if we go back to pcb view we have the top layer we'll have an internal layer 1 internal layer 2 and the bottom layer in altium i can press 2 to be in the 2d view and press 3 to be in a 3d view and this will be helpful later on for checking the design but now we want to calculate our characteristic impedance remember i said we want to we have this differential pair for usb and we want to have a characteristic impedance of about 90 ohms the way to do that in altum is go down here to impedance then i would like to add an impedance profile i will choose my top will reference my inner layer and my bottom will reference the other in the layer so i'll choose those two on the right here in the properties window i will select the impedance profile is differential and a target impedance of 90 ohms which adheres to the usb spec now a trace gap i typically use at eight mils and apologies for mixing imperial metric and that gives me a width of 0.26 millimeters so i have a 0.26 millimeter track width with a track spacing of 0.2 millimeters i can confirm that or hopefully confirm that using glc's impedance calculator so i want 90 ohms four layers 1.6 millimeter outer layer and it's a differential pair using an eight mil not millimeter trace bait and that's 10.28 mils converting that to metric almost so got there in the end 10.28 mils is 0.261 millimeters and our gym is calculated fairly close at 0.26 millimeters given the tolerance 0.26 is is more than close so perfect so this is how we can use altium's internal stack up editor and the impedance calculator to give us the right characteristic impedances okay so that's what we need for usb later on so let's go back to the pcb the first thing to do before we can define some sort of board outline of course you might have some sort of board outline because it needs to fit an enclosure because your mechanical team tells you it needs to be this shape or god knows what but let's start off by just importing the components so design import changes you can see these all the components and all the nets that will be imported then click on execute changes it'll import everything takes a bit and everything will be placed on the side here i can again press three to change my view and have a little look around so the first thing we need to do is then place all the components so we'll place the mcu we'll place all the components around that we'll place the imu all the components around that once we have the layout the rough layout we can then define the board outline because if i kept the board this size and i have only these components i mean that'll look ridiculous and it will cost much more to manufacture so if i don't have a specific or set board outline i will place my components first see approximately what space i need then i will make the board outline and that's what we're going to be doing now i will start off with my centerpiece which is u2 which is our mcu and i will drag that somewhere on the pcb i can press g on my keyboard and change my grid size so this is it'll snap to grid i typically go with with initial placement like a millimeter or half a millimeter so if i move it around it'll be on a grid of 0.5 millimeters as you can see on the bottom left here i always switch to the 3d view quite frequently first of all because it looks cool and secondly because you know then i can actually check my placement if things are close enough if it's solderable if you know i can get in between with debug probes and so forth what i like to do is have a split screen view so on one screen i'll have this pcb and on the other screen i'll have the schematic this way i can work through section by section i could for example do the power section make sure okay i need to put these close to each other i need to put this capacitor close to this component this capacitor close to this component and i'll do section by section once i've done the sections i can then link them up so to speak so let's do that here it's going to be a bit cramped unfortunately because of the single screen but let's give it a try okay so i've now made two windows out and the way you do that is hold the document of the tab here and just drag it out somewhere and that will create two windows and you can have them side by side and this is where i really recommend having two or more screens so i'm just going to start with mcu you could start with the power supply you could start with inertial measurement unit but i typically always start with the heart of the board and the first thing to do is the decoupling capacitors starting with the local ones not the bulk one so i will do c8 9 10 11 and 12. so i can typically click on them there's cross annotation in altium so if i click on one of these components you can see on the left side it highlights the one i've selected in the schematic and this is really useful because i can select multiple components for example c8 to c12 and then they're all selected in this editor as well there we go and i can just move them around sometimes layers can be a bit annoying for example i have this assembly layer in pink and i might want to disable that so i can go down to this layer view over here right click on a layer and click hide to get rid of that for example again i can click on this thing over here which brings up this view on the left and i can use this eye symbol to hide or unhide layers but let's get started with placement so remember local decoupling capacitors as close as possible to the relevant power supply pins so we have at one pin 1 pin 9 24 pin 36 and pin 38 so i'll just do it in sequence starting with pin one so i'll move it over here again my grid is 0.5 which might be a bit too coarse so again i can press g 0.25 and fairly close to the package i don't want to go like this close because if i go to my 3d view that's almost in my package i'm going to have loads of problems with shorts and clearances so close the package but like you know not ridiculously close something like this is fine this is like i press ctrl m on my keyboard and click one point and another point it's the measure tool in outer and it's about 1.75 millimeters and that's that's that's pretty alright again you want to do your rough placement first this by no means my maybe the the final placement this is a very rough placement to get an idea and a feel for where things need to be should be and can be okay c9 goes to pin nine if i look on the right here again i hold the component and press space to rotate just like i did in the schematic view you can see my silk screen showing c9 is now in the component for some boards it's okay to have silk screen and very advisable and it's great for debugging and testing and programming and assembly i prefer my boards without silk screen so i can select a component which i'll just increase the view here click panels properties this brings up the property panel and then i can hide the designator so i click that and click on another component hide the designator and so on so once i've placed the component i typically hide the designator for deep to me this makes the board cleaner but of course there are several drawbacks so not including component designators on the board but for most cases it's it's pretty much fine as long as you document the assembly and the placements well enough so again two to change the view i can also use the rat's nest which are these see through or well almost see-through lines and they tell me okay where do these components maybe connect to for things such as power and ground of course we have multiple places so as soon as we move the component around these rats nests will move to other places so typically always have the schematic open to know exactly where the component needs to be placed so c10 which is the third one should be a pin 24 which is over here roughly hide the designator c11 and c12 i could just move like this so essentially i'm just dragging to move right pin 36 and 48 click high designator and the last one c12 should go to 48 which is over here all right there we go that's a rough initial placement of the decoupling capacitors and this is you know not too close we're not too far away for these pins so that's that's that's pretty decent what we need to place is also the bulk decoupling capacitor and that just has to be somewhere close to the device and let's see might move around a bit depending on you know where other devices go the next thing to do is also this decoupling capacitor which is c13 which connects to the vcat one pin so again move that over and that is pin 22 get rid of the designator move it over okay and again i can really see maybe i have to move this capacitor a bit to the right to make space for this v cap pin there we go maybe a bit more there we go something like this as an initial guess right this can always change and probably will change without the design things like the boot zero pin even though important you know for layout it doesn't matter pretty much where this resistor or where this connection is it's a dc signal it's no decoupling anything like that so that's not initially important what's more important is for example this crystal this should be fairly close to the device it should be away from other interfering devices it should be further away from things like connectors or other sensors so let's pick that out so that's y1 it's c5 c6 and r2 so i've selected all of them in the schematic and that way i can highlight them and drag them in my pcb view so let me just put them all together and they should be somewhere over here you can see my rat's nest says mcuskin mcu oscar out now again to reiterate the point why i labeled my nets i labeled my nets so i can know exactly okay this is not net x179 underscore two nine this tells me properly what the net name is and i can connect it up really nicely so i immediately know these pins have to go to my oscillator i have my series resistor which is our zero ohm resistor which you might want to switch out and that has to feed through now the crystal oscillator actually doesn't have to be as close as these decoupling capacitors it can be somewhere for example down here close enough but not you know as close as the decoupling capacitors you know out like this there and then out like that which creates stubs what i want is in line with the traces and you'll see that later when we do the routing so something like this for example this way i can root out root into the egg crystal in in there and this one i can root out underneath the crystal there and back into the device and this is something that just comes when you've done this a couple of times so close to the crystal itself not too close series resistor in the way and you know fairly close to the package i mean this is only what a couple of millimeters away and that's that's typically fine it's not like this is a particularly high speed signal it is sensitive um but this is typically a fine placement you can see qfn packages also on another note are a bit more difficult to root because the pa pitch of the pads is quite close and we can't really root underneath the package as you could with for example a qfp package the whole thing here is full of ground a whole grand pad so we can't root from here into the right we have to go out and this can be sometimes a bit more you know difficult with rooting these types of packages okay but anyway we have the crystals we have the decoupling capacitors we have the v cap pin now we can root or actually place things that are less important for example the led for example the end reset circuitry for example the pull up resistors those are secondary so to speak to things like decoupling capacitors and crystals so let's find those how about the boot zero resistor over here and i believe that goes somewhere up here placement of this is really not critical i'm going to rotate it so it's like this the reason i'm doing that i could have done it like this you know so i can link up these ground connections i also have this interrupt pin over here so if i want to root out i'll have to do a via i have to dig down so i can just rotate it here to make sure i can route out my interrupt pin to the side and my boot zero pin out straight and these data pins and clock pins out to the right just planning ahead slightly and again this can be i mean this could be really far away for the sake of it it doesn't really matter where this resistor is but you know for the sake of being neat fairly close to the device but not as close as decoupling capacitors then we have things like the led and the current limiting resistor i might as well actually take all of this stuff and just move it closer so i always don't have to zoom out there we go so led and resistor that has to go somewhere here again that rat's nest is helping me where i need to place it or where it needs to connect to rather get rid of the designator you can see for the footprint of the led i've added this what do you call it just like this indication around it this always indicates to me that this is the cathode of the led for any device which has a polarity or a pin one location you need to mark that location on the sill screen for this qfn package the dot indicates that this is pin one for the led for this diode it marks that this is the cathode now there's different ways of marking it and there's standards for this but make sure that you do mark it again this is a not critical component i can see all these pins around it are not used so i can put it you know fairly close current limiting resistor fairly close and that's it i could also put the currently current limiting resist over here just to make it a neater that it doesn't jump out that much again press three to just check with a 3d view okay and now we have the n reset circuitry r7 and c14 now the end reset pin i believe is somewhere near the crystal which is a bit annoying which means you have to root the crystal out here and reset pin over here and we have this decoupling capacitor so what i do in this case is move the decoupling capacitor a bit lower this trace length is still fine i can root out the oscillator and i can root with a fairly thin trace and reset signal down and out over here so essentially and the reset circuitry should be placed you know maybe here on the other hand because the end reset signal together with the zero wire debug connections over here connect to this header and these connections are over here you know we actually automatically ultimately have to end ups over here so it might be better to place than reset circuitry you know up here somewhere this isn't critical it's an almost dc signal there's mcu and reset so we can pretty much place it where we want so in essence because i have my this is the debug header which i mentioned previously this solderless header and that connects all of the mcu's serial wire debug pins and that's going to be somewhere close to the serial clock so where debug and the sw opens so i'm going to place that somewhere over here and i said before the ncu and reset circuitry is also connected over there so we have to go from this pin somehow get over there so that's why i can place r7 and c14 over there again component designators get rid of that put the pull up resistor there and the capacitor to ground down there there we go 3d view again non-critical components and this is pretty much for you to decide what those are and the standard guidelines for it can be placed for other way then we lastly have these pull up resistors on the i squared c bus again i like to keep those close to the host r3 r4 so that one and that one i don't know why there's some artifacts here let's just do that okay so sda is on this side and scl is on that side so that way i can root out sda going past here into this resistor on the way and scl you know branch it out fairly quickly and go up here but we'll do that when we get to the rooting stage okay so that's i think pretty much it for the mcu we have the connector as well remember this gpio header over here and i can just place that fairly close to the device you know maybe somewhere down here and we'll fit the board outline then to this chip and to this circuitry okay so we can do the next part now i think that's pretty much it for this mcu so nothing too hard with regards to layout just remember decoupling capacitors close crystal fairly close um things like that the inertia measurement unit we could do next another qfn package so that's u3 so i'm just going to place that on its own little island for now and then we'll move that into place once we've placed the components around it so what this needs is essentially just the decoupling capacitors and that's it so c15 to c18 so c15 has to go to pin 13. where is that over there again close to the device we're not too close right if we go to the 3d view which i always find is very helpful if you're moving that part really close it's going to be really hard to solder you get shorts it'll be harder to debug if things go wrong so this kind of distance is perfectly adequate then we have for example pin 10 the c16 which should be down here space to rotate as usual and we also have eight next to it which is c17 c17 okay so you can pop that next to it in this case you have several options so you could either root it out like this ground and rig out and the 3.3 rods here what you could also do because this is a fairly non-critical part it's a very slow part um you can root it also like this so three and three rolls out here imu rig out like this and ground just connected to the internal or the the ground pad in the center so we could do that for simplicity remember to keep a bit of spacing between the parts this is not entirely optimal in terms of inductance because you want essentially the ground and three and three volt connections as close as possible and same with the imu rig out so ideally if we had smaller parts it would be something like this you know routing three through three rods here ground here rig out here and ground like that but it kind of depends on the scenario but actually let's just keep it like this for now so we have c18 which is imu cp out which goes to pin 20 which seems to be somewhere up here there we go you can see i can i can either have the component rotated like this or like this this is not good because it's in the way of sdn scl and it's not good because essentially the loop between i'm ucp out and ground might be more favorable in this way again keeping a bit of space between the pads and that's it for the layout pretty much of the inertial measurement unit now you want to see that the sda and scl lines are connected to the mcu and that means we have to move this whole section maybe somewhere over here i could put it up here but that would just increase the length of my board because i have a bit little square of space i can put it over here this is good because it's you know it's close to the mcu the data lines won't be too long and it's further away or far enough away from this crystal section over here we might want to play around with the placement of our sda and scl pull up resistors but we can figure that out when we get to routing this is a really really rough placement to start with you can see mcu crystal with the imu debug header and just gpo header over here this is really rough and we'll probably move that around a bit when we come to routing okay so the next thing we need um is the power circuitry which is over here so we have the usb connector we have this pi filter our low drop regulator and the power on the led so i don't really like the way altium or ever made this footprint made this footprint i don't like these pad sizes i think you know they're just on the edge of what what it should be the way you can change them on the fly is click on the part click this little symbol here this lock primitives which unlocks the primitives i can go to the top layer which is my top copper select the pads and i can change their shape for example i want to make them rectangular or round and i want to change the pad sizes because i think that there's just a tiny bit too small i'm just going to make them square this looks a bit better to me it helps with the soldering process and also this pad i want to change it doesn't look doesn't look too great again i can make that into a rectangular shape and just make it just you know just a tiny bit bigger does it look better yeah i think that's better all right once you're done with editing the part of course this isn't the optimum way of doing it but on the fly it's fine go back to primitives and click lock okay so c3 and c4 should be as close as possible to the part itself and c3 goes to pin 3 and remember your connections between ground and power it's not just placing you know five volts close to each other it's placing ground and five volts it's the entire loop same thing goes for 3.3 volts so we have two pins here two and four that are power but i'm placing it relative to ground i'm placing it you know kind of like this is semi-optimal again close to the package but not too close you don't want to have it like here so it's really hard to assemble so that looks alright we have the power led of course and that will be placed somewhere on the board doesn't really matter where current limiting resistor we'll place that when we get to it we have the usb connector of course um let me just move that here and the usb data connections come out of the mcu over here so 33 and 32 are the data connections and you can see they'll actually be nicely in line with this usb connector i'm going to give it a bit of space because i need to fit the power supply circuitry probably down here you can see the power pin v bus which needs to be filtered then it goes in the regulator so we can probably put the regulator somewhere down here let me move that so i can move this island so you see i'm doing it right i'm doing all these individual sections and then putting them together and figuring it out piece by piece so we have c1 c2 and the ferrite bead and that's going to form our pi filter so we have from v bus going into the capacitor and again we we didn't place any esd protection which you should but you have esd protection first more the connector then esd protection and then any filtering so that's what i'm doing here and i'm doing my pi filter like this leaving some space there we go so we would have the connector preferably esd protection our pi filter and then coming out from our pi filter into our regulator would be our supply voltage now i can rotate this to make sure that my five volts goes in there and that looks much better then we have to place our 3.3 or led and this could of course be right next to the regulator so let's just do that just grouping things like fairly logically together i think that looks kind of all right now we can't also forget things such as mounting holes because you might want to put this in an enclosure uh and it's always good to have fairly evenly spaced mounting holes so you might want to put one in each corner of the board and after that we can then make the board outline so i can move it around i'm going to change the grid size by pressing g and one millimeter and i'm going to put them in approximate positions and just copy that control c control v approximate positions for these mounting holes and i'll figure it out in just a second because we might want to move this header just a bit out to make it easily accessible we might want to move all this stuff actually a bit more to the right you know just just tuning the placement just just a tad i can press ctrl m to measure the distance between the mounting holes 33 millimeters ideally i would want to make it like 30 or something so that should be 30. 30 okay and ideally of course i'd want to make the same distance going to the bottom as well so 30 is that so i can just move this mounting hole down one and that should be thirty nine we go let me just check this so the control n command is very useful there we go i put them a little square another way of doing that is of course if you set your origin just to type in the xy coordinates so imagine we have our mounting holes here so our board line is going to be around those mounting holes and then we can actually adjust the position of all these connectors just to fit them fit everything let's put that in the way you can make an outline a really simple one you can either use it from a step file so a 3d model or you can draw it i typically draw it on for example to make a hana core one layer or doesn't really matter what layer so i can press p and then l or line and then i can start drawing my outline so i just click and i can draw my outline the way i can make the rounded corners is by holding shift and pressing space a couple times and then i can actually get rounded corners so i'll just i will fix the outline in just a second but let me just draw a really crude one here okay i want to place it of course further away from the mounting holes themselves so let me just actually redraw that i didn't do too well on the first try so let me try that again it's a bit further out there we go maybe somewhere this it's a bit better and here we go there so right click to cancel the command in outro you can change the radius here by clicking on the edge when you have a corner radius 1.27 millimeters for example uh just check if they're all the same 1 2 7 27 so this is probably okay as a board outline it might be too big the way you then actually set the board outline let me just move this out for a second is by selecting your outline i can select one part of it and press tab to select the rest go to design board shape define board shape from select object there we go press three and i can view okay now i've made a nice little board of that outline we can check the dimensions control m as usual it's a 36 square you know you can make it 40 just to make it sound a bit nicer but at least the mounting holes are spaced at a fairly nice distance so 30 millimeters each now now is the time to actually do a bit more fine tuning because the connector positions aren't very good you can see the lip of this connector is just about out of the pcb edge this connector over here you know it's so far away from the pcb edge that isn't great so the first thing to do maybe move this connector down a bit i don't want the copper of the connector to be that close to the board edge that's really hard to manufacture i can move the regulator around a bit i remember to keep things away from these mounting holes because the screw head will occupy some space around the mounting hole move my leds this connector i'll move out a bit to make sure you know that the lip of this connector is far enough away from the pcb edge so i can move that in a tiny bit a bit there we go always the 3d view is really nice to check to make sure mechanically everything is sound and this in this way i'm just doing a bit of fine tuning i'm just moving things where i believe it's probably good for routing and also accessibility for the user later on so that the the actual uh debug header make that fairly sensible and easy to access i can give myself a bit more room with the imu and the spacing just fairly intuitively dragging these things around and moving them around and this you know i probably have far too much space on this board um but just for the sake of showing the program and showing how to make a little pcb i think this is fair enough okay and we'll make this world a bit prettier with some more silk screen once we're done with the routing but pretty much now we can we can go over to the routing part um so one thing to do again is in the design rules we have the differential pairs routing routing design rule because we defined our impedance profile as differential 90 for the usb trace i'm just going to click that and use impedance profile for all differential pairs now given that our only differential pair is the usb trace this makes sense in different designs you want to set up different different differential pairs routing rules to make sure for hdmi you're using 100 ohms for usb using 90 ohms for csi using 85 ohms things like that click ok and then we can go to root interactive differential pair routing and route our usb pair and we can pretty much root that directly in there we go so you can see as soon as i come out of the pad it autumn tries to keep the spacing between them and we can route directly into the pads of our qfn package perfect so really simple you can see these are both pretty much the same length we don't have to do any length matching or anything like that so really really easy so we're trying to root critical things first this could include the usb differential pairs but it also includes things such as um the decoupling capacitor connections so let's do those first and in no particular order at least no particular order of the decoupling capacitors let's just start up here control w puts me into the routing mode in altium so i can click on a pad it'll root out if i press tab i can change the width of the track and for now 0.25 millimeters is pretty much the width of this pad of the qfn so absolutely fine i could either just root out and click in and these pads are connected another way to do it and maybe more elegantly is ctrl w a route out a bit and once i'm out of the pad i can increase the width of my track you know just gradually this is pretty nice when rooting qfn packages because i can start with a thick trace and root in to my pad and this looks i think quite cool and it actually helps with the connection reduces the inductance of the trace so for power traces you want thick wide tracks again control w i'm going to have a 0.5 millimeter track rooted in here if i press ctrl w i can change the way my track is rooted so you know what type of corners i want things like that i typically go with the 45 degree mode there we go same with my ground connection 7.5 millimeter width there we go really crude now for something as low speed and simple as this the way you route your power and ground as long as you're using wide traces decoupling capacitors close um to the relevant pins you'll probably get away with it so let's just start with 0.25 millimeters again i'm just kind of branching out getting it thick as i go outside the package there we go and i'm just going to continue this and root into the packages like this let me just actually clean that up a tiny bit it doesn't look too great so 0.25 millimeters rooting out changing to 0.3 millimeters just you know to get that extra big bit of thickness if i drag on a track i can move it around if i hold control i can kind of fine-tune my my tracks like that so i'm just going to do my my power connections first so let me do all of those again 0.25 millimeters going out changing to 0.3 or even 0.4 and rooting in let's do that again it wasn't too pretty and of course i can always change my grid sizes and and various things like that there we go 0.3 and rooting it out you can already see right here we might have a problem we can't really root the swdio trace out without a via the va won't fit in here we can't root past here so what we have to do is actually move this decoupling capacitor higher up so i click on trace tab delete tab delete and i can move it higher up this way i can route my swo trace out past the capacitor and then up to my connector so again i will have to then root out here i could also or root up here and then go like this but i know i'm just going to do this for now there we go and into the capacitor here and the same for my ground connection just change it to 0.3 and there we go again fine tuning a bit on the fly all right so we have some decoupling capacitors over here as well and this is pretty repetitive it's not the most exciting thing in the world but unfortunately needs to be done hopefully it'll get more interesting after we've done this part there we go always fine tuning on the fly just by dragging a bit making sure that our clearance between these is okay and you can see it's 0.2 millimeters which is just what we set in the rules so let's go through this rooting over here and in here okay so we have one more decoupling capacitor here doing the same old it doesn't look nice let's do that again and into that and the ground connection and that should hopefully be the last decoupling capacitor let's try that again there we go all right so fairly crude for the sake of this you can spend quite a bit of time actually doing this and we'll connect the ground and 3.3 volts up soon and we'll talk about internal power planes in a few minutes as well i wanted to finish my main connections however and that includes um the oscillators so let me root this out i'm actually going to use a fairly thin trace so 0.2 millimeters just so i have the the clearance to get past all of these so i'm going to root out and i'm actually going to root up a bit and then down i can press space to change my routing angle there we go and into the pad then i'm going to root this one out and as soon as i can i go away from the other trace i don't i want to keep the distance between two traces usually unless the differential pairs as far away as they can from each other with these qfn packages it's quite hard because the spacing is so narrow but as soon as i can i try to give myself a bit of space so i can change the angle here and then of course i also have my mcun reset and that's a bit unfortunate because i will have to actually put a via somewhere here but let's let's think about that in just a second all right then i have my crystal connections going in there we go and that's the reason why i placed the components like this i can root out in in in and no stubs there we go into there all right and we'll look at the ground connections uh once we talk about power planes so let me actually just place a via here so i can in l2 i can root out and then press the start button on my keyboard to place a via now you can see this is quite a chunky view and we actually start to set up the design rule for that so if you go to design rolls um where was it vias rooting via style the minimum via diameter we want is zero point uh let's say five five the maximum we'll put at 0.9 and preferred is going to be 0.7 that is the diameter of the via pad and the via hole size will do a minimum of zero point 0.25 a maximum of 0.4 and preferred is 0.3 and again these rules you will get from your manufacturer glc pcb has them on the capabilities section so now again if i go back to mcu reset route and press star i now want to choose my via and i will choose a fairly small one 0.6 via diameter via hole size of 0.25 and this is just so i can make it fit right here normally i want larger vias larger viewers are easier to manufacture to a certain extent and smaller years can cost more but i'm just making this via fairly small so i can fit here but also put a via here later for the ground connections so i'm just pre-planning so to speak i've routed mcu and reset out little via and they'll use that then to go over up here where it actually needs to end up later okay we also have these connections over here which is mcu pa4 to 7 which routes to our little header and i'll make those a bit larger now because i have more space again space to change my routing direction if i have these little kinks i'll just flatten them out by clicking and dragging giving myself plenty of space between these um traces i could also do something like this but that's ridiculous because i have so much space in in the design i want to space them out as far as i can to eliminate noise crosstalk and things like that not eliminate but at least reduce there we go so as soon as i can break out and break away from these that's what exactly what i want to do right as soon as i can break out i want to give myself space between these lines to minimize crosstalk there we go something like that so i'm doing it fairly crude for the sake of time and there's a lot you can optimize with this but for now this is fine also make sure you have plenty of clearance between pads and traces uh what else do we have we have the sierra wire debug connections which are fairly critical control w just root that out again drag the traces and pretty much as soon as you can you know get away from not relevant uh or not traces that need to be close to each other the clock line for serial debug needs to be rooted up here as well and the serial wire trace line as you can see i'm keeping as much distance as i can realistically or and aesthetically can i could root them like this where that's as i said pretty ridiculous you want to keep as much distance as you recently can between traces signal traces that is and also power traces then we have the ice good c lines clock as soon as i come out of the pin i'm going right to give myself space and i'm going into this pull-up resistor same with sda i'm giving myself a bit of a space then keeping space between the clock line there we go a typical guideline is between your inner layer or your next reference layer and your signal layer it should be about three times the width of that of that uh distance uh i believe what was it for us that distance let me just have a look 0.2 millimeters so should it at least be 0.6 millimeters of space between these traces so between here and here you know at least 0.6 millimeters i have 0.5 here so you know i could improve that a bit but there we go maybe just improve that a tiny bit give me a bit more space there we go for something as low speed and with fairly slow rise and fall times such as these so i'm i i squirt c lines it's pretty much okay mcu boot zero straight into that pad and as i pre-planned before the imu interrupt pin will go out left of that pad and to the left here again adjusting so i have ample space between pads and traces i also know i'm going to have to be placing a via somewhere around here maybe for the ground and power connections so that's why maybe i could i don't have to put my trace like this i can keep it out a bit further okay i will root up the ice with c connections in just a bit as well and also the imu i can just root out this led that's really non-critical over here of course i could also hear because it's you know it's carrying a couple milliamps but this trace is as wise as it needs to be it's a 0.25 millimeter is it 0.25 millimeter yeah 0.25 millimeter trace that can carry you know a couple hundred milliamps of current um so you know it's fair enough you can make these traces a bit bigger i could make this 0.4 millimeters but there's no real point okay so let's root up the imu again fairly white traces going between decoupling capacitors and relevant pads so what i'm doing here regulator out imu out there we go and ground and 3.3 volts fairly short wide traces is what we want all right we have short white traces to minimize our inductance then we have the ice would see scl and data lines have the data line here and the clock line and we'll need to use a via to jump over unfortunately you know the sda line goes like this and the sc air line has to cross it at some point so i need to use the via so i break out i immediately go down because i want to keep give myself space from the sda line go over here i can also press p and then v to place the vr and i'll make a 0.7 millimeter pad 0.3 millimeter drill and pop that over there then on the bottom layer which player 4 i can click here ctrl w to root and i root over here and p v to play severe and root on the top layer there we go so that's the way i can place vias so vias allow me to change between layers i've gone from the top layer here through over here through the board on the other side gone over this side and back up again to jump over this connection all right so we also have the imu interrupt pin over here i'll just root that like this it's a very non-critical signal it just goes high or low if the data is ready and i have all of these ground connections and things like that as well but we'll come to that in just a bit then reset connection over here so as you saw i did critical connections first decoupling capacitors uh crystals higher speed signals and then i do all the low speed stuff and all the power routing you can probably already tell that a full layer board is complete overkill for this design but i'm doing it to show you about internal ground layers and internal layers as well as how to route to control and piece and traces for example for this usb differential pair it's not strictly required because this is only usb full speed uh pretty slow and you know the distance is so short so it actually really doesn't matter it's just for example and because four layer boards have gotten so cheap so why not okay so now we have some the ground connections to root we have the power connections to root and so forth the way i typically like to route my power is with power or ground pulls power floods how you call them i can either root them as traces so just coming out you know and pop that in there or i can use the polygon feature which is a copper paw the way i do that is press p and then go to polygon paw a shortcut is p and then g and then i can essentially draw the outline of my polygon g to change the grid and then i start drawing like just as it is a polygon just draw essentially a break copper fill and i'm starting off with v bus and just making you know just a little connection here right click to finish and then i need to give it a net and i will call this view bus because it's i want to route all the v buses together click report and there we go i have a copper area that is connected to all these pads and this is really useful because for power we want pretty pretty wide traces to carry the current of course in this case we always have we have next to zero current being drawn or very little comparatively but typically i think it's good practice to try to maximize your trace widths or use copper or puddles to connect these things together so let me just do that for the rest here again i want to keep space between various copper paws or polygons as they're called right click to finish and just assign the net plus five volts press enter and then always report i will do the same thing for ground later on but let me get to that in just a second let me just do these remaining connections first you can see i actually need to link 5 volts here to the 5 volts down here if i've already made a polygon i can click modify and then modify the polygon so i can have it come out like this for example and just link that up as well so i'm doing it fairly crude you can be much nicer about this and not strictly necessary for this design to use it but i think it's fairly good practice there we go and then report to report and this way you you know you have a fairly wide connection of course this doesn't look very pretty at the moment and you can kind of widen it out you can play around with it a bit things like that uh you can definitely spend a fair bit of time time getting this you know to look somewhat decent but this is you know it'll do for now then we have our three 3.3 volt connections again just doing a fairly crude layout here we go three volts report there we go okay so now we've done kind of a little power section here with a trace of or some copper paws to link everything up okay so let's see what is to do next um i typically wouldn't connect things like leds or little resistors uh directly to the copper port you might have problems with solder ability so example here i will just do a little trace coming out the thing is if i now click on my copper port and report you see it's done this little notch the reason for that is in altium designer you have this option over here in the copper4 and you have to set that to pour over all same net objects and then recall and then you won't have that problem all right let's move that here there we go okay and i think we just have the n reset connection which we have to root over there and then we can do our ground and power routing so i clicked on my bottom layer and i'm rooting that as a 0.3 millimeter trace on the bottom layer over here and up actually let me just do it over here there we go yeah as you can see complete overkill using a four layer board we pretty much only have two traces rooting on the bottom and we could have easily done that on the top right i could have made a small jump here rooted around around the around the imu and into that and reset line that would have been fine as well but let's just do it like this for now so play severe connect that up and it roots into the our little zero wire debug header okay so what we're going to do now is actually on both internal layers we'll put ground planes i can double click on the layers i will call it l2 brackets ground this is typically my naming convention and l3 brackets ground i'll call my layer one double-click i'll just do l1 i'll call that signal and i'll call my bottom layer layer 4 also a signal layer now click on layer 2 my internal ground plane i will choose my grid to be 1 millimeter i'll press p and then g to start my copper paw now i will click control sorry shift space to change my corner style and just start drawing my outline for my internal ground plane once you're happy with that right click to end the command and you can see it's already poured it but it doesn't have a net so type in the net and report and i have a ground plane right and so this ground plane is a reference plane for all the signals that run above it similarly layer 3 will be the reference plane for all signals that run on layer 4. so i can do i can click on my layer to ground plane copy go to layer 3 and now i need to do edit paste special i want to paste it on the current layer and i want to keep the net name there we go paste i think it's shifted a bit unfortunately and it's not playing nice so let's try that i just have to adjust a bit there we go finally made it fit and report and now i also have a ground plane on layer 3 so i have signal top layer 2 is ground layer 3 is ground layer 4 signal now this stack up is really nice for signal integrity for emi because the top and bottom have a good reference plane to reference to for the return path you can see also i use the command shift s and that toggles the visibility of layers so once you outside having ground planes it's really annoying if you're on layer one and you want a root you have this big orange or whatever color that is plain underneath so if i press shift s i can okay just view the top plane shift s again really just view the top line and so forth so shift s is a great command and so forth once i've drawn my ground planes i don't need to see those layers anymore for now so i can right click hide right click hide that means i only have my you know interesting layers to view so to speak all right so the cool thing is now every time i have a ground connection i have a wide trace so i'll probably do 0.5 millimeters and i just press star on my keyboard so close to the pad but not this close not as close to the solder mask opening as you want just like here there we go i have a thick white trays going out from the pad in to the ground layers below this way i can connect all of my grounds up with a really low inductance path 0.5 millimeters start to drop a via or asterisk rather there we go and that's what i'm going to be doing for the rest so let me just do that for all of the ground connections so now i've pretty much added vias and short white traces to all of the ground connections you can see here so i have a ground pad i come up with a very short and wide trace and dig down into the internal ground planes this way these are all then connected together one thing i wanted to show you here with the power section again i have placed v as close to the pads but not too close and i'm not going to use traces i'm actually going to use a big copper paw to connect these up so let me just do that so again p and g and i'm just going to draw like what is called i believe like a power puddle just to link all of these together there we go almost there right click to end the command give it a net and click recall there we go so we have all these vias digging down into the internal ground planes uh we have this these copper balls over here and what's left to do we've done the connector is pretty much just the 3.3 volt power routing now oftentimes you also see designs and also show that my previous video on keycard sm32 ball design is using one of the internal layers as a 3.3 or whatever voltage you're running at a power plane and this is fine but i've typically moved on to just using ground planes and then routing my power for something as low speed as this that's completely fine once you start moving over to really high speed digital circuits you will need to have dedicated power planes and they all have you typically have a higher board count board layer counts as well so with this all i would then do is have a white trace coming out of the regulator typically from the actual bypass capacitor so i'll have something like i know let's say a millimeter is is pretty wide routing through the board and then linking up all these components so i might have to use vias as well and then also get narrower at certain places so i'll have to you know go down and then to 0.5 millimeters and then this way link up all my components and this is a perfectly viable or viable method of doing this so from the output capacitor of my uh regulator y trace is going over the board and hooking up to whatever i need 3.3 volts and then of course using vias to bridge gaps if i need to go underneath and so forth i could also alternatively also use the bottom plane just fill that with 3.3 volts and then dig down so why don't we do that we could the reason we might want to do that is that that might create a copper imbalance because we have maybe a large plane of copper down here we have limited copper up here and that might create some board warp so that's why i typically don't fill the signal layers with copper or if i do then i will do it symmetrically and just keep my two internal ground lanes for a full layer board so i will just finish up the routing for this 3.3 volt bus and i'll show you the result so here i've gone up from the regulator um just drawing a very wide and thick trace all around the board so let me just do that then when i have to jump i would do a via short white trace and vr up again now there's probably better ways of doing this more elegant ways but for this board that is absolutely fine so i'm just going around every time i need to branch off i can just do a short white trace getting larger and getting larger again into there now whatever someone says about right angle corners uh they're absolutely fine to use in pcb design so don't worry about that especially for power tracers there are some sections you're only doing power planes and you might have right angles and very high current power planes you might get some high much higher current density in those corners but for the most part it's it's probably okay to use right angle corners so this will be the last step of our routing and then we can actually get on to making this board or getting it manufactured so that's pretty cool so i'm always using tab to change my sizes of course you can make some nice rules and altum to do this automatically for you so if you're rooting 3.3 volts you can say okay you need to route this is a half a millimeter and so forth but i'm just doing it fairly manually i'm sure there's much better ways of doing this and of course the trace doesn't actually have to be this wide like a one millimeter trace can handle a considerable amount of current but if you have the space why not all right so again if i need to bridge a gap i can just place a via root on the bottom layer go over and another via to get to the top and then just root from the pad into that via for example again making sure i have a nice clearance between tracks and so forth you can see i can shoot from this via i want to continue on maybe going along here and just wiggling my way through the board now you probably don't have to make the well you really don't have to make the trace that wide because these are just pull up resistors they pretty much draw barely any current so we can get away actually using a thinner trace here and that will give us better tolerances or better clearances rather so we go here and just at the last moment i then narrow my trace down a bit to maybe 0.3 millimeters and this gives us better clearance for example and often this can be a bit fiddly but i'm sure we'll get there all right we got to that i'm just making sure i have enough clearance then i just need to root this power trace over there and i think then we have have it so in the way we make this a bit better even though this will create a a bit of a stub in the end reset line doesn't really matter because we can just root the end reset signal like this there we go this way we don't have to do a via to root the 3.3 volts we do have a bit of a stub getting here but it really really doesn't matter in this case i guess it's more of an ocd thing okay and we just go 3.3 volts here rooting over here getting a bit thicker again as usual and there we go and now that should have almost 3.3 volts all of them rooted we have this little jump here we have to make so again coming out increasing in width we can actually make this go up here little via and then we just jump that play severe make sure to select the right net and then effectively just root that out on the top layer just changed a bit here there we go and somehow that it's pretty crude it's not not the greatest but for the sake of time and just like a first pass i think that's okay we can view in 3d view of course you can see you know the signal traces are fairly thin as thin as they have to be or can be within the manufacturer's tolerances one thing i see here which you shouldn't do the ground plane should always be underneath um all traces even if it's something as a power trace so we might want to extend or make this track just a bit thinner there just to make sure the ground chase is completely underneath it so let me just adjust that so that's why the 3d view can be quite helpful as well as you just saw there we [Music] go see is that better let me just move that in a bit there we go now i started to report my ground planes as you can see there's the hole here from the previous via so the way to do that to report all ground planes is to go to tools polygon poles report we also have that ground that through my throat connection over here i'll just do a little jumper there there we go so as i said really crude nothing fancy nothing special but i think it does the job okay so that's pretty much all connections are rooted what we can do now is do um a designer check so we go to tools um design will check just run the designer check and we'll see okay actually we have quite a lot of design all problems let's go through them we have a clearance constraint because we've set actually our minimum clearance should be 0.2 across the board i just said that because it's really easy we have a whole size constraint minimum soda master and silk to solder mask we have no short circuits and no unrooted nets so that's already a first good sign let me just go a bit of messages bring that up again annoyingly it does that let me just try that again okay so let's just go through an example and see why they're probably okay with all these clearance constraints you can see the smallest clearance is 0.15 millimeters if we look at glc pcb capabilities that's actually well above their capabilities so that's fine we can change the design rule and then get rid of these clearance concerned errors the minimum the maximum hole size is uh 2.5 volt according to our rules we're using 3.2 millimeter holes we can just adjust the rule and get rid of that that's definitely not a constraint in glc pcb they're these things called solder mask slivers so how much solder mask is actually between the pants and right now there's no solder mask between the pants and this can be pretty bad because you can get solder bridges so during the soldering process these can bridge but as long as the stencil is made uh okay that you deposit enough or the right amount of solder paste this could be okay it depends on your manufacturer's capabilities how much swordmaster liver can be there right right now i've just kept the soda mask sliver at 0.254 millimeters which is huge and you need to check clc's website to see what they can actually do i know i've had the imu assembled before with these settings with these solder mask openings and slivers and also this mcu so actually we can ignore all these sliver constraints the last one is the silk to solder mask clearance so um we might have you know sword mask here solid mass openings here and a silk screen around it and altium doesn't like that and we can set up differences or rules for that and that's something you should do for the sake of time i know this design will work and this i have had these boards produce a glc and everything's gone fine but you should set up your design rules properly to match the manufacturer for the sake of time we won't do it now so let's move on so the design rules looks fine it's pretty much just warnings right now so what we need to do is make this board a bit neater maybe add you know a logo or something and add some text the way to do that is press two go to the top overlay place press p and then we can place a string so for example i want to give these connectors maybe names so i'll do zero while debug is this connect over here i can change the stroke width the text height and so forth i'll do that 1.5 millimeters and 0.25 millimeter stroke width so maybe that's a bit too large 3d viewer to check remember to not place any silk screen above holes so i'll make this a bit smaller just to keep myself a bit of clearance and i can change the alignment and so forth okay so sarah why debug it's always a good idea just to you know tell the user what different parts are then we have usb over here i can change the justification 3d viewer just to check if it looks somewhat decent then we have the gpio connector over here you know we might put that on top here and so forth you know you can add silk screen to your liking there we go i think that looks you know not great but not bad we can also place graphics so he plays place graphics and here we go i can choose my logo for example and then just align that somehow there we go put a logo on in png jpeg format whatever you have and you know of course component design uh indicators orientations you want a little circle and you want to indicate the diode directions and so on that's pretty much it for glc assembly we now need to add tooling holes you can of course have them add tooling holes but we'll just do it just copy one of these mounting holes place it somewhere um [Music] change the designated to th for tooling hole no net and it needs to be 1.152 pad and hull and you can place that somewhere where there's no tracks and opposite sides of the board and this is what they need for assembly there we go change that to no net these shouldn't be plated either let me just double check there we go then tools polygon polls report all and this makes sure all the ground pores are report and yeah so this is a really simple breakout board i think we're at about what two and a half hours now we've gotten this far now all we need to do is get this board ordered and then assembled by jlc pcb so for that we need to create the gerber files which are the board production files the builder materials and the component placement files and that's pretty straightforward to do so remember to run your desiral checks all this kind of stuff check your design like a hundred times before you're ready um to get it produced we'll rush this a bit so do file fabrication outputs gerb x2 files my units will be millimeters uh the format is fine i generally don't need this they need to select the layers you want to plot typically i'll start with over here clicking used on i want the profile i want the top silk screen i want the paste solder mask i want all the copper layers i want the solder mask at the bottom i want the paste at the bottom i want the ledger on the bottom i don't want any of these mechanical layers these are just for my reference or for 3d bodies and so forth i want the pads top and bottom i also want drills so i want the non-plated through hole and i want to plate it through hole then click ok and we'll generate the gerber files give that just a second and it'll open this camtastic viewer and it'll show you all the exported layers here right click and turn them all off and then go through them one by one to see if everything looks you know in order there's a top copper there's the inner ground plane bottom ground plane copper signal and so forth see by checking these gerber files i really realized that we forgot stitching views we have the ground pause in the inner two layers and we need to add some vias connected to ground across all of this board to make sure these are connected together that we have low inductance connections so the way we do that is press p v i'm just going to change my grid to one millimeter and i can place fierce i can either do that or use altim's via stitching tool so go to tools via stitching and add stitching to that i will do simple my whole size is 0.4 my diameter is 0.8 i want tenting on top and bottom um so i want the v is covered with solder mask let me want my grid is 2.5 millimeters seems about right maybe two millimeters there we go and just click ok and see what that does you can see altums added some stitching gears which is okay this might be a bit you know tight uh this this stitch over here and we can add some more ourselves but you can see the idea that we want to connect the top or the inner two ground planes together i can add some more here just where just um where altium hasn't placed them properly also moving a bit further away from the ground um pause v is in um silk screen aren't great so i'm just going to get rid of them let me just try this so it's also placed ground view is really close to the pads so let me just actually just do it manually for now normally this works fairly well uh i don't know why it's having a bit of a bad day today so i'm just going to place some vias manually you can of course make this a lot neater but just for the sake let me just do that so now i've placed some stitching gears and you can see in the 3d view just to stitch these ground planes together as a last check let me just close uh this and let me just report all the polygon poles and then of course do another designer check to see if anything new has cropped up hopefully not that we don't have any short circuits on connectedness and it's pretty much the same warnings as before so now we can return back to actually generating our production files so we do file um fabrication outputs go x2 files we've already set this up so let's click ok and then again we can check the files one by one and this time with stitching views so you would check that and that all seems all right so far altum has exported the gel files in the directory and then under project outputs there are some files that you don't need and i typically just delete those delete these and then i add them to a gerber file sorry a zip file or raw file there we go right now let's call them something sensible items to board gover files then i can delete those because then the go file okay so there's our gerber files which we can use for production if we want bare boards but we want them assembled so we go back to altum click file assembly outputs and generate pick and place files we want units to be metric we want them to be in csv format and that's about it click ok we can go back to the folder and they should have been generated there then we can just rename this file to be autumn steam 32 board cpl double click on it and we have to make some changes so we can get rid of all this stuff over here for glc to accept this file we need to change this up here center x millimeters to mid blank x and center y to mid blank y also you see all these top layers here top layers have to go to bottom layer oh sorry top layer has to go to top only so click replace all and that's it okay so that's where we have our gerber files now we have our footprint position files now we need our bill of materials so you can go to altum again click reports builder materials wait till that loads and we want it in file format csv and click export and we want to export that with the name as dash bom or builder materials click ok and we need to edit that file as well so open it get rid of this line we need to add a column called lcsc part number then we need to add an extra column with all the lcse part numbers the way we then fill in this builder materials file is go to glc pcb go to glc psp.com parts find the relevant part and copy over the jlc pcb part number so for example for this molex connector this usb connector we just copy that and then we need to find it in here which is over here and then copy that in and we do that for the components so if i look for my microcontroller pop that in here click on it lc csc part number and just copy that in and you do that for all these parts so let me just do that okay so i've filled in this column with the lcs part number for pretty much everything of course altium has added the tag connect header and that's not really a part so we can get rid of that and this jstgh header they don't have in stock at the moment so i'm not going to have them assemble that so i can get rid of that row as well but other than that everything is filled in and we're pretty much ready to order so we go to jlc pcb click instant quote and then we click add gerber file then we go to project outputs choose our gerber let that upload and then we have to select the parameters for our pcb let's give that a second and here it is uploaded we can use their gerber viewer just to check if everything looks kind of all right it's automatically found the dimensions we can choose how many we want uh i don't know let's say 10. um all this is fine we want an impedance control board with this stack up the top layer is top then inner inner and bottom pcb color will keep us green for the surface finish i typically go with lead free hot air service living or immersion nickel gold let's go let free to make a bit cheaper uh you can play around with material type and things like that um remove order number i would like to so i'll just click yes and that adds like a dollar fifty to it uh but at least you don't have like a glc order number on it then of course you want smt assembly so let's click on that we want the top side assembled and we've added the tooling holes ourselves already so once you're happy with that click confirm and the next page is then to add the biller materials and our component placement file server materials and component placement and click next then hopefully the system will register everything and this is what we uploaded on the left here and this is what they the automatic system matched so it's good to check you know the the value on the type of component with what they think it is this is essentially the partner we typed in just go through one by one checking if all this all looks right and then we just do that quickly everything's right crystals everything leds resistors the right mcu capacitors seems all right so far okay then we click next and now we have to review the parts placement to make sure the rotations are okay now engineers at jlc pcb will actually check this for you so it's not entirely critical if you do this yourself but you can save time and save them the hassle and i typically always do that so let's just wait until it's ready as luck would have it the jlc system is currently not working but you would essentially see the orientations of your components and if there are some issues with that you will then open your component placement file over here and you would have to then adjust the rotation of the components typically this isn't an issue if you just submit the board and the engineers will get back to you to adjust the placement and they will then send you an email asking you if this placement is correct so you can pretty much well in essence skip this step and then just click save to cart uh component placement you can see here you'll have this kind of preview uh just to see if everything's aligned with the dots and that's why the silk screen helps to indicate to the engineers at jlcpcb also where and how to orientate the components so once you're done for 10 boards it's about 135 dollars almost fully assembled which is really cool it's about 13.50 per board without shipping and of course import duties wherever you live and then yeah save the car and you're pretty much done so thank you very much for watching this video i hope it's been okay and you've learned something with autumn designer and see how that compares to kicad if you haven't subscribed already please subscribe to the channel and leave a like if you can thanks very much and i'll see you in the next video
Info
Channel: Phil’s Lab
Views: 374,868
Rating: undefined out of 5
Keywords:
Id: PMEpQZ90f34
Channel Id: undefined
Length: 168min 30sec (10110 seconds)
Published: Sun Dec 05 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.