bootloader help

Hi all,
Im getting back to microcontroller circuits after some time in analog circuits. Since i loved Arduino IDE so much because of its easy language i was wondering some things.

After some research i came across bootloader and i started to get very confused. So, in a simple way...

1- Bootloader is a software installed on ATMega chip's (present on each arduino board) by arduino iDE so we dont have the need to take the chip out everytime we want to re-program it, right?

2- Bootloader is needed everytime we want to program chip directly from computer via usb port devices therefore without external programmer(ATMel-AVRISP), right?

3- Bootloader software is not needed if we are programing the chip with external programer,right?(i.e. ATMega328)

4- Imagine i buy any ATMel microcontroller for a project.
4a) Bootload compatible chip example - i can use arduino IDE to write code and then i can use those usb devices to program it right?
4b) Bootload not compatible chip example - i can use arduino IDE to write code and then i must use external programmer? So its like, can i use arduino IDE to program any kind of ATMel chip using external programmer?

Try to answer by topic or correct it to get easier for me :slight_smile: many thanks in advance!!
Maybe im really confused, and missing something here, if so a quick, easyand simple bootloader definition would be apreciated :slight_smile:

1- Bootloader is a software installed on ATMega chip's (present on each arduino board) by arduino iDE so we dont have the need to take the chip out everytime we want to re-program it, right?

More correctly: the Arduino bootloader programmed into the ATmega chip on the Arduino allows you to upload an Arduino sketch through a TTL Serial connection (usually the Arduino will have a USB-to-TTL-Serial converter on board). Without the bootloader you would need a ISP device (like the AVRISP, USBtiny, or USBasp)

2- Bootloader is needed everytime we want to program chip directly from computer via usb port devices therefore without external programmer(ATMel-AVRISP), right?

Yes.

3- Bootloader software is not needed if we are programing the chip with external programer,right?(i.e. ATMega328)

Yes. Also remember that when you upload a sketch using an ISP device you disable the bootloader. If you want to go back to uploading over USB/TTL Serial you have to burn a fresh bootloader using the ISP device.

4- Imagine i buy any ATMel microcontroller for a project.
4a) Bootload compatible chip example - i can use arduino IDE to write code and then i can use those usb devices to program it right?

If you buy an ATmega chip with an Arduino bootloader you can upload sketches using USB/TTL Serial. Since several generations of Arduino use the same ATmega328P chip and different bootloaders you need to know WHICH Arduino bootloader is installed in the chip you purchased.

4b) Bootload not compatible chip example - i can use arduino IDE to write code and then i must use external programmer? So its like, can i use arduino IDE to program any kind of ATMel chip using external programmer?

Not all Atmel chips are supported by the Arduino IDE and libraries. Not even all Atmel AVR chips are supported by the Arduino IDE and libraries. Not even all Atmel ATmega chips are supported by the Arduino IDE and libraries. If you want to use the Arduino IDE and Arduino libraries it is best to stick with the ATmega8, ATmega168 or ATmega328P. If you want to program without the restrictions of the Arduino IDE you should get Atmel Studio and visit the AVRFREAKs.net forums.

You can use the Arduino IDE to upload a sketch via the usb. The bootloader takes care of programming it into flash memory.
You can also write the sketch directly to the Arduino, using a programmer. There will be no bootloader.
When you write/burn the bootloader from within the Arduino IDE, also the fuses are set, so everything is ready to be used.

1 ) Almost right. The 6-pin ICSP header on the board is for a programmer. So you don't even need to take the chip out when using a programmer.

2 ) Right.

3 ) Right, you can upload a sketch with a programmer, without the bootloader.

4a ) Yes, such an usb-serial-ttl thing.
When you buy a chip with the Arduino bootloader, I suggest to re-write/burn the newest bootloader with the Arduino IDE anyway, so you can be sure to have a good and fresh new bootloader. Who knows what kind of stinky bootloader was on that chip.

4b1 ) You can use the Arduino IDE with an programmer to write/burn the bootloader. Or you can use the Arduino IDE with programmer to write the sketch without bootloader.

4b2 ) You can not use 'any' ATmel chip. The Arduino supports a number of them. The most common is the ATmega328p. However, many can be made compatible with Arduino by adding their definition to 'boards.txt'.

While I was typing this, johnwasser already answered all the questions. I'm going to read that now to see if we agree with every answer...... okay, read it. I think we agree on everything, but johnwasser forgot to mention the word "stinky" when talking about unknown bootloaders :wink:

Many thanks to both, it was really helpfull :slight_smile: