burn usbasp bootloader using arduino?

Go To Last Post
32 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is it possible to burn the atmega8 usbasp firmware using arduinoISP? If so can someone guide me how to make it? I'm using atmega8l-8pu because atmega8-16pu is not available at the moment.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Run the ArduinoISP sketch. It tells you which pins to connect for ISP. Connect LEDs to show status.

From a commandline, run avrdude -c stk500v1 -P com4 -b 19200 -p atmega8 ...

This is assuming the arduino is on com4.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My atmega8 is on a breadboard. Do I have to use a crystal and resistors or just use the external clock? What about fuses do I need to burn them?

Sorry for bothering you. I'm just a noob.

This is my setup:

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your setup does not have any LED on digital #9 or #8. You will be a lot happier watching your ArduinoISP working.

Surely you must have some instructions with the USBasp project. Follow the instructions to the letter. You will probably be given an avrdude command. You just have to make sure you tell it the correct -c, -P, -b, -p parameters.

A virgin ATmega8 will not need a crystal. But if your target board has a crystal, you will need to set the fuses for a crystal.

Life is easier if you have a crystal on the breadboard. Then the AVR will run on the crystal as soon as you set the fuse.

Personally, I would do some practising with ArdunoISP. e.g. practice reading mega8 signature, program a blinky etc.

Then you program the USBasp firmware and fuses. Put the chip into the USBasp pcb and away you go.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just for reference, this is the USBAsp circuit:

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm using an atmega8l-8pu and not atmega8-16pu. Do I use an 8mhz or 16mhz crystal?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Do I use an 8mhz or 16mhz crystal?

Probably better to use the crystal that they specified in the design I would have thought?

You may not know this but USB works at either 12MHz or 480MHz. As AVR's cannot run at 480MHz then all AVR USB designs tend to have a 12MHz crystal.

That's what Fischl has included into that schematic I linked too. The USBAsp is unlikely to work with 8 or 16.

As clock.h in the .tar.gz says:

#define F_CPU           12000000L   /* 12MHz */
#define TIMERVALUE      TCNT0
#define CLOCK_T_320us	60

You *may* get away with running an 8MHz part at 12MHz.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

booble,

Are you using a proper pcb?

I would guess that the mega8L will be ok at 12MHz.
It is not guaranteed at this speed.

Have you got all the correct components?

Have you noticed that those six wires from the Arduino is all you need to have a reliable ISP programmer? As long as you have a good 6-pin socket on the end of your six wires, you can program any AVR. It is reassuring to use the LEDs too.

Let us know how you get on.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think I bricked this atmega8. Gonna get a new one and crystals tomorrow.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I bricked this atmega8

