Introduction: USBASP Bootloading a ATMega328p With a 8mhZ Internal Clock

Picture of USBASP Bootloading a ATMega328p With a 8mhZ Internal Clock

What are we going to do is program an ATMega328P without an external crystal by using USBASP programmer and the Arduino IDE.
Why would we want this? It uses less components and gets up closer to knowing how to program with something like WINAVR and because programming is fun an addicting. Not everything runs on Arduino, but it is a great place to start. 


I use an USBASP clone programmer from my local electronics store. I have read this same procedure can be done on and Arduino board, but i have not been unsuccessful at making that work.  

Step 1: Connections

Picture of Connections


If you follow the ISP Header 6-pin and connect the
MISO to the MISO on the chip
SCK to SCK on the chip.
You get the idea.
You could do all this on a breadboard or you could use the avr target board fournd here.
Additionally you can get some good help here

The 6-Pin header is on the USBASP.

 

Step 2: Board Files

Picture of Board Files

If your board selection does not look like mine where is says " ATMEGA 328 on a breadboard (8MHz internal clock) "  then you need to install the board files i have provided.
Even if you do have the " ATMEGA 328 on a breadboard (8MHz internal clock) " showing but it is not working then you need to install my files.

The only difference is the last line.     atmega328bb.build.variant=arduino:standard

Step 3: How Do I Install This File?

Picture of How Do I Install This File?

This where my files are. Hopefully yours will be simulare. 
So to get to where we need to be,
Open up the:
Sketch book file 
next  Hardware
next Arduino
next  boards
and you are there. 
Open the boards file in notepad. Once opened you will need to go to the bottom and just copy and past my file there.
Follow the pictures please.
DO NOT forget to hit save !

 

Step 4: Installed Now What?

Picture of Installed Now What?

In the Arduino IDE, select the tools menu then Boards and make sure the  ATMEGA 328 on a breadboard (8MHz internal clock) is highlighted.
Also in tools select the Programmer and choose USBasp.
Lastly in tools select Burn Bootloader and wait as it takes a minute or so. 
We do not worries about what serial port because we are using this is USB and not serial.

Step 5: What Happened?

Picture of What Happened?

After pressing Burn Bootloader it will say  " Burning bootloader ti I/O Board ( this may take a minute)  at the bottom of the IDE.
Notice also at the bottom it also the 8MHz board selected.

Next after that is finished it will say " Done burning bootloader "

Possibly there will be some errors showing about sck period and update firmware.
This still works even if those errors are showing, ignore them.

Comments

BerkcanA (author)2015-07-02

Error while burning bootloader: missing 'bootloader.tool' configuration parameter

Any idea ?

BerkcanA (author)BerkcanA2015-07-02

İt works arduino IDE 1.0.6 version.

lefolindo (author)2014-06-02

where ar the file that you have provided ( the board file for atmega328 (8 mhz internal clock) ?

WWC (author)lefolindo2014-06-02

If you are talking about my files there is links to them in the Instructable. If you are talking about a ATmega328P file that can be found on line easily enough.

Steve25 (author)2013-11-20

Nice guide! But can you program every atmega and attiny's (like atmega8 ore attiny85) with Arduino IDE?

WWC (author)Steve252013-11-20

I think not. If you search i believe wekapedia it will give you such an answer

Steve25 (author)WWC2013-11-21

Well i found some text for the atmega8:
##############################################################
atmega8u.name=ATMEGA8
atmega8u.upload.protocol=arduino
atmega8u.upload.maximum_size=7680
atmega8u.upload.speed=115200
atmega8u.bootloader.low_fuses=0xff
atmega8u.bootloader.high_fuses=0xcc
atmega8u.bootloader.path=optiboot
atmega8u.bootloader.file=optiboot_atmega8.hex
atmega8u.bootloader.unlock_bits=0x3F
atmega8u.bootloader.lock_bits=0x0F
atmega8u.build.mcu=atmega8
atmega8u.build.f_cpu=16000000L
atmega8u.build.core=arduino
atmega8u.build.variant=standard
##############################################################

Steve25 (author)Steve252013-11-21

What do i need to change in the code above? only the upload protocol to usbasp?

WWC (author)Steve252013-11-21

I wish i could help you but this is really getting beyond my knowledge range on this matter.
Perhaps if you could ask in the Instructables forums there is some very smart people there that may be able to help you if you ask nicely.
I wish you good luck.

About This Instructable

57,422views

35favorites

License:

Bio: Why would i buy something ready made when i can make it myself with half the features for twice the money? DIY!
More by WWC:3D Pinted Spool ReelHard Drive Tachometer for a Desktop Computer4093 Schmidt Trigger / Fan Speed Regulation
Add instructable to: