STM32 Blue Pill vs Black Pill Microcontroller Boards

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey there my name's Gary Sims and this is Gary explains now what I have here is an arm cortex-m 3 microcontroller board which is commonly known as the blue pill only cost a few dollars and is really really interesting to use now recently I started shipping kind of an updated version which first of all is black rather than blue and it's got an arm cortex-m for microcontroller on it with a floating-point unit so traditionally now this is kind of the blue pill and people are starting to call this the black pill so once do today is look at the blue pill versus the black pill look at how you can set up one of these from a hardware point of view and from a software point of view and get your own code running on it so it's want to find out more please let me explain so as I just mentioned this video really be in three parts first we can compare the black pill with the blue pill to see what the differences are then we can go to the hardware and see how you wire this up into a breadboard so that you can kind of get it working and then we look at the software how you can download your own code and get that running on the board okay so let's look at the differences between the two so both the blue pill and the black pill are based on the STMicroelectronics maracle controllers which are of course based on the arm cortex series the blue pill is based on the cortex m3 running at 72 megahertz the black pill is based on the cortex m4 f/f mini it's got a floating-point unit it runs at 100 makers they can also get a slightly cheaper version of the black pill which runs at 84 megahertz still got the cortex m4 F in it but runs at 84 megahertz when it comes to flash and RAM the blue pill has got 64 K core flash and 20 K of RAM whereas the black pills got quite a large 512 K of flash and 128 K of RAM so that really is quite an improvement and again there is that cheaper version with 256 K a flash and 64 K of RAM but whichever one you get you're gonna get a faster processor floating-point unit more RAM and more storage now couple of the other differences between the board is you've got the micro USB on the blue pill where it's USB type-c on the black pill and as I said the cortex for Earth has got a floating-point unit and it has DSP instructions which is different to in the m3 and the m4 from arm now there are other differences to the chips themselves and I've listed these as differences to the chip because I'm not quite sure how much of this is exposed to the pins that are actually on the black peel versus the blue pill I'm sure over time people will start to build up some quite good pinout diagrams but on the the m3 based chip you've got a 7 channel DMA controller whereas on the black PO you've got 16 stream DMA controller with fire foes and burst support 7 timers versus 11 timers - I squared C interfaces on the blue pill 3 I squared C interfaces on the cortex m4 they're the same number of you arts however I think they're faster they're on the m4 F up to 5 SPI interface is compared to 2 on the cortex m4 f version the blue pill chip has got cannabis which I couldn't find in a reference to that in the stm32f4 11 so don't think the can bus there but I think the USB controller is much more sophisticated on the cortex m4 version and because m4 version also has this SD i/o interface which means you can if you want to build connections to SD cards MMC and eat MMC something that's not native to the cortex m3 version and if we just talk price for a moment basically you can get a blue pill for under $2 this is buying it from a Chinese website let's say like Aliexpress that will probably include free shipping but you may have to pay taxes when you bring it into your country the black pill the more expensive one is about $4 so twice the price if you get the cheaper version with the slightly slower cortex m4 F and the slightly less ram and a flash storage and they're about three dollars so $2 $3 $4 depending on which model you want to get blue pill black appeal black appeal and so I got the more expensive the whole $4 one and that's the one we're looking at today okay now we know the difference is let's look at how you wire one up onto a breadboard so that you can use it in your own projects okay you're gonna need a few things besides the black pill itself you're going to need a breadboard you're going to need some cables that you can connect different parts of the breadboard you can use these ones that are very popular but I've also got some actual proper cable that I'm gonna use you'll see that in a minute doesn't matter which type you have at hand as long as it works and you're going to need one of these are this is a USB to serial converter it's often called an FTDI USB so it converts because the company makes that chip there is future technology devices international and you also if you're looking for them online you can find them because you also need them to program the the Arduino mini now I'll leave links to some of these kind of things in the description below but one thing to note depending on the actual circuit board you get down here the pins they are labeled differently so I have another one which also has a FTDI chip on it but it's labeled differently so you need to make sure you pick the right when you wire it up you need to make sure you're wearing it to the correct pins according to the labels on here not to just the last board that you remember wiring if you don't want to wire it using this you can use an ST link V version two and I'll leave a link to one of those in the description below as well and they connect up to these pins here I'm going to show you how to do it with the USB to serial converter now quickly just a refresher on a pin board remember on a pin board the power rail run in this direction so if you connect that power to here all of these pins will be powered for positive and for ground the pins here for the actual board go in this direction and this thing down the middle here means there's no connection which means when we pop the board now on here like this okay this pin should push that down this pin here is not going to do this pin here because though this this valley here in the middle okay so you pop first of all the black pill there on the board like that and then the other thing we do now is pop in the actual serial converter like that okay so those are the two things you need on the pin board now all we need is some wires to connect up the right bits and pieces so the first thing we do is connect up the power now on my particular board I've got there this last pin here is ground and it does say that on the label there so I want to connect this row here over to the ground over here now I haven't always got the right colors for doing this so in this particular case I'm gonna have to use white because I just happens to be the right kind of length so I'm gonna go from this ground rail here over to this pin here okay we could make that thing a bit more looking so that's the ground pin connected like that and we also now to need to connect the power pin now again I've got an orange is not really the best color red and black would have been maybe the best ones for this now the power pin on this one is the third one for long so that's the ground not that on this one okay and it just reads you look at that over to that power rail so now when we do connect up this to the USB port here it will power these two rails with five volts positive and ground now what we also need to do is we need to take the TX and rx pin to transmit and receive pins and put them to the transmit and receive pins on the board itself now they are a 9 and a 10 here and of course you want transmit on here to go to receive to hear and receive transmit on here to go to receive on here so the way we do that now is we'll take this first one okay and it's the the second pin in to not this first one here but this not this one here but this one here okay that is to go to pin number nine that's actually the rx pin and we put it through to pin number nine on there again we can tighter this up to make it as nice as we want the wiring there we go and I won't do the same with the with the other one the TX and the rx so the the TX pin is next to it on here so we're going to stick that in there and bring that round now to a 10 which is just next to it thank you okay so that's basically connecting now the four pins off here that we need that's our ground +5 volts TX and rx and connecting those over onto the right pins and anything we haven't provided power to this board now and so the way we do that is that we need a to connect the ground pin and you can see maybe you can just see here this pin here is ground so we're going to connect the ground pin here on this now straight over to our ground here like that okay and the one next to it is five volts so we can connect the five volts to the positive rail and I do actually happen to have a red one but I think would just be the right link for that so there is five volts I'm going to connect it to somewhere where it fits in nicely okay so that's it four pins off here transmit/receive two power pins transmitting received around to the transmit and receive on the board and then the board itself needs power five volts and ground on there like that now the hardware is all wired up let's have a look at the software and see how you can write your own code and get that downloaded onto the black pill okay so we're going to need a couple of different bits of software to do this the first thing you need to do is go and find the flash loader demonstration program over at the STM website okay I'll leave a link to in description below it's basically they call it a demo program is actually a fully fledged loader flash loader so you can create a binary firmware and then download it on to your board so you download that and install it and I'll show you it working in just a moment but we need to have something to actually download first of all on to our border to do that we're gonna be using embed OS now embed OS is actually an embedded operating system supplied by arm itself and it's quite a complicated comprehensive ecosystem with IOT device management and deployment and it's got all this kind of stuff that you can do some of its free some of it you pay for it depends on what it is that you want to do look at all this stuff they provide but for what we want to do it actually provides an online compiler you can write C code and it compile it for this board and then we can just flash it over using that flash program I showed you a second ago so you need to create an account easy to log in and you need to bring up the IDE now STMicroelectronics themselves actually have a range of boards and one of them is based on the f4 1 1 that's the cortex m4 f microcontroller that we've got on this black peel board and they're pretty much compatible certainly at a basic level and so what you need to do is go over to the do embed website and add this to your compiler to say I want to use the new Cleo f4 one 1 re board if you've bought the cheaper black pill then you want to find the equivalent with the 401 here they've got both boards here supported inside of em bed you want to add that to your compiler so if you're not familiar with embed OS it's basically a web IDE a web-based development environment I need to go up here onto the right hand side and select the board that you want to compile to here are some all the different boards I've been using over time and as I showed you on that web page you can add that board to the compiler in this case the f4 one one board so that's the ball we're gonna compile for it's a C programming environment so include embed dot H has a pretty simple standard thing to do we're gonna find a variable called my laid and we're saying it's PC 13 our PC 13 is the pin that the in on-board LED is connected to and we're saying it's a digital input/output so in fact digital output so that we can write to it then inside Maine I've got basically an infinite loop to while loop which goes round and round and round and round forever what do I do I set my leg to zero then I wait 200 milliseconds set my led to one wait 200 milliseconds set my lit to zero wait now a second 1000 milliseconds city to one again and then wait another thousand milliseconds so basically it'll do a quick short flash a long slow a short flash and long flash and that just helps us to see that we're running our program here and not some default LED flashing program short and long then it will know that we're running our program and all you do is you go up here and hit the compile button that will compile it and download to your PC the binary files you can flash over on to the black pill so we've hit compile now it will do the compilation and then as you will be able to see it starts to do the download which is now here on my PC so I've got the flash loader demonstrator running that we downloaded earlier from the STM website and we need to do first of all is pick the right comport now my ft di usb-to-serial competitors come up as ports comm seven you need to probably download the drivers from the FTDI website or whatever drivers came with your board and they need to do a funny keyboard combination on the actual black pill itself you need to press the reset button and the boot button and then let go of the reset button and then let go of the boot button and that will put it into flash loader mode where the bootloader motor you can flash new firmware onto it and then you click Next and as you can see it says the target is readable if you haven't done that keyboard combination right the key combination right there it would say can't communicate with the board and you have to go back and try it again so what you say that we have to say yes it's worked out that it is the right chip before 11 there it's giving you the memory map and the next thing we should do is go and choose the file so I've chosen the nuclear file that came down from embed and then finally we click Next and it will start programming so it's now programming it over on to the peel board that little program that we wrote and it's been successful and now hopefully if we hit the old reset button we are going to see our flashing LED now just as one little quick thing we can also do is we can make sure the serial port is working and the way we do that is the fastest eyes defining our LED we also define a serial now if you remember here 9 and 10 were the pins that we connected up to the serial port for the programming so 9 and 10 are still the TX and rx pins and then all we can do if we want to here is we can add in it called PC there we've called this variable PC so we can say PC dot printf because it is C remember and we can just say blink just as you know a little thing to come out here backs s n okay so now what's going to happen is we're also after the quick flash of a long flash we're actually going to write out the word blink to the serial port calls from here on board you can start to do all kinds of things interacting with the serial port this just shows you that we can get it working so we hit compile again and that will download as a new file ok so here I am again in the flash loader program one thing to notice over here is I've actually put in a back house our box s n which is necessary to get a proper full line here on the stereo output so we'll go ahead and flash that over and then what we can do is we're going to use patty because patty allows you also to do serial connections patty you connect serial and of course it's comm seven that's what we were using earlier on and then we open that up and everything should be good there we go blink blink okay I'm not going to sit here saying blink blink blink all the time Joe so there it is that's the serial port working now one thing I did notice that sometimes when I've been using the serial port for monitoring and then you try to program with it again you might need to actually just unplug the serial port plug it in again to reset that FTDI a programmer from what it's doing maybe you don't have that problem I've seen that if you do get a finite problem just unplug it and plug it in again and then you'll be able to read programs that's it we're using the serial port out we've got the LED flashing I says there you have it the the black pill an upgrade to the blue pill you've got the cortex m4 f-f Minnie's got the floating-point unit or DSP instructions more RAM more storage more lots of other interesting little hardware things now I already mined from China again it only costs a few dollars took forever to get here but when it did I was really pleased I think I'm gonna buy myself a few more of these okay that's it my name's Gary Sims this is Gary explained I really hope you enjoyed this video if you please do give it a thumbs up definitely subscribe and that's it I'll see in the next one [Music]
Info
Channel: Gary Explains
Views: 131,236
Rating: undefined out of 5
Keywords: Gary Explains, Tech, Explanation, Tutorial, STMicro, STM32, STM32F, Arm, Cortex-M3, Arm Cortex-M3, Cortex-M4, Arm Cortex-M4, Cortex-M4F, Arm Cortex-M4F, STM32F103, STM32F103C8T6, STM32F401, STM32F401CCU6, STM32F411, STM32F411CEU6, FT232RL, USB to Serial Converter, USB to TTL Serial Converter, USB to serial
Id: QCdnO43RBK4
Channel Id: undefined
Length: 18min 30sec (1110 seconds)
Published: Mon Feb 17 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.