Altium STM32 Hardware Design - An Overview in Under 20 Minutes

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in many of my previous videos i showed the design and programming of my little brain pcb that i designed in keycad this board contains a fairly powerful stm32 microcontroller sensors and other peripherals unfortunately due to the global chip shortage these days the parts for that board are not available anymore at least for a reasonable amount of money i therefore decided to redesign and add some features to this little brain pcb in altium designer and order a number of these from jlc pcb so that if you want you can follow along with all tutorials at home by ordering one of these yourself in future videos i'll do a board bring up which includes testing and writing drivers for this board as well as some tutorials on dsp stm32 and so forth in this video i'll show you my design choices for this board using altium designer and how to get one for yourself from jlc pcb i had these boards made and assembled by glc pcb in china who are also sponsoring this video if you'd like to order one for yourself you can go to my github page at github.com pms67 and locate the little brain plus plus repository over here you can also check out the old little brain repository which contains a lot of the driver examples firmware dsp and so on to follow along with the previous videos all necessary design and manufacturing files are in this repository ready to order i'll show you how to order these boards from jlc pcb at the end of this video as you've seen i've used outing designer for this board to show you how it can be used also in comparison to kicad to design a fairly simple scm-32 based pcb if you would like to try out altum designer for yourself you can go to autumn.com yt phil's lab to get a free trial the link is in the description below as well but for now let's get started with the design walkthrough here we are in ltum designer looking at the schematic of the little brain plus plus this is divided into three parts and that's also into three schematic pages one for the power supply one for the microcontroller and some peripherals and lastly one page containing two sensors let's go through them one by one first let's look at the very simple power supply for this board i've tailored this board to my specific needs and therefore opted to only allow the board to be powered via usb which has a nominal plus 5 volt rail since the components on this board don't consume much current typically less than 100 milliamps i've gone with a simple ldo low dropout regulator rather than a switching converter the mic 5219 shown here can actually supply up to about 500 milliamps of current should there be a need for this so it's a bit oversized for this application but more than sufficient as i said before the supply rails come from a usb connection and this supply rail is typically rather noisy so i'm using a pi filter here to filter out high frequency content from the dc supply this is in the form of two 2.2 microfarad capacitors to ground and a series ferrite bead the second capacitor over here is actually also the input capacitor for the load dropout regulator according to the regulator data sheet we require at least one microfarad capacitors on both the input and the output of this device for stability now this particular regulator also has an additional pin that needs to be bypassed with a 470 pico farad capacitor to further reduce the noise on the rail so i've added that here on development boards like this i like to have a power on led which you can see over here the current limiting resistor is chosen to be one kilo ohm which may seem large to some but i find leds for these use cases are typically bright enough when driven with about two milliamps of current before we move on notice the numbering scheme of the component designators for multipage schematics assuming less than 100 components per schematic page each schematic page is given a specific number range for example page 1 is from 100 page 2 is from 200 and page 3 from 300 and so forth this is great for routing and debugging into later stages as i can quickly jump to the correct schematic page here we are at the second schematic page that of the stm32 microcontroller debug connector sd card and gpio header let's go through each subsection which i've grouped using altium designers drawing tools to make the schematic easier to read firstly i've opted for a fairly powerful stm32f4 microcontroller the stm32f411 to be precise this can run up to about 100 megahertz and includes things such as a floating point unit which really helps with dsp applications for example i didn't need much i o capability and therefore i chose an mcu with a low pin count for pretty much all stm32 microcontrollers we'll need some basic circuitry to get them running this includes the decoupling capacitors and in particular we'll need one 100 nanofarad capacitor per vdd pin this includes the v-bat and v-ref plus pin i also like to add a larger bulk decoupling capacitor this one over here 2.2 microfarads which is placed close to the ic itself then we may have pins like the v-cap pin over here which are specific to some mcus and which require a low esr 2.2 microfarad decoupling capacitor you can see i've tied boot 0 to ground as i will only be programming the board via zero wire debug or swd for short if you'd like to enable st's boot loader for example if you want to program this via uart or usb you will need to pull boot zero high for example via a dip switch the mcu itself has an internal high speed crystal however for better accuracy i would almost always recommend to add an external crystal i've chosen a 16 megahertz crystal in this case which according to the data sheet has a nine picofarad load capacitance this crystal requires two external load capacitors i've arrived at the value of 10 picofarads for these by taking the crystal's nine picofarad load capacitance subtracting roughly four picofarads of stray capacitance due to routing and then multiplying that number by two the last part of the crystal circuitry is this feed resistor over here this is to limit the drive strength of the circuit which may overdrive the crystal and thus create distortions i typically keep the resistance value fairly low and you may need to experiment with this value a tiny bit once we have this basic circuitry in place that means our mcu can boot up but we'll also need to decide on a pin out of course for this i pretty much always use stm32 cube ide so let's go over to that now here we are in stm32 cube ide which is a free development environment for the stm32 microcontroller platform i have various other videos showing in more detail how to set up stm32 cube ide from scratch so let me just briefly walk you through some steps here so i've chosen my mcu which is the stm32f411 here i can choose essentially my pin out and configurations i can either click on individual pens and set them for example as inputs outputs and so forth or i typically go on the left side here and then choose my peripherals for example i might go into the system section and enable my serial wire debug with a trace output and then that shows me the relevant pins over here then i could do something with the crystal i will enable the high speed external crystal and this selects the pins here for example i can enable i squared c lines by going to connectivity click on i squared c and then enabling those pins if i control click on the pins i can see alternate placements for example this pin could move over here once i've selected all the peripherals i want i can also add some middleware for example usb drivers or fat file system drives and so forth but i also need to set up my clock the way i do that is go to clock configuration in the hse the high speed external crystal part i choose my clock frequency with the 16 megahertz and i would like to run at a system speed of 100 megahertz then i can press enter press ok and stm 32q ide will set all of these pll values automatically for me given my hse frequency and my desired cpu clock frequency and that's pretty much all there is to sn32 cube ide you then click save and the basic structure of a project is created for you now back in autumn designer we can continue with the peripherals of the microcontroller firstly i will be using zero wire debug or swd to program and debug the mcu the main connections are swdio and sw clock however i've included swo as a trace output and the n reset signal to allow me to do a hardware reset all of these connections are routed to what's called a tag connect header in essence this is a special adapter for the st-link debug probe which allows you to use pogo pins and pads to debug your boards this saves the cost and space requirements of a connector you can also see i've added some esd protection in the form of tvs diodes and some current limiting resistors i also have a usb connector up here which supplies power to the board and lets us interface with the microcontroller for example via a virtual com port to visualize data then we have an sd card connector which is connected via a 4-bit wide sdio interface to the microcontroller again we have esd protection and filtering of the supply to the sd card the data and command lines require pull-up resistors however the clock pin does not i've placed a series termination resistor on the clock line to aid with ringing and other signal integrity issues the card detect pin over here requires a very weak pull down resistor as the sd card has its own internal pull up resistor that makes this pin go high when inserted finally i've added a simple six pin jst gh connector to this board to allow for minimal further expansion i've hooked the connector pins up to a filtered power and ground and four of the connector pins to the microcontroller again with esd protection and current limiting resistors here we are at the third and final page of the schematic this page contains the two sensors available on the little brain plus plus board an inertial measurement unit containing gyroscopes and accelerometers in this case it's the mpu-6050 and a barometric pressure sensor to measure quantities for example the altitude and in this case i've chosen the spl0601 which is very similar to the bosch bmp280 both of these sensors can be interfaced with via i squared c i've hooked them up to two separate buses on the microcontroller i squared c1 and isolate c2 to make sure they don't interfere with each other and that i can maximize my data transfer rates the schematics for these two sensors are very simple and can be read up in the relevant data sheets as usual we need to connect the i squared c data and clock lines to the microcontroller as we saw on the mica controller schematic page i've placed the i squared c pull up resistors there and for a 3.3 volt supply i typically go with 2.2 kilo ohm pull up resistors this is sufficient even for i switzy fast mode at 400 kilohertz then we'll need some decoupling at each vdd pin somewhere here here and here the remaining pins i've hooked up according to what the datasheet tells us to do and typically you will find that in every sensor or device data sheet luckily both sensors also have interrupt output pins here and here in practice this will then tell us when data is ready to be transferred from a sensor that's pretty much it for the schematic of the little brain plus plus now let's move over to the pcb design here's the little brain plus plus board in autumn designers 3d viewer this board is pretty compact at about 40 by 40 millimeters and this is a four layer board using glc pcb's impedance controlled stack up which will need for the sd card data lines as well as for the usb differential pair i've opted for signal ground ground signal stack up for better emi and signal integrity performance in altium designer i can set up my layer stack up with things like dielectric thickness copper weights and so on once i've done that i can calculate the trace widths to give the required impedances here i've done that for 50 ohm single-ender tracers with sd card for example and a 90 ohm differential pair for the usb data lines if you're not using autumn designer you can also use glc pcb's controlled impedance calculator you can see me type in impedance value choose how many layers the thickness of your pcb if it's in a layer or outer layer and if it's single ended or differential click the arrow and it'll tell you the recommended trace width since jlc pcb at the moment only supports single sided assembly the board layout is a bit cramped and some of the placements aren't entirely optimal however it's fairly decent for what this board needs to do the connectors are placed at the board edges over here here and here with decoupling capacitors and esd protection as close as possible to the connectors themselves looking at the power supply over here it's good practice to keep decoupling capacitors this one and this one as close as possible to the ldl regulator less critical components such as the on led over here can be placed further away for this board since i'm using both internal layers strictly for ground planes i've routed the 3.3 volt rail which you can see rooted with this very thick trace on the bottom layer here but the speeds this board is running at this is absolutely sufficient and we do not require a dedicated power plane the microcontroller is a qfn package which is not the easiest to root out due to tight space constraints however i've tried to prioritize components such as the decoupling capacitors placing these decoupling capacitors as close as possible to the device with thick traces connecting them as well as power puddles as you can see over here the power pedals are essentially small copper pawls linking the power nets together every time i require a ground connection i can simply route a short wide trace out from a pad and dig down into the internal ground planes with vias the crystal section is also kept quite close to the microcontroller with the load capacitors over here placed in line with the crystal signal traces the debug and i o traces take a fairly low priority in this design and we're done last however care needs to be taken for the sdio interface for the sd card and the usb data line routing these should ideally be controlled impedance traces as shown before although not strictly necessary i've actually length matched the sdio data lines as you can see here with these squiggly traces and an altium that's quite easy to do i can do interactive length tuning and interactive differential pair length tuning finally we have the two sensors up here the inertial measurement unit and down here the barometric pressure sensor both these devices have decoupling capacitors very close to the sensors themselves and to the relevant power pins ice quite c as an interface is fairly forgiving in terms of routing so these traces have a fairly low priority and can be rooted in a pretty rough manner you can see these ground vias here which seem to not be doing very much however these ground veers are placed close to signal vias because i am using two ground planes so when these signals for example i squared c lines here change reference plane so change the ground plane i place a ground veer close to these vias to maintain a good return path this helps with emi and signal integrity i've also placed several stitching vias around the board which essentially ground vias stitching the two internal ground planes together lastly i've added some silk screen over here here and then also on the back to indicate the board name revision logo and so forth now all that was left to do was to do a designer check which i can do over here tools designer check and autumn designer and then create the gerber and assembly files in out in designer we can export the gerber files by going to file publication outputs and gerber x2 files then we need to select the relevant files and layers as well as the drill files and click ok to export for assembly we also require a footprint position file and a bill of materials or bom for short the footprint position file can be created under file assembly outputs and generate pick and place files the biller materials can be created under reports and bill of materials for glc pcb we also need to add the lcsc part number in a separate column in the biller materials file and fill in the part numbers using the jlcpcb.com part site and you can always see the jlc pcp part number over here now let's head over to jlcpcb to place our order when your glc pcb you can just click on instant quote then add your gerber file this will upload your files for analysis and once it's uploaded glc will fill in information for you you can also use their gerber viewer just to check that everything looks all right dimensions are 44 440 millimeters you can choose how many pcbs you want i would like an impedance controlled board with this stack up in my case and you have to fill in your layer sequence so top the first in the layer second in the layer bottom layer silkscreen color surface finish activity go for enig copper weight and so forth and i also typically remove the order number which is otherwise printed on the silk screen i would like to have these balls assembled on the top side and tooling holes added by glc pcb click confirm now we have to add the bill of materials and the footprint position file then click next then we can see the automatic system of jlc pcb has match components so this is what we selected and this is what the system thinks it's chosen as well as the total cost for all of these parts this is a good step to verify that everything is right and when you're happy click next now here we can check our placements of all our parts just to make sure everything's correctly rotated so you can use this visualizer to just check that and once you're happy you can check the total price which for 10 boards is about 194 us dollars so less than 20 per board without shipping without customs so that's actually pretty good for something like this so thank you very much for watching this video if you liked the video please leave a comment and click the like button if you haven't already please do subscribe to my channel and if you have any further video suggestions please leave them in the comments below once i have these boards in my hand assembled and fabricated i'll be making some board bring up videos so stay tuned and i look forward to seeing you in the next video bye
Info
Channel: Phil’s Lab
Views: 13,499
Rating: undefined out of 5
Keywords:
Id: H7i2YXUBheE
Channel Id: undefined
Length: 18min 20sec (1100 seconds)
Published: Thu Nov 11 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.