NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Support Forum » Bootloader and Programming Question

December 19, 2010
by Steeldeal
Steeldeal's Avatar

I'm pretty sure that this has been talked about in the forums from my research. Unfortunately it seems like the topic is just grazed, or talked about by more seasoned individuals that know what they are doing. So the basics are not just blatantly outlined.

I like to have a better understanding of all the building blocks so that I can understand how it all works. Maybe it's inconsequential to some until it is necessary later but I'm having a little trouble completely understanding the process of programming the bootloaders and the programming of the chips in general. I'd like to share my understanding thus far, to be corrected if I'm wrong, and to help others if they have the same questions.

From what I've gathered so far, the bootloader is a basic program the opens up the microcontroller to be programmed easily based off of the methods in the NerdKit. It's like a basic root program. Not really an OS so much, in this case almost like a device driver to allow serial communications. This opens the door for additional programs to be added easily. Not sure if all bootloaders are like this like in the example of an Arduino bootloader, but at least in this case it is.

To load this bootloader (the Nerdkit one), you'd need a board that has another already programmed microcontroller that can handle the communications like a middle man.

Now from what I think I understand is an ISP (In System Programmer?) such as this would allow programming, of both the NerdKit BootLoader as well as other programs: (USBTinyISP) http://www.ladyada.net/make/usbtinyisp/index.html

Naturally to use this you'd need a development board of some type with your chip loaded up and a 6 or 10 pin header connected to the proper leads on the ATmega168/328.

With this you could then talk to the MCU and load the bootloader, at which point with the NerdKit bootloader you could plug up the USB to serial cable and continue compiling programs.

But at the same time with this USBTinyISP and a development board, you could actually just load programs directly without ever putting a bootloader in place? Is that correct? I assume this might be handy if you had a large program and wanted to save the space of even loading the bootloader, like say on a finished project to use permanently in a certain instance?

Just wanted to outline it out loud, I don't believe it's been gone over in detail in the forums anywhere. If it has then my apologies.

December 20, 2010
by Rick_S
Rick_S's Avatar

You are mostly correct in your descriptions above.

  1. Yes, the bootloader is nothing more than a small program that communicates with a host via a simple (Usually serial) interface. Other than the their unique instructional parameters, most bootloaders work very similarly.
  2. To get a bootloader on a blank chip, you do need to program it with either an ISP programmer or High Voltage programmer (ISP is by far the most common used). ISP Programmers come in all shapes and sizes. They can be simple home brew devices that tie into a PC's parallel port or elaborate circuits with microcontrollers of their own. Thier purpose is to provide programming via a protocol the micro-controller has built in. You do not have to have a development board to program with an ISP Programmer, the mcu can be easily programmed on a breadboard as long as things are wired up properly.
  3. If you use an ISP programmer, you are correct to say that you don't need a bootloader. All the space can be used for your code.

I believe there are a couple reasons bootloaders are as popular as they are.

  1. Programming via a bootloader does not expose the world of fuses and lock bits to the in-experienced user. An accidental mistake there can render a mcu useless without a high voltage programmer to reset it.
  2. Programming via a bootloader is usually a simple connection and process. ISP programming can be a bit more complicated.

Hope that helped a bit.

Rick

December 20, 2010
by Keyster
Keyster's Avatar

Steel,

One thing I have found over the last few months of using the nerdkit is that Programming with the Bootloader makes prototyping much quicker. I can write some code, test it, make a few changes, test it, make a couple more changes, test it, all in a few minutes or less. once I get the code exactly like I want it I can then use an ISP to program a "non-bootloaded" chip and place that chip in my project. Rick is exactly right about the fuses, it took me a couple of hours to figure out exactly what a fuse was and why I needed to set them on the non-bootloaded chip, something you need not worry about with the NK Bootload.

Bryan "Keyster"

December 20, 2010
by Steeldeal
Steeldeal's Avatar

Excellent information guys. Thank you for your replies.

It sounds like I definitely should keep to the bootloader method. It's much simpler. I never really planned on doing just straight programming just yet anyway. I was curious on how to load the NerdKit Bootloader myself if I choose to.

This has clarified what I have been putting together through reading. It's also opened a few more questions. The Fuses and Lock bits are things I know nothing about and haven't even heard of before. Naturally I can worry about that down the road. At least now I will be aware of the fact that there is an extra component to programming directly that I'll need to be aware of.

For now I'll stick to the Bootloader and continue learning a few additional projects. Thanks for the help.

Post a Reply

Please log in to post a reply.

Did you know that a thermometer can be made "faster" by using a bit of math? Learn more...