Arduino Forum

Using Arduino => Installation & Troubleshooting => Topic started by: hamisu-anguan on Jan 16, 2018, 10:22 am

Title: Do we need to burn bootloader for new ATTiny IC ?
Post by: hamisu-anguan on Jan 16, 2018, 10:22 am

This article mention not required.
http://highlowtech.org/?p=1695 (http://highlowtech.org/?p=1695)

This article mention need to burn bootloader.
https://create.arduino.cc/projecthub/ianabcumming/programming-the-attiny85-using-an-arduino-uno-0cb824 (https://create.arduino.cc/projecthub/ianabcumming/programming-the-attiny85-using-an-arduino-uno-0cb824)
Title: Re: Do we need to burn bootloader for new ATTiny IC ?
Post by: pert on Jan 16, 2018, 10:31 am
I already answered this in your other thread:
http://forum.arduino.cc/index.php?topic=521963.msg3566157#msg3566157 (http://forum.arduino.cc/index.php?topic=521963.msg3566157#msg3566157)

If you want to upload over serial you need a bootloader. That is the usual way to use Arduinos. However, if you use an ISP programmer to upload via Sketch > Upload Using Programmer there is no need for a bootloader and in fact the bootloader will be erased when you do that.

The bootloader uses up flash memory. The ATtiny chips have very limited amounts of flash memory so it's best to not waste any on a bootloader.
Title: Re: Do we need to burn bootloader for new ATTiny IC ?
Post by: pert on Jan 16, 2018, 10:36 am
The thing that's not obvious about Tools > Burn Bootloader is that it doesn't only burn the bootloader. It also sets the fuses on the microcontroller according to the hardware definition of the board you currently have selected in the Tools > Board menu. So even though there is no bootloader to burn, if you need to change the fuses then you still use Tools > Burn Bootloader. Once you've done that it's not necessary to do again unless you want to change the fuses. It definitely makes sense to do a Tools > Burn Bootloader to be sure you have the expected fuses set.

Note that a common way that people "brick" their microcontrollers is by setting fuses for an external clock source when there is no external clock source (such as a crystal or ceramic resonator) connected to the microcontroller. In reality it's not bricked but this does mean you can't do anything with the microcontroller until an external clock source is attached.
Title: Re: Do we need to burn bootloader for new ATTiny IC ?
Post by: hamisu-anguan on Jan 16, 2018, 03:13 pm

So, if I dont burn bootloader i only can run ATTiny85 at 1 MHz ?
I read from internet that if I need to run at 8MHz, I need to burn the bootloader.
So the flash memory space will be reduce if run at 8MHz ?
Title: Re: Do we need to burn bootloader for new ATTiny IC ?
Post by: pert on Jan 16, 2018, 03:30 pm
So, if I dont burn bootloader i only can run ATTiny85 at 1 MHz ?
Actually from looking at the datasheet it appears that the factory fuse setting is to use the 8 MHz internal oscillator. But since you're going to be using it with an ISP programmer anyway, why not just do a Tools > Burn Bootloader to make sure all the fuses are set as expected?

So the flash memory space will be reduce if run at 8MHz ?
When you use a bootloader on a microcontroller it is placed in a special section of flash memory that is reserved for it by setting the fuses accordingly. In addition, the Arduino IDE will check the flash usage of your sketch to make sure it does not exceed the available memory. Whether those fuses are set and the boot section memory reserved depends on the configuration of the hardware package for the board you have selected from the Tools > Board menu. Most popular hardware packages for the ATtiny85 (damellis/attiny and SpenceKonde/ATTinyCore) do not use a bootloader for the ATtiny85 and thus no boot section is reserved. When you do a Tools > Burn Bootloader with one of those boards selected all that happens is the fuses are set. No memory is reserved for the bootloader in the microcontroller or by the Arduino IDE. So the answer is, no!

Just connect your ISP programmer to the ATtiny85, do a Tools > Burn Bootloader to make sure the fuses are expected and then upload you sketch to the board using the ISP programmer.