Burning the Bootloader on ATMega328 using USBasp Programmer

20445
6

In this tutorial, you’ll learn how to burn Arduino bootloader on a new ATmega328 using USBasp ISP programmer. Every Arduino Uno Board comes with a microcontroller called the Atemga328P, and they are already pre-program with Arduino Bootloader firmware. Therefore, there is no need to burn Arduino bootloader into those Atmega328P chips again. Here, we will be focusing on burning the Arduino bootloader on an off the shelf Atmega328 chip so that you could make your own DIY Arduino board or deploy your Arduino-based circuit to a printed circuit board.

NOTE – The bootloader is the little program that runs when you turn the Arduino on or press the reset button. It’s main function is to wait for the Arduino IDE on your computer to send a new program, which then is written to Arduino memory.

Required components:

  • USBasp Programmer
  • Bread Board
  • ATmega328P
  • 2pcs 22pf Cap
  • 16MHz Crystal
  • 10K Resistor
  • Hook up wire
  • AVRdude Software
  • Circuit Connection

First of all wire up the circuit in breadboard as shown in below diagram. Please connect all the connections carefully.

ATmega328 Arduino bootloader

In above circuit JP1 is where USBasp programmer is connected. Connect all the wires carefully as per above diagram using a jumper wire.

Software Install

If you wire up your circuit correctly then it’s time to load hex file which is located in your Arduino software folder. Here is the complete path for Arduino 1.x in windows – C:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders\optiboot\optiboot_atmega328.hex you can also download from here optiboot_atmega328

Next, you need to install AVRdude software and USBasp Programmer Driver.

Bootloading

Open the AVRdude software and select programmer type from the drop-down list shown in below image. In our case programmer is the USBasp programmer.

After Selecting programmer type click on “Detect” so programmer automatically detects ATmega328. If you have any problem with detecting microcontroller check all connections carefully.

After detecting microcontroller, it’s time to read fuse bits and lock bits. As shown in below screenshot click on “Read.” Make sure you don’t write wrong fuse bits, otherwise your microcontroller will stop working.

The default value of fuse bit.

  • LOW Fuse : 0x62
  • HIGH Fuse : 0xD9
  • Extended : 0x07
  • LOCK :0xFF

To configure the Atmega328 for use with Arduino Uno boards, set the fuse settings as below:

  • LOW Fuse=0xFF
  • HIGH Fuse=0xDE
  • Extended Fuses=0x05

Under Flash, browse the hex file optiboot_atmega328.hex which you downloaded previously, select the file and click “Open.”

Now click on “Program!” button. It will take about 30 seconds; You can now use your cheap ATMega328 microcontroller as a regular Arduino.

You now have an Atmega328P that can be programmed with the Arduino IDE. Just plug in your new Atmega328P into any Arduino Uno board or using a USB to Serial Converter to upload your Arduino Sketch.

6 Response on “Burning the Bootloader on ATMega328 using USBasp Programmer

  1. Thanks a lot …As I didnt want to take out the atmega of my UNO everytime i bootloaded or programmed my microcontroller, this is the best way to do it.Also the PIn diagram I used was one from google.Please do check yours.Also a big thanks for the software…..

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.