Best Way to Burn Arduino Bootloaders Tutorial!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay so I just wanted to make a quick video here showing you my new favorite way to burn the bootloader into the 80 mega 3:28 and for those of you who are new at the Arduino game and are wondering what the bootloader is used for well let's say that you buy the Arduino board you learn everything about it and then somewhere along the way you figure out that you can lift the chip off of the board and run it right on a breadboard with a standalone Arduino circuit and you can program sketches into it with a USB to serial converter and then you go online and you find that you can buy this chip directly from digi-key or Mauser sparkfun or Adafruit or whatever and so you buy a whole tube of these and you've got a whole bunch of them you go to throw the chip then into the breadboard and you find that when you upload your sketch you get all kinds of errors and that's because you need to burn a special arduino bootloader into the chip so that you can program it via the USB to serial converter from the arduino ide and that's what i'm going to show you how to do in this video so I've programmed hundreds of boot loaders you may remember this guy from an old video that I got a little zip socket here that I could throw the chip into and I was using the USB tiny ISP to program the bootloader at one point I even made this little guy here to to program surface mount 18 Megas so I programmed hundreds of boot loaders and then one day I needed to program the bootloader into an 80 mega 2560 which is the chip used on the Arduino mega and this is be tiny does not support that so I started searching around and I came across this website here and this is Nick Gammons way to burn boot loaders and he's come up with a really really cool sketch here and I'll explain how this all works but this is really incredible stuff here so big big shout out to Nick Hammond in this this whole this whole breakdown and it's it's actually you can follow this directly and stop the video here if you wanted to but I'll walk you through how it all works but this is really fantastic and the way this works is you go to the github page here and you pull down the 18 mega board programmer folder here throw that right into your sketches folder and then launch that and then you just burn this right into an Arduino standard Arduino okay you just upload this sketch right into it and then you wire it all up so this now becomes your programmer arduino and then you're going to have a target arduino and you're going to use the ICSP header here that you always see on all these Arduino boards and that is the AVR programming header and you could if you've got one handy use a 6-pin ribbon cable but I'm I'm sure most of you out there don't have this but if you have this you simply connect up the two connectors there the reset pin on your programming header is not hooked up but instead it's hooked up to the chip selector slave select line from your programming Arduino to the reset of your target Arduino now I'm going to explain all that here in a second so let me first show you the pin out of that programming header and you can just search online for this or so here's the official the official data sheet for the in system serial programming header and this kind of breaks it all down how it all works but the Arduino boards follow this same pin out here so you see we've got me so VCC clock mossie reset and ground okay so you want to just hook all of these pins directly up so on your programmer board the only pin you don't hook up is this reset line and if we go over here I'm going to pull the datasheet real quick up here okay so if you pull open the datasheet here you'll see that you've got those same pins on your target arduino so obviously you've got them on your you know the the target arduino if you had another Arduino and you just put the chip into it you can just tie those pins directly but if you're going to do it where you've got your target Arduino down on a breadboard then you've got a wire over from those pins to the chip and you can see though that you've got you know miso your your clock line you've got me so mossy and then you've got SS which is your slave select line and this from your programmer arduino goes over to the reset pin of your target arduino okay so that kind of explains you know how it all works that the program programmer arduino takes control of the target arduino via the reset line the programmer arduino is the master in the system okay so anyway let's let's go ahead and wire this up so assuming that you don't have the 6 pin ribbon cable you can just use standard wires like this and we're just going to go ahead and follow this out ok so pin 1 is me so I'm looking for pin 1 here got me so just plug all these in and I actually made this little cheat sheet board here and there's a link in the description below for the wiki page I created for this and this has the via all of the pin out text therefore both the Arduino and and I've talked about this in other videos too but it's got the Arduino pin so digital pin you know 0 through 13 and it's also got the native EVR stuff that you see here in the datasheet so it makes it really convenient when you're doing this sort of breadboard type work to see what all the pins are and it also has the the in circuit serial programming header text on there as well so I don't need to be flipping around it all here I've got it all on this board and I did screw one thing up I hooked up reset on both of these which I don't need to do so let me just fix that real quick okay so just to fix that up let's take we're going to go from the chip select liner sorry the slave select pin over here and wire it over to the reset pin on the programming Arduino around the target Arduino sorry so that would be digital pin 10 there we go and that should be it so it's really important that you hook up you know that digital pin 10 over from the programming Arduino or the programmer Arduino directly to the reset pin on your target Arduino and that should be okay so let's load this sketch up I'm going to make sure that we got the way Mila nove you can also use the you know it doesn't matter I will say that this is a huge sketch so it might take a little while for it to to write to the board okay so now we actually have the we have the programmer Arduino code written okay so then we're going to go ahead and launch the serial monitor window and you'll see here at attempts to enter into the programming mode it gets in there we're good it shows you the signature of the processor and some other information there and what we can do from here now is program one of two boot loaders if we're running at eight megahertz we can type in L and then enter if we're running at 16 megahertz we can we can type in a U and that enter one thing to keep in mind to and this is one of those gotchas if your target Arduino does not have a crystal present you're gonna you're going to have problems getting into the programming mode over here so make sure that you've got your target Arduino all wired up everything good to go over there before you hook this all up okay so we're going to go ahead and program the 16 megahertz bootloader make sure you've got your new line and carriage returns set down here as well and of course we're running at 115 - for the serial monitor baud rate okay so there we go now we have a choice to verify or g2 program so we're going to hit G enter and that's it did you guys see how fast that was that's how fast it just burned the bootloader so that's it so now we've got the bootloader written now let's see if it'll take a sketch with with it from within the the Arduino IDE ok so now that we have the bootloader programmed let's see if it'll actually take a sketch so I've hooked up the USB to serial converter here I removed the reset line from the programmer so that this is not the programmer is not going to have any effect on the target Arduino and we could remove all these wires but I also want to try burning another bootloader here in a second but first let's test out the 16 megahertz bootloader here and make sure that it works and that this Arduino can now take a sketch directly from the Arduino IDE so up here we've got just an example sketch pulled right out of the the example folder it's just going to blink an LED on pin 13 so one of the things you have to do is change your target board here to Arduino mini and that's one of the tricky things too is you got to pick which board it is and make sure that that lines up with whatever bootloader you load it in and sometimes it doesn't seem to always match with what the text shows you when you're actually programming the bootloader but I found that for that one the Arduino mini works so let's go ahead and make sure we get that the serial port hooked up and let's let it rip okay and there it goes it's programming we got done uploading and it is blinking so that worked now let's let's try burning the eight megahertz bootloader okay launching the serial monitor window again let's change the port back now launch the serial monitor window okay we're back in now we're going to try changing it to the eighth measure so we're going to hit L enter and go ahead and G that to program and there goes done okay so that was pretty fast now let's disconnect this and of course I should change the crystal but I'm just going to leave it as is but pretend there's an eight megahertz crystal down there we'll pull the reset line put the USB to serial programmer back in plug that guy in and now if I went to if I went to upload this right now with the mini selected it wouldn't work you actually have to go now to our dueƱo Pro and then go down to 328 33 at 8 megahertz okay and don't worry about the voltage you did doesn't matter alright pick the right serial port and let's go and let this rip now and see if it works okay there it goes programming and it's done so that's it that's how you program the bootloader one thing I will say though is that if you get a successful burn of the of the bootloader from the programmer Arduino and you can't seem to get it to take a sketch then after make sure that you go through all of these boards first because you know maybe you've maybe for example you've picked the 80 mega - a U or something like that not the P version or the Pico power version of the Arduino or of the 80 mega 3:28 so that's one of those things to keep in mind as well so make sure you try all these before you completely give up on it so again a huge shout out to Nick gammon for putting this all together because this is just fantastic in fact one of the things I've done is just one of my cheater boards I have a dedicated programmer so this is always ready to go and I use it to program all of my 18 Megas and I just always have this running the NIC Gammons sketch here so that's it so hopefully that helps thanks for watching
Info
Channel: Kevin Darrah
Views: 243,566
Rating: undefined out of 5
Keywords: arduino, bootloader, avr, kevin darrah, nick gammon, how to, tutorial
Id: dpgcBsl9D4k
Channel Id: undefined
Length: 13min 44sec (824 seconds)
Published: Tue Feb 16 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.