The only way you might have "bricked" it would be if you changed the state of bit 7 in the high fuse byte (even that's recoverable with the right equipment). For anything else you might have done to the mega8 it is recoverable using just the Arduino and the breadboard.

(even if that involves programming the Arduino to output a clock signal within the "MegaISP" sketch)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A virgin mega8 should have connected just fine by using avrdude.
What report did you get back from the commandline?

Try it without the crystal capacitors. They should be 22pF. That is a very small capacitance.
It will almost certainly work with an external clock.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry I burned the hex with avrdude gui. I didn't get any errors on commandline.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Guys I have some new atmega8s coming from Farnell. Is this the correct commandline for avrdude when burning the usbasp bootloader using arduino?

I'm not really sure how the fuses work. I'll be using a 12mhz crystal and 22pf capacitors. I'm not sure why there is another 4mhz crystal here in the sketch but I'm trying to make the usbasb_mg by Matthias Görner.

This was in the readme.txt
HFUSE=0xc9 LFUSE=0xef

avrdude -c stk500v1 -b 19200 -P com7 -p atmega8 -U hfuse:w:0xc9:m -U lfuse:w:0xef:m -U flash:w:usbasp.atmega8.2009-02-28.hex:i -v -F

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes C9/EF look like the right values to enable a 12MHz crystal and retain the other fuse bits at default. Remember that as soon as the fuses are changed the AVR will then need the crystal attached or you won't be able to do ISP again until it is.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
avrdude -c stk500v1 -b 19200 -P com7 -p atmega8 -U hfuse:w:0xc9:m -U lfuse:w:0xef:m -U flash:w:usbasp.atmega8.2009-02-28.hex:i -v -F

I am horrified. Please do NOT include the -F switch.

Avrdude gives you special options so that you can hang yourself. Do you have a death wish? Would you drive a car that has no windows? (and no brakes)

I would also suggest that you first of all check that avrdude is connecting to the chip in the first place. Is your Arduino on COM7 ?

Type this first:

avrdude -c stk500v1 -b 19200 -P com7 -p atmega8 -v

Then you can try programming the actual firmware.

Quote:
I'll be using a 12mhz crystal and 22pf capacitors. I'm not sure why there is another 4mhz crystal here in the sketch but I'm trying to make the usbasb_mg by Matthias Görner.

You must use the firmware that goes with your schematic, and uses your 12MHz crystal.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hmmm hfuse and lfuse are 0x00? when read using avrdude gui. Can someone help me?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dear booble,

If you can read the signature ok, then you are connecting ok. This is why you should never use the -F switch.

Did you type this:

avrdude -c stk500v1 -b 19200 -P com7 -p atmega8 -v

What did it say?

There really is nothing complicated.
1. You wire up the Arduino to the breadboard as in the picture.
2. You load the ArduinoISP sketch into the Arduino.
3. You type the avrdude command line.
4. You read what avrdude says back to you.

I know nothing about avrdude GUI's. I would be very suspicious of any GUI.
Real typing onto a real command line means that you know what you are doing. And most importantly, you can see the response from avrdude.

Obviously you need care to avoid typos in a command line. But you can edit and scroll back through previous commands with most command lines.

David.

n.b. if you have no crystal on the breadboard, your AVR will appear dead as soon as you successfully write the fuses.
Plug it into your pcb, (with crystal) and it will work fine.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrdude: Version 5.4, compiled on Jul 15 2007 at 12:37:51
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

System wide configuration file is "C:\Users\x\Desktop\usbasp.2009-02-28\bin\firmware\avrdude.conf"

Using Port : com7
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATMEGA8
Chip Erase delay : 10000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :

Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
eeprom 4 20 128 0 no 512 0 0 9000 90
00 0xff 0xff
flash 33 10 64 0 yes 8192 64 128 4500 45
00 0xff 0x00
lfuse 0 0 0 0 no 1 0 0 2000 20
00 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 2000 20
00 0x00 0x00
lock 0 0 0 0 no 1 0 0 2000 20
00 0x00 0x00
calibration 0 0 0 0 no 4 0 0 0
0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0
0 0x00 0x00

Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
Hardware Version: 2
Firmware Version: 1.16
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9406
avrdude: Expected signature for ATMEGA8 is 1E 93 07
Double check chip, or use -F to override this check.

avrdude done. Thank you.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What you have in your hand is not a mega8 but a mega168. From avrdude.conf you will see this:

#------------------------------------------------------------
# ATmega168
#------------------------------------------------------------

part
    id              = "m168";
    desc            = "ATMEGA168";
     has_debugwire = yes;
     flash_instr   = 0xB6, 0x01, 0x11;
     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
	             0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
	             0x99, 0xF9, 0xBB, 0xAF;
    stk500_devcode  = 0x86;
    # avr910_devcode = 0x;
    signature       = 0x1e 0x94 0x06;

The 1e 94 06 you are actually reading identifies the chip as a mega168

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is it reading the atmega168 on the arduino? Im pretty sure the one on the breadboard has atmega8l-8pi written on it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just a minute. Are you doing this?:

If so then you don't use avrdude at all (that could be used to contact the 168 on the Arduino at the top of the picture but not the mega 8 on the breadboard). Instead you do exactly what it says on the page:

http://arduino.cc/en/Tutorial/Ar...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The command looks similar. The protocol is the same. But the Aduino bootloader connects at 57600 baud. (assuming a modern Arduino)

The ArduinoISP application connects at 19200 baud.

There should be no conflict.

And if booble has connected the LEDs she would see the ArduinoISP heartbeat when it is running.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm actually using a Duemilanove clone. Atmega8-16pu are not yet available so I'm buying more atmega8l-8pi and test this setup.

I also have another question. Can I re-burn the bootloader in case I make a mistake or is it just a one time thing?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That picture shows a 168 in the breadboard not an 8 ?!?

There should be no concerns about upsetting the bootloader in the Duemilanove clone and it doesn't really matter WHAT you do to the 168 (or is it 8) in the breadboard because you can always ISP the bootloader (or whatever else you choose) back into it.

The one thing you don't want to do is set the CKSEL fuses of the 168/8 in the breadboard to "external oscillator" ("external crystal" is fine) or you'll make it tricky (but not impossible) to recover it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Duececimillia has a 16MHz mega328P on board. Its bootloader runs at 57600 baud.

Your excellent diagram shows a mega168 on the breadboard. You have the ArduinoISP LEDs wired up. Jolly good. The blue one should have a heartbeat. (are you blue-blooded). The red one should show errors. The green one should light when programming.

The Avrdude reported finding a mega168. Have you looked at the chip with a magnifying glass? What writing does it say?

Since you have a crystal on the breadboard, your AVR will still read after you have programmed the fuses.

How did you do the nice graphic?
This makes things so clear to other users.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry I just used the image from instructables. I actually use an atmega8l-8pi. Its strange I took a closer look at the arduino clone and it says atmega168v-10pi. I can't wait for my atmega328ps to be shipped from Farnell. If I successfully bootload this atmega8 then I can upload the arduino bootloader on the 328s as well.

Guys If I build a breadboard arduino compatible with the atmega8 it would approximately cost me about 6 dollars here in the Philippines. $3 for the atmega8, $2 for the breadboard, $1 for the (crystal, resistors and capacitors). They sure are dumping a lot of cheap stuff here from China. The USB type B jack I got 2 for a dollar. And if I decide to make a pcb board - a dollar can get you a lot of Chinese made pcbs.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How about being a little more revealing?

A regular Duemilanove has a mega328P and bootloads at 57600 baud.
If yours has a 16MHz mega168, say so. A mega168V will most likely run at 8MHz. What speed does the bootloader run at? I run a 'mega168 NG board' on my STK500. That bootloader runs at 19200 baud.

So it is quite possible that you are speaking to the mega186V bootloader at 19200 instead of the ArduinoISP application at 19200 baud. You can tell which board and COM# from the Tools menu.

You can always edit the ArduinoISP sketch so that it runs at a different baud rate. Remember to tell avrdude too.

But you can just look at your blue LED. The bootloader does a single pair of flashes. The ArduinoISP does a heartbeat. If you have no heartbeat, the sketch is NOT running.

Personally, I would shop around for a ready made Arduino. You really do not want a breadboarded version. How do you mount the FT232 ?

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i use a prolific pl2303hx not an ftdi.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The most pleasant part of the Arduino system is the uniformity and the fact that the designs are published.

So everyone throughout the civilised world can take the excellent diagram you posted.
1. Wire up their breadboard exactly the same.
2. Run the standard ArduinoISP sketch on the standard Arduino (or compatible)
3. The user types the relevant avrdude command line.
4. Users throughout the world are happy.

So you can expect all the pin-outs to be in the same places. You expect the pin-outs to be connected to the same port pins etc.

I am not aware of any Arduino design that uses a Prolific chip. I see no problem in principle, but why not post a link to your clone board?

If it is described as a clone, I would consider that it will be 100% compatible.

So you follow the instructions and watch the heartbeat LED rhythmically pulsating. If the heart stops, the ArduinoISP is NOT running.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

http://www.e-gizmo.com/kit.htm.
The heartbeat led isn't working. I guess that solves the issue if its 100% compatible.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The 'Gizduino' kit is not available. The Website has not got the details.

I can see no reason why it should not work just like any other Arduino.

Do you know how to Open a sketch, Compile a sketch, Upload the sketch to the Arduino?

e.g. have you compiled and uploaded any other Arduino sketches?

Have you connected the Heartbeat LED round the right way?

With the modern Aduinos, you just click on the Upload button. With old Arduinos, you press the RESET button and click Upload.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i have already done servo tests with it and the knightrider led sketch and it worked fine. im not sure why the heartbeat doesnt work.