In this tutorial you'll learn how to burn arduino bootloader on new ATmega328 using USBasp ISP programmer.Please be noted that every Arduino Board comes with a microcontroller ATmega328 pre-program with arduino bootloader firmware. Therefore, there is no need to burn the bootloader firmware again.But if you want to make your own DIY arduino board than you need to burn arduino bootloader into ATmega328.So here i'll show you how to load arduino bootloader into atmega328 step by step.
Required components:
- USBasp Programmer
- Bread Board
- ATmega328
- 2pcs 22pf Cap.
- 16MHz Crystal
- 10K Resistor
- Hook up wire
- AVRdude Software
First of all wire up the circuit in breadboard as show in below diagram.Please connect all the connection carefully.
ATmega328 connection with USPasp |
Show in above circuit JP1 is from USBasp programmer. Connect all the connection carefully as per above diagram using jumper wire.If you wire up your circuit correctly than it's time to load hex file which is located in your arduino software folder here is complete path arduino-1.0.5-windows\arduino1.0.5\hardware\arduino\bootloaders\optiboot\optiboot_atmega328.hex you can also download from here optiboot_atmega328
First of all you need to install AVRdude software and USBasp Programmer Driver.
Open AVRdude software and select programmer type from the drop-down list show in below image.In our case programmer is USBasp programmer.
After Selecting programmer type click on "Detect" so programmer automatically detect ATmega328. If you have any problem with detecting microcontroller check all connection carefully.
After detecting microcontroller now it's time to read fuse bits and lock bits. Show in below screen shot click on "Read". Make sure do not write wrong fuse bit otherwise your microcontroller stop working.
Default value of fuse bit.
LOW Fuse : 0x62
HIGH Fuse : 0xD9
Extended : 0x07
LOCK :0xFF
Now browse hex file which is located in your arduino software package"arduino-1.0.5-windows\arduino1.0.5\hardware\arduino\bootloaders\optiboot\optiboot_atmega328.hex" you can also download from here optiboot_atmega328. Select file and click "Open".
Now click on "Program!" button. It will take like 30 seconds, You can now use your cheap, ATMega328 as a normal Arduino.
Hi, great to see how to do it manually and have more control over the process. I have just use the Arduino IDE to burn the bootloader. It supports about 5 programmers.
ReplyDeleteThank you MrMobilewill
ReplyDeleteThis is a very good tips especially to those new to blogosphere, brief and accurate information… Thanks for sharing this one. A must read article.
ReplyDeleteUsed Lab Equipment Distributors
avrdude.exe: set SCK frequency to 1500000 Hz
ReplyDeleteavrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.
avrdude.exe: error: programm enable: target doesn’t answer. 1
avrdude.exe: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude.exe done. Thank you.
this error show. how to sort out this error… plz give advice….
Dear Firat G,
ReplyDeleteCheck the connection between programmer and target microcontroller and also check the clock frequency target microcontroller.
I did it thank you very much for your help.I had connection problem and corrected it.But i want to ask you something else.When i read fuse bit, i see different values from values you write here as default.I couldn't decide which one i have to use.
ReplyDeleteDear KOÜ Diş Hekimliği Sosyal Etkinlikler Topluluğu KOUDHSET,
DeleteFirst of all erase chip and check connections,and write Low fuse (0xFF),High fuse(0xDE), Extended fuse(0x05), lock fuse(0x0f).
It works thank you so much...
DeleteI did it thank you very much for your help.I had connection problem and corrected it.But i want to ask you something else.When i read fuse bit, i see different values from values you write here as default.I couldn't decide which one i have to use.
ReplyDeleteVery good. Thank you.
ReplyDeleteYou are welcome
DeleteHello,
ReplyDeleteDon't you think that, for reset must be connected pin 1 no 29?
Thank you!
Oppsss I'll update very soon.
ReplyDeleteThank you very much for point out mistake.
avrdude.exe: set SCK frequency to 1500000 Hz
ReplyDeleteavrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.
avrdude.exe: error: programm enable: target doesn’t answer. 1
avrdude.exe: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude.exe done. Thank you.
this error show. how to sort out this error… plz give advice….
you should update your USBASP firmware to get rid off that error. google for "Updating firmware on USBASP bought from eBay" by Roger Clark.
Deletei've done it successfully to my USBASP. good luck.
I am getting different fuse bits when i read from my atmega328p
ReplyDeleteOpen Electronics blog is one of my favorite blogs which I often keep visit to keep me up to date. prototype pcb assembly
ReplyDelete