Arduino Tips & Tricks
What is a bootloader? why is it needed?
what & why of Bootloader?
Bootloader is a small piece of code that lives in a reserved space on the atmega IC. It plays a very crucial role in giving arduino board user the ease of programming the board over a USB connection.Lets look at the arduino uno board to know about it in detail.
When an arduino board is programmed from the USB conncection you program the atmega 328P chip. But there need to be someone in between the computer and atmega 328P which can do the conversion from USB to serial interface,so that the data can be programmed on atmega328P.A chip atmega 8u2 as depicted by a small square on the pictures handles the conversion from USB to serial interface. So there needs to be some software on the atmga328P to handle the communication with atmega8u2. This software or code is what we call the BOOTLOADER .
DOWNSIDES OF HAVING THE BOOTLOADER
The bootloader gives you the ease of programing the arduino board over the USB connection. But it has a few downsides which are written below.
- It consumes 512 bytes out of 32k of program memory on the arduino.
- Every time the Arduino board is powered on or it resets the bootloader waits for 0.5 sec to check if the computer is trying to upload any sketch,if there is a sketch that needs to be uploaded it is uploaded otherwise the program counter starts working through the sketch that is already their in the atmega328P . So everytime you reset or power on or click on upload button on the Arduino IDE the board is first reset then then it waits for 0.5 sec. Hence the execution of your sketch doesn't start instantaneously due to bootloader.
Can we get rid of bootloader?
If the above two drawbacks pose to be a hindrance for your application you can get rid of the bootloader. But once you get rid of it you will not be able to use USB connection for programming. Rather you would require a dedicated hardware like AVRISP MKII like shown below or usbasp programmer or another Arduino board to program this board.
In such a case you will program using the ICSP header as shown in the figure.In such a case the communication with the micro-controller will be using SPI(Serial peripheral interface). Once you will program your atmega 328 using an AVRISP MKII o other dedicated programmer it will erace the bootloader from your IC.In my next post i will share about how to bootload an IC.
No comments:
Post a Comment